fix ha mode, boolean to match setting bool format

This commit is contained in:
proddy
2026-01-09 18:47:14 +01:00
parent 3218620a0e
commit 0efbd0528e

View File

@@ -1424,11 +1424,13 @@ bool Mqtt::publish_ha_climate_config(const DeviceValue & dv, const bool has_room
doc["mode_cmd_t"] = mode_cmd_s; doc["mode_cmd_t"] = mode_cmd_s;
// add hvac_action - https://github.com/emsesp/EMS-ESP32/discussions/2562 // add hvac_action - https://github.com/emsesp/EMS-ESP32/discussions/2562
doc["act_t"] = "~/boiler_data"; doc["act_t"] = "~/boiler_data";
doc["act_tpl"] = "{% if value_json.hpactivity=='cooling'%}cooling{%elif value_json.heatingactive=='on'%}heating{%else%}idle{%endif%}"; char on_string[12];
doc["act_tpl"] = "{% if value_json.hpactivity=='cooling'%}cooling{%elif value_json.heatingactive=='" + std::string(Helpers::render_boolean(on_string, true))
+ "'%}heating{%else%}idle{%endif%}"; // uses boolean translation for on/true
// map EMS modes to HA climate modes // map EMS modes to HA climate modes
// EMS modes: auto, manual, heat, off, night, day, nofrost, eco, comfort, cool) // EMS modes: auto, manual, heat, off, night, day, nofrost, eco, comfort, cool
// HA supports: auto, off, cool, heat, dry, fan_only // HA supports: auto, off, cool, heat, dry, fan_only
bool found_auto = false; bool found_auto = false;
bool found_heat = false; bool found_heat = false;