Merge pull request #216 from firstof9/fix-hood-fan-write-fallback

fix(hood_fan): fall back to settable min/max when supportedFanSpeed is missing
This commit is contained in:
Marc Billow authored and GitHub committed 2026-07-30 20:21:02 -05:00
commit b8d04b4ae3
2 files changed
+19

No files matched your search

@@ -79,6 +79,15 @@ def _hood_fan_write(payload, rep, href=None):
str(code)
for code in rep.get('x.com.samsung.da.hood.supportedFanSpeed', ())
]
if not supported:
min_s = rep.get('x.com.samsung.da.hood.settableMinFanSpeed')
max_s = rep.get('x.com.samsung.da.hood.settableMaxFanSpeed')
if min_s is not None and max_s is not None:
try:
mn, mx = int(min_s), int(max_s)
supported = [str(i) for i in range(mn, mx + 1)]
except (ValueError, TypeError):
pass
if value not in supported:
return None
return ['hood', 'fanspeed', 'vs', '0'], {