fix: thermostat power state and target temperature not synced from cloud for tofan-wk01 models#1742
Open
xianyu122 wants to merge 1 commit into
Open
fix: thermostat power state and target temperature not synced from cloud for tofan-wk01 models#1742xianyu122 wants to merge 1 commit into
xianyu122 wants to merge 1 commit into
Conversation
…oud for tofan-wk01 models Add two fallback mechanisms to Thermostat class to handle thermostat models (e.g. tofan-wk01) where the MIoT 'on' property is not pushed by the Xiaomi Home cloud: 1. Parse ac-state composite field to extract power status (P: 0=on, 1=off), target temperature (T) and fan level (F) 2. Subscribe to mode changes as a fallback — when mode changes but _prop_on wasn't updated, infer the device is ON Also adds hvac_action property to correctly report COOLING/HEATING/FAN/DRY state based on the current mode. Fixes: Thermostat climate entity hvac_mode stuck at 'off' and target_temperature not updating when changed from Mi Home app.
xianyu122
force-pushed
the
fix/thermostat-sync-tofan-wk01
branch
from
June 26, 2026 09:41
be82c77 to
ad5628d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
For thermostat devices (e.g. tofan-wk01 models) connected via
xiaomi_homecloud integration:offRoot Cause
The
Thermostatclass relies solely on the MIoTonproperty (thermostatservice →Switch Status, bool format) to determinehvac_mode. However, the Xiaomi Home cloud does not pushonproperty changes for this thermostat model — the power state is likely encoded in other fields.Fix
Two fallback mechanisms added to
Thermostatclass:1. ac-state composite field parsing
Some thermostat models push an
ac-stateproperty as a string encoding multiple state fields (e.g.P0_T25_F1). Added parsing logic to extract:P: Power status (0=on, 1=off) → updates_prop_onT: Target temperature → updates_prop_target_tempF: Fan level → updates_prop_fan_level2. Mode change fallback
When
modeproperty changes but_prop_onwas not updated, infer that the device is ON. This covers cases where the cloud only sends mode but not power status.3. hvac_action property
Added to correctly report COOLING/HEATING/FAN/DRY/OFF state based on current mode.
Testing
Tested on tofan-wk01 thermostat (midea-based) with HA 2026.5.0. After patch:
See related: HA configuration using
ctrl_mode: autowith Xiaomi Home cloud.