Remember modes a device reports but never advertises (issue #327)
Some firmware reports a current mode that is missing from the same resource's supportedModes. An ARTIK051 air conditioner sits in Quiet while advertising only [Off, Sleep, Speed, Nano, NanoSleep], so HA showed preset_mode: quiet and then refused to select it. A second reporter has three identical units where only the two sharing an outdoor unit hide it, which rules out a real capability difference. learned.py remembers any such code and the coordinator persists it on the config entry, so a mode the device only names while it is active survives a restart. climate._supported unions it into the resource's own list, which fixes the read and the write together -- async_set_preset_mode reverse-resolves the device code from that same list. Learning is allowlisted per canonical href rather than global. Across the fixture corpus 17 dumps already report a current mode that is not in supportedModes: an oven idling in NoOperation, a fridge's /mode/vs/0 carrying capability tokens like WATERFILTER_DISABLE. Those are not selectable options, and remembering one permanently would put an option in the UI that the device can only reject. Only /mode/convenient/vs/0 is learnable today. On by default, with a per-device option that stops offering and learning at once, and a reset step in the options flow for a code that turns out to be bogus. Diagnostics report what was learned separately from `resources`, which stays exactly what the device said.
This commit is contained in:
@@ -95,6 +95,9 @@ Each device has its own **Configure** option in Settings > Devices & Services, u
|
||||
|
||||
- **Allow writes even when remote control is reported off** — by default, LocalThings blocks every write with a clear error whenever a device reports remote control off, rather than letting the device silently reject it. Some devices accept certain writes anyway (e.g. default detergent/softener dosing on a washer) even while reporting remote control off. Only enable this if you've confirmed writes actually work on your device with remote control off — otherwise you trade a clear error for a silent failure.
|
||||
- **Estimated finish -- minimum change (minutes)** — a washer/dryer/dishwasher's `finish_time` sensor is recomputed from the device's own remaining-time estimate on every poll, which commonly drifts or gets revised by a minute or two between updates. This setting holds `finish_time` at its last reported value until a new estimate differs by at least this many minutes, cutting down on Home Assistant history/logbook noise from a value that hasn't meaningfully changed. Defaults to `3`; set it to `0` to report every computed change.
|
||||
- **Remember modes the device reports but doesn't advertise** — some firmware reports a current mode it never lists as supported. Issue #327's air conditioner sits in `Quiet` while offering only `Off/Sleep/Speed/Nano/NanoSleep`, so Home Assistant showed the preset as active but refused to select it. LocalThings remembers any such mode it sees and keeps offering it afterwards, stored on the config entry so it survives a restart — the device only names the mode while it is in it, and you shouldn't have to reach for the physical remote after every reboot. Defaults to on. Turning it off offers only what the device advertises, without discarding what was already learned.
|
||||
|
||||
The same **Configure** menu has a **Forget remembered modes** step, which clears what has been learned for that device. Use it if a mode was learned that turns out not to be selectable — otherwise, by design, it stays forever.
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user