fix SRC climate, #2960

This commit is contained in:
MichaelDvP
2026-02-15 12:03:07 +01:00
parent 27c471f45f
commit 72f08a86cf

View File

@@ -2135,7 +2135,7 @@ void EMSdevice::mqtt_ha_entity_config_create() {
if (needs_update) { if (needs_update) {
const char * const ** mode_options = nullptr; const char * const ** mode_options = nullptr;
for (auto & d : devicevalues_) { for (const auto & d : devicevalues_) {
// make sure mode in same circuit is DeviceValueType::ENUM // make sure mode in same circuit is DeviceValueType::ENUM
if ((d.tag == dv.tag) && (d.type == DeviceValueType::ENUM) && !strcmp(d.short_name, FL_(mode)[0]) && (d.options_size > 0)) { if ((d.tag == dv.tag) && (d.type == DeviceValueType::ENUM) && !strcmp(d.short_name, FL_(mode)[0]) && (d.options_size > 0)) {
// get options // get options
@@ -2167,19 +2167,25 @@ void EMSdevice::mqtt_ha_entity_config_create() {
} }
// SRC thermostats mapped to connect/src1/... always contains mode, seltemp, currtemp // SRC thermostats mapped to connect/src1/... always contains mode, seltemp, currtemp
if (dv.tag >= DeviceValueTAG::TAG_SRC1 && dv.tag <= DeviceValueTAG::TAG_SRC16 && !strcmp(dv.short_name, FL_(mode)[0])) { if (dv.tag >= DeviceValueTAG::TAG_SRC1 && dv.tag <= DeviceValueTAG::TAG_SRC16 && !strcmp(dv.short_name, FL_(seltemp)[0])) {
// add icon if we have one // add modes and icon if we have one
const char * icon = nullptr; const char * icon = nullptr;
for (auto & d : devicevalues_) { const char * const ** mode_options = nullptr;
if (d.tag == dv.tag && !strcmp(d.short_name, FL_(icon)[0]) && (dv.type == DeviceValueType::ENUM)) { for (const auto & d : devicevalues_) {
if ((d.tag != dv.tag) || (d.type != DeviceValueType::ENUM)) {
continue;
}
if (!strcmp(d.short_name, FL_(mode)[0]) && (d.options_size > 0)) {
mode_options = d.options;
}
if (!strcmp(d.short_name, FL_(icon)[0])) {
uint8_t val = *(uint8_t *)(d.value_p); uint8_t val = *(uint8_t *)(d.value_p);
if (val != 0 && val < d.options_size) { if (val != 0 && val < d.options_size) {
icon = d.options[val][0]; icon = d.options[val][0];
} }
break;
} }
} }
Mqtt::publish_ha_climate_config(dv, true, dv.options, false, icon); Mqtt::publish_ha_climate_config(dv, true, mode_options, false, icon);
count++; count++;
} }