summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mqtt-esp5100.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/mqtt-esp5100.c b/mqtt-esp5100.c
index abaadfa..80afd60 100644
--- a/mqtt-esp5100.c
+++ b/mqtt-esp5100.c
@@ -186,7 +186,7 @@ discovery (struct mosquitto *mosq, int battery) {
{\n\
\"device\": {\n\
\"identifiers\": \"%s\",\n\
- \"name\": \"ESP-5100\",\n\
+ \"name\": \"ESP-5100-%d\",\n\
\"manufacturer\": \"EndurEnergy\",\n\
\"hw_version\": \"0x%hx\",\n\
\"serial_number\": \"%s\",\n\
@@ -205,14 +205,6 @@ discovery (struct mosquitto *mosq, int battery) {
\"value_template\":\"{{ value_json.canid }}\",\n\
\"state_topic\": \"solar/battery/esp-5100/%s/state\"\n\
},\n\
- \"ESP-5100_%s_SOH\": {\n\
- \"platform\": \"sensor\",\n\
- \"device_class\": \"battery\",\n\
- \"name\": \"SOH\",\n\
- \"unique_id\": \"%ssoh\",\n\
- \"value_template\":\"{{ value_json.soh }}\",\n\
- \"state_topic\": \"solar/battery/esp-5100/%s/state\"\n\
- },\n\
\"ESP-5100_%s_SOC\": {\n\
\"platform\": \"sensor\",\n\
\"device_class\": \"battery\",\n\
@@ -221,6 +213,14 @@ discovery (struct mosquitto *mosq, int battery) {
\"value_template\":\"{{ value_json.soc }}\",\n\
\"state_topic\": \"solar/battery/esp-5100/%s/state\"\n\
},\n\
+ \"ESP-5100_%s_SOH\": {\n\
+ \"platform\": \"sensor\",\n\
+ \"device_class\": \"battery\",\n\
+ \"name\": \"SOH\",\n\
+ \"unique_id\": \"%ssoh\",\n\
+ \"value_template\":\"{{ value_json.soh }}\",\n\
+ \"state_topic\": \"solar/battery/esp-5100/%s/state\"\n\
+ },\n\
\"ESP-5100_%s_I\": {\n\
\"platform\": \"sensor\",\n\
\"device_class\": \"current\",\n\
@@ -414,7 +414,7 @@ discovery (struct mosquitto *mosq, int battery) {
}\n\
}\n\
",
- B.sn, B.hw_ver, B.sn, B.sw_ver, MQTT_ESP5100_NAME, MQTT_ESP5100_VERSION, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn,
+ B.sn, battery, B.hw_ver, B.sn, B.sw_ver, MQTT_ESP5100_NAME, MQTT_ESP5100_VERSION, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn,
B.sn, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn,
B.sn, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn,
B.sn, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn, B.sn,
@@ -433,10 +433,10 @@ publish (struct mosquitto *mosq, int battery) {
snprintf (topic, sizeof (topic), "solar/battery/esp-5100/%s/state", B.sn);
snprintf (payload, sizeof (payload),"\
{\
- \"canid\": %d, \"soh\": %4.2f, \"soc\": %4.2f, \"i\": %5.3f, \"v\": %5.3f, \"t1\": %d, \"t2\": %d, \"t3\": %d,\
+ \"canid\": %d, \"soc\": %4.2f, \"soh\": %4.2f, \"i\": %5.3f, \"v\": %5.3f, \"t1\": %d, \"t2\": %d, \"t3\": %d,\
\"v01\": %5.3f, \"v02\": %5.3f, \"v03\": %5.3f, \"v04\": %5.3f, \"v05\": %5.3f, \"v06\": %5.3f, \"v07\": %5.3f, \"v08\": %5.3f,\
\"v09\": %5.3f, \"v10\": %5.3f, \"v11\": %5.3f, \"v12\": %5.3f, \"v13\": %5.3f, \"v14\": %5.3f, \"v15\": %5.3f, \"v16\": %5.3f }",
- battery, B.soh, B.soc, (float)B.current, (float)B.f1_voltage / 1000, B.t[0], B.t[1], B.t[2],
+ battery, B.soc, B.soh, (float)B.current, (float)B.pack_voltage / 1000, B.t[0], B.t[1], B.t[2],
(float)B.cell_voltages[0] / 1000, (float)B.cell_voltages[1] / 1000, (float)B.cell_voltages[2] / 1000, (float)B.cell_voltages[3] / 1000,
(float)B.cell_voltages[4] / 1000, (float)B.cell_voltages[5] / 1000, (float)B.cell_voltages[6] / 1000, (float)B.cell_voltages[7] / 1000,
(float)B.cell_voltages[8] / 1000, (float)B.cell_voltages[9] / 1000, (float)B.cell_voltages[10] / 1000, (float)B.cell_voltages[11] / 1000,