mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Prevent turning on tellduslive lights with 0 brightness (#23135)
* Prevent turning on tellduslive lights with 0 brightness It was possible for the light compontent to get in a state where the last_brightness was set to zero, and when turning on (by calling turn_on) it would call the TellStick with 0 dim level, ergo not turning on the light. With this, it will fall back on a 75% dim level if the level is set to zero. * Wrap long log line over two lines And using a more proper way of formatting the message * Fallback to 100% instead of 75%
This commit is contained in:
parent
a7ef1eabb0
commit
21575938ef
@ -67,6 +67,11 @@ class TelldusLiveLight(TelldusLiveEntity, Light):
|
||||
def turn_on(self, **kwargs):
|
||||
"""Turn the light on."""
|
||||
brightness = kwargs.get(ATTR_BRIGHTNESS, self._last_brightness)
|
||||
if brightness == 0:
|
||||
fallback_brightness = 100
|
||||
_LOGGER.info("Setting brightness to %d%%, because it was 0",
|
||||
fallback_brightness)
|
||||
brightness = int(fallback_brightness*255/100)
|
||||
self.device.dim(level=brightness)
|
||||
self.changed()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user