fix: restore empty-stub carve-out on the new energy sensors; dedupe flex-zone set build

Review follow-up (Opus + /simplify) on the previous commit:

- power_energy_kwh/energy_saved_kwh/energy_last_month_kwh/
  energy_this_month_kwh used a plain `field in rep` exists_fn, unlike their
  siblings power_watts/energy_kwh in the same capability. Per
  entity._is_included, an explicit exists_fn bypasses the stub carve-out
  entirely -- an empty {} rep at platform setup (device/0 returned a
  not-yet-fetched stub) would permanently drop these entities for the
  session instead of picking them up once a sub-poll populates the
  resource. Restore the same `not rep or ...` guard used above.
- fridge._flex_zone_current/_flex_zone_write independently rebuilt the same
  supportedOptions set; factor into _flex_zone_supported.
- note in a comment that the flex-zone match assumes at most one
  modes/supportedOptions overlap (true on every dump seen); add the
  missing negative assertion that dry_level self-gates off on a plain
  washer (was only positively asserted on the combo fixture).
This commit is contained in:
Marc Billow committed 2026-07-22 06:11:16 +00:00
1 parent 9a899080fa
commit 43542b146f
3 files changed
+24 -8

No files matched your search

+2 -1
View File
@@ -271,7 +271,8 @@ class TestFlexWashAndComboFixturesHaveCompleteCoverage:
log=unbound.append,
)
assert unbound == []
flatten(bound, resources) # doesn't raise
state = flatten(bound, resources)
assert 'dry_level' not in state # plain washer -- no supportedDryLevel field
def test_dryer_combo(self):
from custom_components.localthings.registry.adapter import flatten