diff --git a/custom_components/adaptive_lighting/strings.json b/custom_components/adaptive_lighting/strings.json index d63dae61..45a0396a 100644 --- a/custom_components/adaptive_lighting/strings.json +++ b/custom_components/adaptive_lighting/strings.json @@ -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", diff --git a/custom_components/adaptive_lighting/switch.py b/custom_components/adaptive_lighting/switch.py index e1854275..143911ce 100755 --- a/custom_components/adaptive_lighting/switch.py +++ b/custom_components/adaptive_lighting/switch.py @@ -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.""" diff --git a/custom_components/adaptive_lighting/translations/en.json b/custom_components/adaptive_lighting/translations/en.json index d63dae61..45a0396a 100644 --- a/custom_components/adaptive_lighting/translations/en.json +++ b/custom_components/adaptive_lighting/translations/en.json @@ -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",