Simplify rflink dimmable set_level parsing (#147636)

This commit is contained in:
Ville Skyttä 2025-06-27 16:59:10 +00:00 committed by GitHub
parent b8500b338a
commit 0be0e22e76
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -221,8 +221,8 @@ class DimmableRflinkLight(SwitchableRflinkDevice, LightEntity):
elif command in ["off", "alloff"]:
self._state = False
# dimmable device accept 'set_level=(0-15)' commands
elif re.search("^set_level=(0?[0-9]|1[0-5])$", command, re.IGNORECASE):
self._brightness = rflink_to_brightness(int(command.split("=")[1]))
elif match := re.search("^set_level=(0?[0-9]|1[0-5])$", command, re.IGNORECASE):
self._brightness = rflink_to_brightness(int(match.group(1)))
self._state = True
@property