From d1e95807d4a255935b5f284837a61ca0e5be3b6f Mon Sep 17 00:00:00 2001 From: Dirk Baumeister Date: Sun, 8 Jan 2023 21:46:56 +0100 Subject: [PATCH 1/2] fixed unit of measurement on mqtt values for home assistant --- src/mqtt.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mqtt.cpp b/src/mqtt.cpp index d6b97ff..0ce11d9 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -138,7 +138,7 @@ static void publishHADiscoveryMessage(bool publish) { JSON["name"] = "WiFi Power Meter " + String(settings.systemID) + " WiFi Signal Strength"; JSON["unique_id"] = "wifipowermeter-" + String(settings.systemID)+ "-rssi"; - JSON["unit_of_meas"] = "dbm"; + JSON["unit_of_meas"] = "dBm"; JSON["dev_cla"] = "signal_strength"; JSON["stat_t"] = devTopic; JSON["val_tpl"] = "{{ value_json."+ String(MQTT_SUBTOPIC_RSSI) +" }}"; @@ -155,6 +155,7 @@ static void publishHADiscoveryMessage(bool publish) { JSON["name"] = "WiFi Power Meter " + String(settings.systemID) + " Uptime"; JSON["unique_id"] = "wifipowermeter-" + String(settings.systemID)+ "-uptime"; + JSON["unit_of_meas"] = "d"; JSON["ic"] = "mdi:clock-outline"; JSON["dev_cla"] = "duration"; JSON["stat_t"] = devTopic; From b15628a0bc70fe87f5e303a5c43038e90b400fba Mon Sep 17 00:00:00 2001 From: Lars Wessels Date: Tue, 31 Jan 2023 22:59:22 +0100 Subject: [PATCH 2/2] bumped to v231, fixed typo --- include/config.h | 2 +- platformio.ini | 2 +- src/mqtt.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/config.h b/include/config.h index a461c33..b6721ad 100644 --- a/include/config.h +++ b/include/config.h @@ -81,7 +81,7 @@ // to make Arduino IDE happy // version number is set in platformio.ini #ifndef FIRMWARE_VERSION -#define FIRMWARE_VERSION 230 +#define FIRMWARE_VERSION 231 #endif // set default port for MQTT over TLS diff --git a/platformio.ini b/platformio.ini index 08c711f..3cd945e 100644 --- a/platformio.ini +++ b/platformio.ini @@ -12,7 +12,7 @@ default_envs = d1_mini description = Firmware for ESP8266 power meter [common] -firmware_version = 230 +firmware_version = 231 upload_speed = 460800 monitor_speed = 115200 port = /dev/tty.wchusbserial1410 diff --git a/src/mqtt.cpp b/src/mqtt.cpp index 0ce11d9..818714d 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -104,7 +104,7 @@ static void publishHADiscoveryMessage(bool publish) { "%s%s/runtime/config", MQTT_TOPIC_DISCOVER, systemID); if (publish) { - Serial.printf("Sending Home Asssistant MQTT discovery message for %s...\n", devTopic); + Serial.printf("Sending Home Assistant MQTT discovery message for %s...\n", devTopic); JSON["name"] = "WiFi Power Meter " + String(settings.systemID) + " Ferraris Impuls Counter"; JSON["unique_id"] = "wifipowermeter-" + String(settings.systemID)+ "-impuls-counter"; @@ -166,7 +166,7 @@ static void publishHADiscoveryMessage(bool publish) { } else if (strlen(devTopic) > 1) { // send empty (retained) message to delete sensor autoconfiguration - Serial.printf("Removing Home Asssistant MQTT discovery message for %s...\n", devTopic); + Serial.printf("Removing Home Assistant MQTT discovery message for %s...\n", devTopic); mqtt->publish(topicCount, "", true); delay(50);