v4.0.2: two-phase heavy probe, backup field, fix model name - #5
Merged
Merged
Conversation
hub.py: switch-back probe is now two-phase — account-level (async_list_devices) followed by device-level (async_get_properties on the first discovered device). Prevents the primary identity from being activated while device-level requests are still 403-throttled, which caused rapid flip-flop between primary and backup. config_flow.py: expose backup_username / backup_password in the initial async_step_user schema (previously only available in the reconfigure step). sensor.py: rename DeviceModelType friendly name from '设备型号' (incorrect — it's a feature-composition enum) to '机型功能配置' (accurate — describes which hardware features exist). Also bump manifest version to 4.0.2.
…F-8 BOM, orjson rejects)
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.
What
3 fixes discovered during HA live-testing of v4.0.1:
Two-phase heavy probe (
hub.py)Switch-back probe was a single lightweight
async_list_devices()call.GoodThing's 403 throttle can apply to device-level requests while
account-level reads still pass, so the primary would appear free at
probe time but 5 minutes later the coordinator's
async_get_propertieswould 403 again — flip-flop cycle every 24h. Now probe runs two rounds:
account-level then device-level (first discovered device). Both must
succeed before switching back; either 403 keeps the backup active.
Backup account field missing from initial config flow (
config_flow.py)async_step_user(first-time add) never showed backup_username /backup_password — only
async_step_reconfiguredid. The failover codewas complete and tested but unreachable unless users re-entered the
integration after adding it. Both fields are now
vol.Optionalin theinitial step schema.
Sensor friendly-name mislabel (
sensor.py)DeviceModelType(an enum 0-3 describing hardware feature set:lighting / disinfection / drying) was labelled "设备型号" (device
model string). Renamed to "机型功能配置" so the state "照明、消毒"
reads as "feature configuration" not "model number".
Why
still throttled on device-level traffic, causing backup/primary flips
every time a penalty window expires.
Tested
entity_registry, all 20 modules py_compile clean, config_flow shows
backup field, hub.py two-phase probe compiles.
Version
manifest bumped 4.0.1 -> 4.0.2.