Skip to content

Commit

Permalink
Version 1.25
Browse files Browse the repository at this point in the history
Fixed bug with ESP-NOW sensors not being added to HA via MQTT discovery.
  • Loading branch information
aZholtikov committed Jan 28, 2023
1 parent 1c306e0 commit 8e9082f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void setupWebServer(void);

void connectToMqtt(void);

const String firmware{"1.24"};
const String firmware{"1.25"};

String espnowNetName{"DEFAULT"};

Expand Down Expand Up @@ -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<ha_sensor_device_class_t>());
if (type == HACT_BINARY_SENSOR)
{
jsonConfig["device_class"] = getValueName(json["class"].as<ha_binary_sensor_device_class_t>());
Expand Down

0 comments on commit 8e9082f

Please sign in to comment.