mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-08 08:49:52 +03:00
fix ha mqtt parsing hc number - #609
This commit is contained in:
@@ -964,7 +964,7 @@ void Thermostat::register_mqtt_ha_config(uint8_t hc_num) {
|
||||
// for each of the heating circuits
|
||||
std::string topic2(100, '\0');
|
||||
snprintf_P(&topic2[0], topic2.capacity() + 1, PSTR("thermostat_hc%d"), hc_num);
|
||||
register_mqtt_topic(topic2, [&](const char * m) { return thermostat_ha_cmd(m, hc_num); });
|
||||
register_mqtt_topic(topic2, [=](const char * m) { return thermostat_ha_cmd(m, hc_num); });
|
||||
|
||||
char hc_name[10]; // hc{1-4}
|
||||
strlcpy(hc_name, "hc", 10);
|
||||
@@ -1023,7 +1023,7 @@ void Thermostat::register_mqtt_ha_config(uint8_t hc_num) {
|
||||
}
|
||||
|
||||
// for HA specifically when receiving over MQTT in the thermostat topic
|
||||
// it could be either a 'mode' or a float value
|
||||
// it could be either a 'mode' or a float value for a temperature. we try brute force both and see which one works.
|
||||
// return true if it parses the message correctly
|
||||
bool Thermostat::thermostat_ha_cmd(const char * message, uint8_t hc_num) {
|
||||
// check if it's json. We know the message isn't empty
|
||||
|
||||
Reference in New Issue
Block a user