From 8e9082f05e8fcf47f2734f88cabb01f34d0460a8 Mon Sep 17 00:00:00 2001 From: Alexey Zholtikov Date: Sat, 28 Jan 2023 12:15:09 +0300 Subject: [PATCH] Version 1.25 Fixed bug with ESP-NOW sensors not being added to HA via MQTT discovery. --- src/main.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 420a42f..667fb29 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -34,7 +34,7 @@ void setupWebServer(void); void connectToMqtt(void); -const String firmware{"1.24"}; +const String firmware{"1.25"}; String espnowNetName{"DEFAULT"}; @@ -258,6 +258,8 @@ void onEspnowMessage(const char *data, const uint8_t *sender) jsonConfig["force_update"] = "true"; jsonConfig["qos"] = 2; jsonConfig["retain"] = "true"; + if (type == HACT_SENSOR) + jsonConfig["device_class"] = getValueName(json["class"].as()); if (type == HACT_BINARY_SENSOR) { jsonConfig["device_class"] = getValueName(json["class"].as());