wemo light brightness fixes (#53740)

This commit is contained in:
Eric Severance 2021-07-29 22:08:13 -07:00 committed by GitHub
parent 2b2cddb5f0
commit 7ae158f9a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -229,14 +229,13 @@ class WemoDimmer(WemoSubscriptionEntity, LightEntity):
if ATTR_BRIGHTNESS in kwargs:
brightness = kwargs[ATTR_BRIGHTNESS]
brightness = int((brightness / 255) * 100)
else:
brightness = 255
with self._wemo_exception_handler("turn on"):
if self.wemo.on():
with self._wemo_exception_handler("set brightness"):
self.wemo.set_brightness(brightness)
self._state = WEMO_ON
else:
with self._wemo_exception_handler("turn on"):
self.wemo.on()
self._state = WEMO_ON
self.wemo.set_brightness(brightness)
self.schedule_update_ha_state()