mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-12 06:44:04 +02:00
fix toggle bug
This commit is contained in:
parent
0c76334124
commit
5167dc6565
3 changed files with 8 additions and 3 deletions
|
|
@ -24,6 +24,7 @@
|
|||
"disable_brightness_adjust": "disable_brightness_adjust",
|
||||
"disable_color_temp_adjust": "disable_color_temp_adjust",
|
||||
"disable_entity": "disable_entity",
|
||||
"disable_rgb_color_adjust": "disable_rgb_color_adjust",
|
||||
"disable_state": "disable_state",
|
||||
"initial_transition": "initial_transition, the transition of the lights when turning them on or when 'disable_state' or 'sleep_state' change",
|
||||
"interval": "interval",
|
||||
|
|
@ -32,6 +33,7 @@
|
|||
"min_brightness": "min_brightness",
|
||||
"min_color_temp": "min_color_temp",
|
||||
"only_once": "only_once",
|
||||
"prefer_rgb_color": "prefer_rgb_color",
|
||||
"sleep_brightness": "sleep_brightness",
|
||||
"sleep_color_temp": "sleep_color_temp",
|
||||
"sleep_entity": "sleep_entity",
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity):
|
|||
)
|
||||
last_state = await self.async_get_last_state()
|
||||
if last_state and last_state.state == STATE_ON:
|
||||
await self.async_turn_on()
|
||||
await self.async_turn_on(adjust_lights=False)
|
||||
|
||||
def _unpack_light_groups(self) -> None:
|
||||
all_lights = []
|
||||
|
|
@ -325,12 +325,13 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity):
|
|||
return {key: None for key in attrs}
|
||||
return attrs
|
||||
|
||||
async def async_turn_on(self, **kwargs):
|
||||
async def async_turn_on(self, adjust_lights=True):
|
||||
"""Turn on adaptive lighting."""
|
||||
await self._update_lights(transition=self._initial_transition, force=True)
|
||||
self.unsub_tracker = async_track_time_interval(
|
||||
self.hass, self._async_update_at_interval, self._interval
|
||||
)
|
||||
if adjust_lights:
|
||||
await self._update_lights(transition=self._initial_transition, force=True)
|
||||
|
||||
async def async_turn_off(self, **kwargs):
|
||||
"""Turn off adaptive lighting."""
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
"disable_brightness_adjust": "disable_brightness_adjust",
|
||||
"disable_color_temp_adjust": "disable_color_temp_adjust",
|
||||
"disable_entity": "disable_entity",
|
||||
"disable_rgb_color_adjust": "disable_rgb_color_adjust",
|
||||
"disable_state": "disable_state",
|
||||
"initial_transition": "initial_transition, the transition of the lights when turning them on or when 'disable_state' or 'sleep_state' change",
|
||||
"interval": "interval",
|
||||
|
|
@ -32,6 +33,7 @@
|
|||
"min_brightness": "min_brightness",
|
||||
"min_color_temp": "min_color_temp",
|
||||
"only_once": "only_once",
|
||||
"prefer_rgb_color": "prefer_rgb_color",
|
||||
"sleep_brightness": "sleep_brightness",
|
||||
"sleep_color_temp": "sleep_color_temp",
|
||||
"sleep_entity": "sleep_entity",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue