diff --git a/custom_components/adaptive_lighting/config_flow.py b/custom_components/adaptive_lighting/config_flow.py index 8b4e8936..a0c746a0 100644 --- a/custom_components/adaptive_lighting/config_flow.py +++ b/custom_components/adaptive_lighting/config_flow.py @@ -92,7 +92,6 @@ class OptionsFlowHandler(config_entries.OptionsFlow): return self.async_create_entry(title="", data=user_input) all_lights = sorted(self.hass.states.async_entity_ids("light")) - # TODO: only use statefull entities all_entities = sorted(self.hass.states.async_entity_ids()) to_replace = { CONF_LIGHTS: cv.multi_select(all_lights), diff --git a/custom_components/adaptive_lighting/strings.json b/custom_components/adaptive_lighting/strings.json index df2149be..0c08519e 100644 --- a/custom_components/adaptive_lighting/strings.json +++ b/custom_components/adaptive_lighting/strings.json @@ -22,10 +22,10 @@ "data": { "lights": "lights", "adapt_brightness": "adapt_brightness", - "adapt_color_temp": "adapt_color_temp", - "adapt_rgb_color": "adapt_rgb_color", - "disable_entity": "disable_entity", - "disable_state": "disable_state", + "adapt_color_temp": "adapt_color_temp, adapt color temperature using 'color_temp' if supported", + "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", "interval": "interval, time between switch updates in seconds", "max_brightness": "max_brightness, in %", @@ -36,8 +36,8 @@ "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", - "sleep_state": "sleep_state", + "sleep_entity": "sleep_entity, entity_id turns the switch into 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", "sunset_offset": "sunset_offset, in +/- seconds", diff --git a/custom_components/adaptive_lighting/switch.py b/custom_components/adaptive_lighting/switch.py index e76a92e8..640809cc 100755 --- a/custom_components/adaptive_lighting/switch.py +++ b/custom_components/adaptive_lighting/switch.py @@ -625,7 +625,7 @@ class TurnOnOffListener: self.turn_off_event: Dict[str, Tuple[str, float]] = {} # Tracks 'light.turn_on' service calls self.turn_on_event: Dict[str, Tuple[str]] = {} - + # Keeps 'asyncio.sleep` tasks that can be cancelled by 'light.turn_on' events self.sleep_tasks: Dict[str, asyncio.Task] = {} self.remove_listener = self.hass.bus.async_listen( @@ -709,6 +709,11 @@ class TurnOnOffListener: # transitioning into 'off'. Maybe needs some discussion/input? return True + # Now we assume that the lights are still on and they were intended + # to be on. In case this still gives problems for some, we might + # choose to **only** adapt on 'light.turn_on' events and ignore + # other 'off' → 'on' state switches resulting from polling. That + # would mean we 'return True' here. return False async def turn_on_off_event_listener(self, event): diff --git a/custom_components/adaptive_lighting/translations/en.json b/custom_components/adaptive_lighting/translations/en.json index df2149be..0c08519e 100644 --- a/custom_components/adaptive_lighting/translations/en.json +++ b/custom_components/adaptive_lighting/translations/en.json @@ -22,10 +22,10 @@ "data": { "lights": "lights", "adapt_brightness": "adapt_brightness", - "adapt_color_temp": "adapt_color_temp", - "adapt_rgb_color": "adapt_rgb_color", - "disable_entity": "disable_entity", - "disable_state": "disable_state", + "adapt_color_temp": "adapt_color_temp, adapt color temperature using 'color_temp' if supported", + "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", "interval": "interval, time between switch updates in seconds", "max_brightness": "max_brightness, in %", @@ -36,8 +36,8 @@ "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", - "sleep_state": "sleep_state", + "sleep_entity": "sleep_entity, entity_id turns the switch into 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", "sunset_offset": "sunset_offset, in +/- seconds",