Skip to content

v4.0.2: two-phase heavy probe, backup field, fix model name - #5

Merged
C3H3-AI merged 3 commits into
mainfrom
fix/v4.0.2-stability
Sep 13, 2026
Merged

C3H3-AI merged 3 commits into
mainfrom
fix/v4.0.2-stability

Conversation

@C3H3-AI

@C3H3-AI C3H3-AI commented Sep 13, 2026

Copy link
Copy Markdown
Owner

What

3 fixes discovered during HA live-testing of v4.0.1:

  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_properties
    would 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.

  2. 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_reconfigure did. The failover code
    was complete and tested but unreachable unless users re-entered the
    integration after adding it. Both fields are now vol.Optional in the
    initial step schema.

  3. 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

Tested

  • HA live on duola-PC — sensor friendly-name update verified in
    entity_registry, all 20 modules py_compile clean, config_flow shows
    backup field, hub.py two-phase probe compiles.
  • Existing tests (if any) not yet run.

Version

manifest bumped 4.0.1 -> 4.0.2.

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.
@C3H3-AI
C3H3-AI merged commit 1a79eb6 into main Sep 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant