From 213d4e43b606345ccd4e5d0ecc0ce01c3cf7ca83 Mon Sep 17 00:00:00 2001 From: Grzegorz Date: Tue, 8 Sep 2026 09:09:38 +0200 Subject: [PATCH] MiEL HVAC: publish HVACSettings after an optimistic settings apply (#25017) Follow-up to #25004. Since that PR copies an outgoing 0x41 set-settings request into sc_settings immediately, the confirming 0x62 0x02 normally equals sc_settings, so the memcmp() in miel_hvac_input_settings() no longer fires and HVACSettings / SENSOR were not published after an HVACSet* command until the next TelePeriod (reported by @mamrai1). Publish HVACSettings + SENSOR right after the optimistic apply. If the unit rejects or modifies the request its 0x62 0x02 still differs from sc_settings and the existing comparison republishes the corrected state. --- .../tasmota_xdrv_driver/xdrv_44_miel_hvac.ino | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_44_miel_hvac.ino b/tasmota/tasmota_xdrv_driver/xdrv_44_miel_hvac.ino index 678f7ad04..cea0164f0 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_44_miel_hvac.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_44_miel_hvac.ino @@ -39,8 +39,8 @@ * * A control change is written to sc_settings straight away, before the unit confirms with * the next 0x62 0x02, so the panel, the Modbus registers and SENSOR show the intent - * instead of the stale pre-change state for ~1s; the unit's next report wins if it - * rejects the change. + * instead of the stale pre-change state for ~1s, and HVACSettings / SENSOR are published + * at that point; the unit's next report wins (and republishes) if it rejects the change. * * --- Modbus RTU slave (USE_MIEL_HVAC_MODBUS_SLAVE, ESP32) --------------------------------- * Optional second RS485 port that mirrors every driver state as read registers and maps @@ -4690,6 +4690,20 @@ miel_hvac_tick(struct miel_hvac_softc *sc) set->widevane = update->widevane; if (f & htons(MIEL_HVAC_SETTINGS_F_AIRDIRECTION)) set->airdirection = update->airdirection; + + /* + * Publish the new state now. The confirming 0x62 0x02 + * normally equals the optimistically applied sc_settings, + * so miel_hvac_input_settings()'s memcmp() would not fire + * and HVACSettings / SENSOR would not go out until the + * next TelePeriod. If the unit rejects or changes the + * request its report still differs and republishes. + */ + if (sc->sc_settings_set) + { + miel_hvac_publish_settings(sc); + MqttPublishSensor(); + } } miel_hvac_init_update_settings(update);