mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-15 20:30:01 +03:00
@@ -1367,6 +1367,7 @@ bool Mqtt::publish_ha_climate_config(const DeviceValue & dv, const bool has_room
|
||||
// map EMS modes to HA climate modes
|
||||
// EMS modes: auto, manual, heat, off, night, day, nofrost, eco, comfort, cool)
|
||||
// HA supports: auto, off, cool, heat, dry, fan_only
|
||||
// we map day and manual to heat
|
||||
if (mode_options != nullptr) {
|
||||
// scan through mode_options and add to modes
|
||||
bool found_auto = false;
|
||||
@@ -1377,13 +1378,13 @@ bool Mqtt::publish_ha_climate_config(const DeviceValue & dv, const bool has_room
|
||||
const char * mode = mode_options[i][0]; // take EN
|
||||
if (!strcmp(mode, FL_(auto)[0])) {
|
||||
found_auto = true;
|
||||
} else if (!strcmp(mode, FL_(heat)[0])) {
|
||||
} else if (!strcmp(mode, FL_(heat)[0]) || !strcmp(mode, FL_(day)[0]) || !strcmp(mode, FL_(manual)[0])) {
|
||||
found_heat = true;
|
||||
} else if (!strcmp(mode, FL_(off)[0])) {
|
||||
found_off = true;
|
||||
} else if (!strcmp(mode, FL_(cool)[0])) {
|
||||
found_cool = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// only add modes if we found at least one
|
||||
|
||||
@@ -3104,11 +3104,10 @@ bool Thermostat::set_mode(const char * value, const int8_t id) {
|
||||
uint8_t enum_index = 0;
|
||||
|
||||
// check for the mode being a full string name or single digit
|
||||
// if not found, try the HA mode list if HA is enabled
|
||||
if (!Helpers::value2enum(value, enum_index, mode_list)) {
|
||||
mode_list = FL_(enum_mode_ha);
|
||||
if (!Mqtt::ha_enabled() || !Helpers::value2enum(value, enum_index, mode_list)) {
|
||||
// We have logging on fail in command.cpp
|
||||
// LOG_WARNING("wrong mode: %s", value);
|
||||
return false; // not found
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user