mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 10:47:10 +00:00
ZHA Light debug logging. (#22776)
This commit is contained in:
parent
f004f440d3
commit
a69b1a359d
@ -172,6 +172,7 @@ class Light(ZhaEntity, light.Light):
|
|||||||
duration = transition * 10 if transition else DEFAULT_DURATION
|
duration = transition * 10 if transition else DEFAULT_DURATION
|
||||||
brightness = kwargs.get(light.ATTR_BRIGHTNESS)
|
brightness = kwargs.get(light.ATTR_BRIGHTNESS)
|
||||||
|
|
||||||
|
t_log = {}
|
||||||
if (brightness is not None or transition) and \
|
if (brightness is not None or transition) and \
|
||||||
self._supported_features & light.SUPPORT_BRIGHTNESS:
|
self._supported_features & light.SUPPORT_BRIGHTNESS:
|
||||||
if brightness is not None:
|
if brightness is not None:
|
||||||
@ -182,7 +183,9 @@ class Light(ZhaEntity, light.Light):
|
|||||||
level,
|
level,
|
||||||
duration
|
duration
|
||||||
)
|
)
|
||||||
|
t_log['move_to_level_with_on_off'] = success
|
||||||
if not success:
|
if not success:
|
||||||
|
self.debug("turned on: %s", t_log)
|
||||||
return
|
return
|
||||||
self._state = bool(level)
|
self._state = bool(level)
|
||||||
if level:
|
if level:
|
||||||
@ -190,7 +193,9 @@ class Light(ZhaEntity, light.Light):
|
|||||||
|
|
||||||
if brightness is None or brightness:
|
if brightness is None or brightness:
|
||||||
success = await self._on_off_channel.on()
|
success = await self._on_off_channel.on()
|
||||||
|
t_log['on_off'] = success
|
||||||
if not success:
|
if not success:
|
||||||
|
self.debug("turned on: %s", t_log)
|
||||||
return
|
return
|
||||||
self._state = True
|
self._state = True
|
||||||
|
|
||||||
@ -199,7 +204,9 @@ class Light(ZhaEntity, light.Light):
|
|||||||
temperature = kwargs[light.ATTR_COLOR_TEMP]
|
temperature = kwargs[light.ATTR_COLOR_TEMP]
|
||||||
success = await self._color_channel.move_to_color_temp(
|
success = await self._color_channel.move_to_color_temp(
|
||||||
temperature, duration)
|
temperature, duration)
|
||||||
|
t_log['move_to_color_temp'] = success
|
||||||
if not success:
|
if not success:
|
||||||
|
self.debug("turned on: %s", t_log)
|
||||||
return
|
return
|
||||||
self._color_temp = temperature
|
self._color_temp = temperature
|
||||||
|
|
||||||
@ -212,10 +219,13 @@ class Light(ZhaEntity, light.Light):
|
|||||||
int(xy_color[1] * 65535),
|
int(xy_color[1] * 65535),
|
||||||
duration,
|
duration,
|
||||||
)
|
)
|
||||||
|
t_log['move_to_color'] = success
|
||||||
if not success:
|
if not success:
|
||||||
|
self.debug("turned on: %s", t_log)
|
||||||
return
|
return
|
||||||
self._hs_color = hs_color
|
self._hs_color = hs_color
|
||||||
|
|
||||||
|
self.debug("turned on: %s", t_log)
|
||||||
self.async_schedule_update_ha_state()
|
self.async_schedule_update_ha_state()
|
||||||
|
|
||||||
async def async_turn_off(self, **kwargs):
|
async def async_turn_off(self, **kwargs):
|
||||||
@ -229,7 +239,7 @@ class Light(ZhaEntity, light.Light):
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
success = await self._on_off_channel.off()
|
success = await self._on_off_channel.off()
|
||||||
_LOGGER.debug("%s was turned off: %s", self.entity_id, success)
|
self.debug("turned off: %s", success)
|
||||||
if not success:
|
if not success:
|
||||||
return
|
return
|
||||||
self._state = False
|
self._state = False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user