This commit is contained in:
Bas Nijholt 2020-09-30 12:54:02 +02:00
commit d57ef3f2e4
3 changed files with 6 additions and 5 deletions

View file

@ -26,7 +26,7 @@
"adapt_rgb_color": "adapt_rgb_color, adapt color temperature using RGB/XY if supported",
"disable_entity": "disable_entity, entity_id that stops the switch from adapting lights",
"disable_state": "disable_state, state(s) of 'disable_entity', e.g., 'off' or 'total,half'",
"initial_transition": "initial_transition, the transition of the lights when turning them on or when 'disable_state' or 'sleep_state' change",
"initial_transition": "initial_transition, when lights go 'off' → 'on' or when 'disable_state'/'sleep_state' changes",
"interval": "interval, time between switch updates in seconds",
"max_brightness": "max_brightness, in %",
"max_color_temp": "max_color_temp, in Kelvin",
@ -36,7 +36,7 @@
"prefer_rgb_color": "prefer_rgb_color, use 'rgb_color' over 'color_temp' when possible",
"sleep_brightness": "sleep_brightness, in %",
"sleep_color_temp": "sleep_color_temp, in Kelvin",
"sleep_entity": "sleep_entity, entity_id turns the switch into sleep mode",
"sleep_entity": "sleep_entity, 'entity_id' that manages the switch's sleep mode",
"sleep_state": "sleep_state, state(s) of 'sleep_entity', e.g., 'off' or 'total,half'",
"sunrise_offset": "sunrise_offset, in +/- seconds",
"sunrise_time": "sunrise_time, in 'HH:MM:SS' format",

View file

@ -290,7 +290,8 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity):
EVENT_HOMEASSISTANT_START, self._setup_listeners
)
last_state = await self.async_get_last_state()
if last_state and last_state.state == STATE_ON:
is_new_entry = last_state is None # newly added to HA
if is_new_entry or last_state.state == STATE_ON:
await self.async_turn_on(adapt_lights=not self._only_once)
else:
self._state = False

View file

@ -26,7 +26,7 @@
"adapt_rgb_color": "adapt_rgb_color, adapt color temperature using RGB/XY if supported",
"disable_entity": "disable_entity, entity_id that stops the switch from adapting lights",
"disable_state": "disable_state, state(s) of 'disable_entity', e.g., 'off' or 'total,half'",
"initial_transition": "initial_transition, the transition of the lights when turning them on or when 'disable_state' or 'sleep_state' change",
"initial_transition": "initial_transition, when lights go 'off' → 'on' or when 'disable_state'/'sleep_state' changes",
"interval": "interval, time between switch updates in seconds",
"max_brightness": "max_brightness, in %",
"max_color_temp": "max_color_temp, in Kelvin",
@ -36,7 +36,7 @@
"prefer_rgb_color": "prefer_rgb_color, use 'rgb_color' over 'color_temp' when possible",
"sleep_brightness": "sleep_brightness, in %",
"sleep_color_temp": "sleep_color_temp, in Kelvin",
"sleep_entity": "sleep_entity, entity_id turns the switch into sleep mode",
"sleep_entity": "sleep_entity, 'entity_id' that manages the switch's sleep mode",
"sleep_state": "sleep_state, state(s) of 'sleep_entity', e.g., 'off' or 'total,half'",
"sunrise_offset": "sunrise_offset, in +/- seconds",
"sunrise_time": "sunrise_time, in 'HH:MM:SS' format",