From 1d8456e896fc4b8c997d35e564d2b0fe6aba952f Mon Sep 17 00:00:00 2001 From: Tobias Thiemann Date: Thu, 9 Nov 2023 15:44:31 +0100 Subject: [PATCH 1/5] allow remaining entites to be checked --- custom_components/entity_controller/__init__.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/custom_components/entity_controller/__init__.py b/custom_components/entity_controller/__init__.py index 257938f..1c11ee1 100644 --- a/custom_components/entity_controller/__init__.py +++ b/custom_components/entity_controller/__init__.py @@ -767,7 +767,8 @@ def _override_entity_state(self): e, ex ) ) - return None + + continue if self.matches(state, self.OVERRIDE_ON_STATE): self.log.debug("Override entities are ON. [%s]", e) @@ -797,7 +798,8 @@ def _sensor_entity_state(self): e, ex ) ) - return None + + continue if self.matches(state, self.SENSOR_ON_STATE): self.log.debug("Sensor entities are ON. [%s]", e) @@ -823,8 +825,8 @@ def _state_entity_state(self): e, ex ) ) - state = 'off' - return None + + continue if self.matches(state, self.STATE_ON_STATE): self.log.debug("State entities are ON. [%s]", e) From 358552beb99c458be92158de8f8253c607745ac1 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Wed, 14 Feb 2024 20:09:07 +0800 Subject: [PATCH 2/5] docs: Update README.md --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index b3a84de..7420c71 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,6 @@ # :wave: Introduction Entity Controller (EC) is an implementation of "When This, Then That for x amount of time" using a finite state machine that ensures basic automations do not interfere with the rest of your home automation setup. This component encapsulates common automation scenarios into a neat package that can be configured easily and reused throughout your home. Traditional automations would need to be duplicated _for each instance_ in your config. The use cases for this component are endless because you can use any entity as input and outputs (there is no restriction to motion sensors and lights). -**Latest stable version is `v9.4.0` tested on Home Assistant `2022.7.4`.** - [Entity Controller Documentation](https://danobot.github.io/ec-docs/) ## Installation From e67d829f85486457b32ba882036a4e89adc83206 Mon Sep 17 00:00:00 2001 From: Tobias Thiemann Date: Thu, 9 Nov 2023 14:51:25 +0100 Subject: [PATCH 3/5] implement check for timezone mismatch --- custom_components/entity_controller/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/custom_components/entity_controller/__init__.py b/custom_components/entity_controller/__init__.py index 5788a36..f087f86 100644 --- a/custom_components/entity_controller/__init__.py +++ b/custom_components/entity_controller/__init__.py @@ -173,6 +173,11 @@ async def async_setup(hass, config): """Load graph configurations.""" + if(((datetime.now()).astimezone()).tzinfo != dt.as_local(dt.now()).tzinfo): + _LOGGER.error("Timezones do not Match") + _LOGGER.error("DateTime: %s", ((datetime.now()).astimezone()).tzinfo ) + _LOGGER.error("HA DT: %s", dt.as_local(dt.now()).tzinfo ) + component = EntityComponent(_LOGGER, DOMAIN, hass) _LOGGER.info( From 06e0ef641d44563a04db5912f7c32023bcf73d1e Mon Sep 17 00:00:00 2001 From: Tobias Thiemann Date: Thu, 9 Nov 2023 14:57:31 +0100 Subject: [PATCH 4/5] make messages more descriptive --- custom_components/entity_controller/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/custom_components/entity_controller/__init__.py b/custom_components/entity_controller/__init__.py index f087f86..dd3c65e 100644 --- a/custom_components/entity_controller/__init__.py +++ b/custom_components/entity_controller/__init__.py @@ -174,9 +174,9 @@ async def async_setup(hass, config): """Load graph configurations.""" if(((datetime.now()).astimezone()).tzinfo != dt.as_local(dt.now()).tzinfo): - _LOGGER.error("Timezones do not Match") - _LOGGER.error("DateTime: %s", ((datetime.now()).astimezone()).tzinfo ) - _LOGGER.error("HA DT: %s", dt.as_local(dt.now()).tzinfo ) + _LOGGER.error("Timezones do not Match. Mismatched timezones may cause unintended behaviours.") + _LOGGER.error("System DateTime: %s", ((datetime.now()).astimezone()).tzinfo ) + _LOGGER.error("Home Assistant DateTime: %s", dt.as_local(dt.now()).tzinfo ) component = EntityComponent(_LOGGER, DOMAIN, hass) From 5223bb100192525858a8d1a2891ea2a428a94ce0 Mon Sep 17 00:00:00 2001 From: Tobias Thiemann Date: Thu, 9 Nov 2023 18:49:06 +0100 Subject: [PATCH 5/5] fix dt.as_local timezone resolve --- custom_components/entity_controller/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/entity_controller/__init__.py b/custom_components/entity_controller/__init__.py index dd3c65e..37fc1c6 100644 --- a/custom_components/entity_controller/__init__.py +++ b/custom_components/entity_controller/__init__.py @@ -173,10 +173,10 @@ async def async_setup(hass, config): """Load graph configurations.""" - if(((datetime.now()).astimezone()).tzinfo != dt.as_local(dt.now()).tzinfo): + if(str(((datetime.now()).astimezone()).tzinfo) != str(dt.as_local(dt.now()).tzname())): _LOGGER.error("Timezones do not Match. Mismatched timezones may cause unintended behaviours.") _LOGGER.error("System DateTime: %s", ((datetime.now()).astimezone()).tzinfo ) - _LOGGER.error("Home Assistant DateTime: %s", dt.as_local(dt.now()).tzinfo ) + _LOGGER.error("Home Assistant DateTime: %s", dt.as_local(dt.now()).tzname()) component = EntityComponent(_LOGGER, DOMAIN, hass)