diff --git a/custom_components/auto_off_timer/__init__.py b/custom_components/auto_off_timer/__init__.py index 8407744..65d1240 100644 --- a/custom_components/auto_off_timer/__init__.py +++ b/custom_components/auto_off_timer/__init__.py @@ -208,17 +208,11 @@ def _state_change_handler(self, event) -> None: ) if new_state.state == STATE_ON: - if old_state.state == STATE_UNAVAILABLE: - _LOGGER.warning( - "Entity %s turned ON, but last state was UNAVAILABLE, ignoring", - entity_id, - ) - return - elif not self._should_enable_for_entity(entity_id): + if not self._should_enable_for_entity(entity_id): _LOGGER.info("Entity %s turned ON, but condition not met", entity_id) return self._schedule_timeout(entity_id) - elif new_state.state == STATE_OFF: + elif new_state.state == STATE_OFF or new_state.state == STATE_UNAVAILABLE: self._cancel_timeout(entity_id)