From 7e1d0ddff278e8a558e9724e5ead459cefba00e2 Mon Sep 17 00:00:00 2001 From: Yurii Date: Mon, 23 Nov 2026 07:35:37 +0300 Subject: [PATCH] feat: expose smart heating control across device interfaces Rename indoor_temp_control to smart_control across firmware, REST, the dashboard and Home Assistant. Publish state/master/heating/smart_control over MQTT and remove the redundant state/master/mqtt/connected topic. --- include/Settings.h | 2 +- include/strings_shared.h | 2 +- src/config.cpp | 10 +++++----- src/ha_discovery.cpp | 2 +- src/mqtt.cpp | 8 ++++---- src/regulator.cpp | 4 ++-- src_data/pages/dashboard.html | 4 ++-- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/Settings.h b/include/Settings.h index b6e9bfa..2826cdf 100644 --- a/include/Settings.h +++ b/include/Settings.h @@ -249,7 +249,7 @@ struct Variables { struct { bool blocking = false; bool enabled = false; - bool indoorTempControl = false; + bool smartControl = false; bool overheat = false; bool freezing = false; float setpointTemp = 0.0f; diff --git a/include/strings_shared.h b/include/strings_shared.h index 8c1f1d4..11c4288 100644 --- a/include/strings_shared.h +++ b/include/strings_shared.h @@ -110,7 +110,6 @@ inline const char S_IMMERGAS_FIX[] = "immergas_fix"; inline const char S_ALWAYS_SEND_INDOOR_TEMP[] = "always_send_indoor_temp"; inline const char S_INDOOR_TEMP[] = "indoor_temp"; inline const char S_INDOOR_TEMP_AVG_TYPE[] = "indoor_temp_avg_type"; -inline const char S_INDOOR_TEMP_CONTROL[] = "indoor_temp_control"; inline const char S_IN_GPIO[] = "in_gpio"; inline const char S_INPUT[] = "input"; inline const char S_INTERVAL[] = "interval"; @@ -187,6 +186,7 @@ inline const char S_SIGNAL_QUALITY[] = "signal_quality"; inline const char S_SIZE[] = "size"; inline const char S_SLAVE[] = "slave"; inline const char S_SLOPE[] = "slope"; +inline const char S_SMART_CONTROL[] = "smart_control"; inline const char S_SSID[] = "ssid"; inline const char S_STA[] = "sta"; inline const char S_STATE[] = "state"; diff --git a/src/config.cpp b/src/config.cpp index ff32696..1017af7 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -1336,11 +1336,11 @@ static bool normalizeHeatingFreezeBounds(HeatingSettings& dst) { static SettingResult setHeatingTarget(HeatingSettings& dst, float value) { bool changed = false; - bool indoorTempControl = settings.equitherm.enabled || settings.pid.enabled || settings.opentherm.options.nativeOTC; - float minTemp = indoorTempControl + bool smartControl = settings.equitherm.enabled || settings.pid.enabled || settings.opentherm.options.nativeOTC; + float minTemp = smartControl ? THERMOSTAT_INDOOR_MIN_TEMP : dst.minTemp; - float maxTemp = indoorTempControl + float maxTemp = smartControl ? THERMOSTAT_INDOOR_MAX_TEMP : dst.maxTemp; @@ -1353,7 +1353,7 @@ static SettingResult setHeatingTarget(HeatingSettings& dst, float value) { ); if (!valid) { - value = indoorTempControl ? THERMOSTAT_INDOOR_DEFAULT_TEMP : DEFAULT_HEATING_TARGET_TEMP; + value = smartControl ? THERMOSTAT_INDOOR_DEFAULT_TEMP : DEFAULT_HEATING_TARGET_TEMP; } value = constrain(value, minTemp, maxTemp); @@ -3405,7 +3405,7 @@ JsonVariant toJson(const Variables& src, JsonVariant dst) { auto mHeating = master[S_HEATING].to(); mHeating[S_ENABLED] = src.master.heating.enabled; mHeating[S_BLOCKING] = src.master.heating.blocking; - mHeating[S_INDOOR_TEMP_CONTROL] = src.master.heating.indoorTempControl; + mHeating[S_SMART_CONTROL] = src.master.heating.smartControl; mHeating[S_OVERHEAT] = src.master.heating.overheat; mHeating[S_FREEZING] = src.master.heating.freezing; mHeating[S_SETPOINT_TEMP] = roundf((src.master.heating.setpointTemp == 0 ? 0 : convertTemp(src.master.heating.setpointTemp, UnitSystem::METRIC, settings.system.unitSystem)), 2); diff --git a/src/ha_discovery.cpp b/src/ha_discovery.cpp index 4d25a52..e4f1f43 100644 --- a/src/ha_discovery.cpp +++ b/src/ha_discovery.cpp @@ -608,7 +608,7 @@ void publishHaEntity(HaEntity entityId, bool remove) { if (!remove) { climate->icon = "mdi:radiator"; climate->enabledByDefault = true; - climate->currentTemperatureTopic = vars.master.heating.indoorTempControl + climate->currentTemperatureTopic = vars.master.heating.smartControl ? "~/state/master/heating/indoor_temp" : "~/state/master/heating/current_temp"; climate->temperatureCommandTopic = "~/settings/heating/target/set"; diff --git a/src/mqtt.cpp b/src/mqtt.cpp index 63ebced..0a14547 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -247,6 +247,7 @@ static void publishSlaveState() { static void publishMasterState() { publishValue(mqttTopic("state/master/heating/enabled"), vars.master.heating.enabled); publishValue(mqttTopic("state/master/heating/blocking"), vars.master.heating.blocking); + publishValue(mqttTopic("state/master/heating/smart_control"), vars.master.heating.smartControl); publishValue(mqttTopic("state/master/heating/overheat"), vars.master.heating.overheat); publishValue(mqttTopic("state/master/heating/freezing"), vars.master.heating.freezing); publishValue( @@ -284,7 +285,6 @@ static void publishMasterState() { publishValue(mqttTopic("state/master/dhw/max_temp"), convertTemp(settings.dhw.maxTemp, UnitSystem::METRIC, settings.system.unitSystem), 2); publishValue(mqttTopic("state/master/network/connected"), isNetworkConnected()); publishValue(mqttTopic("state/master/network/rssi"), std::to_string(vars.network.rssi)); - publishValue(mqttTopic("state/master/mqtt/connected"), isMqttConnected()); publishValue(mqttTopic("state/master/emergency/state"), vars.emergency.state); publishValue(mqttTopic("state/master/ext_pump/state"), vars.externalPump.state); publishValue(mqttTopic("state/master/cascade_control/input"), vars.cascadeControl.input); @@ -762,7 +762,7 @@ Task mqttConfigureTask("Configure MQTT", Task::Type::ONCE, [](void*) { static uint8_t heatingMinTemp = vars.slave.heating.minTemp; static uint8_t heatingMaxTemp = vars.slave.heating.maxTemp; static bool dhwSupport = settings.opentherm.options.dhwSupport; - static bool indoorTempControl = vars.master.heating.indoorTempControl; + static bool smartControl = vars.master.heating.smartControl; static float heatingMinSetpointTemp = vars.master.heating.minTemp; static float heatingMaxSetpointTemp = vars.master.heating.maxTemp; static uint8_t dhwMinTemp = settings.dhw.minTemp; @@ -827,8 +827,8 @@ Task mqttConfigureTask("Configure MQTT", Task::Type::ONCE, [](void*) { .set(HA_ENTITY_DHW_OVERHEAT); } - if (indoorTempControl != vars.master.heating.indoorTempControl) { - indoorTempControl = vars.master.heating.indoorTempControl; + if (smartControl != vars.master.heating.smartControl) { + smartControl = vars.master.heating.smartControl; mqttHaPendingEntities.set(HA_ENTITY_HEATING_CLIMATE); } diff --git a/src/regulator.cpp b/src/regulator.cpp index 7c792cb..d4ab1bd 100644 --- a/src/regulator.cpp +++ b/src/regulator.cpp @@ -188,12 +188,12 @@ static Task regulatorTask("Regulator", [](void*) { } if (settings.equitherm.enabled || settings.pid.enabled || settings.opentherm.options.nativeOTC) { - vars.master.heating.indoorTempControl = true; + vars.master.heating.smartControl = true; vars.master.heating.minTemp = THERMOSTAT_INDOOR_MIN_TEMP; vars.master.heating.maxTemp = THERMOSTAT_INDOOR_MAX_TEMP; } else { - vars.master.heating.indoorTempControl = false; + vars.master.heating.smartControl = false; vars.master.heating.minTemp = settings.heating.minTemp; vars.master.heating.maxTemp = settings.heating.maxTemp; } diff --git a/src_data/pages/dashboard.html b/src_data/pages/dashboard.html index c816ed6..6b2a844 100644 --- a/src_data/pages/dashboard.html +++ b/src_data/pages/dashboard.html @@ -598,7 +598,7 @@ const result = await response.json(); // Graph - setValue('#tHeatCurrentTemp', result.master.heating.indoor_temp_control + setValue('#tHeatCurrentTemp', result.master.heating.smart_control ? result.master.heating.indoor_temp : result.master.heating.current_temp ); @@ -683,7 +683,7 @@ result.master.heating.blocking ? "success" : "error", result.master.heating.blocking ? "red" : "green" ); - setState('.mHeatIndoorTempControl', result.master.heating.indoor_temp_control); + setState('.mHeatSmartControl', result.master.heating.smart_control); setStatus( '.mHeatOverheat', result.master.heating.overheat ? "success" : "error",