From d4d56d283a29e8f531a685254a1d7e21d819bc1e Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Thu, 10 Dec 2020 17:13:19 +0800 Subject: [PATCH 1/6] Update hacs.json --- hacs.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hacs.json b/hacs.json index 0136a23..b4c58b2 100644 --- a/hacs.json +++ b/hacs.json @@ -1,4 +1,4 @@ { "name": "Entity Controller", - "homeassistant": "0.90.1" + "homeassistant": "0.117.0" } From 038771465d4d483bea52ab5c8d2af356e2d25985 Mon Sep 17 00:00:00 2001 From: floris-b Date: Fri, 1 Jan 2021 18:36:06 +0100 Subject: [PATCH 2/6] initial --- custom_components/entity_controller/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/custom_components/entity_controller/__init__.py b/custom_components/entity_controller/__init__.py index c7e164b..5093831 100644 --- a/custom_components/entity_controller/__init__.py +++ b/custom_components/entity_controller/__init__.py @@ -547,6 +547,14 @@ def sensor_state_change(self, entity, old, new): self.log.debug("sensor_state_change :: %10s Sensor state change to: %s" % ( pprint.pformat(entity), new.state)) self.log.debug("sensor_state_change :: state: " + pprint.pformat(self.state)) + try: + if new.state == old.state: + self.log.debug("sensor_state_change :: Ignore attribute only change") + return + except Exception as e: + self.log.debug("sensor_state_change :: old or new state: %s" , e) + return + if self.matches(new.state, self.SENSOR_ON_STATE) and ( self.is_idle() or self.is_active_timer() or self.is_blocked() ): From 9f20fb523d1021b209864094aa0b18f7df5e10c0 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Mon, 4 Jan 2021 22:03:53 +0800 Subject: [PATCH 3/6] fix: error messages used wrong variable --- .../entity_controller/__init__.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/custom_components/entity_controller/__init__.py b/custom_components/entity_controller/__init__.py index c7e164b..0877a50 100644 --- a/custom_components/entity_controller/__init__.py +++ b/custom_components/entity_controller/__init__.py @@ -372,7 +372,7 @@ def __init__(self, hass, config, machine): self.model = Model(hass, config, machine, self) except AttributeError as e: _LOGGER.error( - "Configuration error! Please ensure you use plural keys for lists. e.g. sensors, entities" + e + "Configuration error! Please ensure you use plural keys for lists. e.g. sensors, entities." + e ) event.async_call_later(hass, 1, self.do_update) @@ -706,10 +706,10 @@ def _override_entity_state(self): s = self.hass.states.get(e) try: state = s.state - except AttributeError as e: + except AttributeError as ex: self.log.error( - "Configuration error! Override Entity ({}) does not exist. Please check for spelling and typos.".format( - e + "Configuration error! Override Entity ({}) does not exist. Please check for spelling and typos. {}".format( + e, ex ) ) return None @@ -736,10 +736,10 @@ def _sensor_entity_state(self): s = self.hass.states.get(e) try: state = s.state - except AttributeError as e: + except AttributeError as ex: self.log.error( - "Configuration error! Sensor Entity ({}) does not exist. Please check for spelling and typos.".format( - e + "Configuration error! Sensor Entity ({}) does not exist. Please check for spelling and typos. {}".format( + e, ex ) ) return None @@ -762,10 +762,10 @@ def _state_entity_state(self): self.log.info(s) try: state = s.state - except AttributeError as e: + except AttributeError as ex: self.log.error( - "Configuration error! State Entity ({}) does not exist. Please check for spelling and typos.".format( - e + "Configuration error! State Entity ({}) does not exist. Please check for spelling and typos. {}".format( + e, ex ) ) state = 'off' From 7545d2e78047c29039c31fd635517573a4a7465d Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Mon, 4 Jan 2021 23:05:05 +0800 Subject: [PATCH 4/6] fix: warn about potential configuration errors (could also mean entity is still initialising after reboot) --- custom_components/entity_controller/__init__.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/custom_components/entity_controller/__init__.py b/custom_components/entity_controller/__init__.py index 0877a50..ac32ac9 100644 --- a/custom_components/entity_controller/__init__.py +++ b/custom_components/entity_controller/__init__.py @@ -207,6 +207,7 @@ async def async_setup(hass, config): dest="blocked", conditions=["is_state_entities_on"], ) + machine.add_transition(trigger="enable", source="idle", dest=None, conditions=["is_state_entities_off"]) # Blocked machine.add_transition(trigger="enable", source="blocked", dest="idle", conditions=["is_state_entities_off"]) @@ -708,7 +709,7 @@ def _override_entity_state(self): state = s.state except AttributeError as ex: self.log.error( - "Configuration error! Override Entity ({}) does not exist. Please check for spelling and typos. {}".format( + "Potential configuration error: Override Entity ({}) does not exist (yet). Please check for spelling and typos. {}".format( e, ex ) ) @@ -738,7 +739,7 @@ def _sensor_entity_state(self): state = s.state except AttributeError as ex: self.log.error( - "Configuration error! Sensor Entity ({}) does not exist. Please check for spelling and typos. {}".format( + "Potential configuration error: Sensor Entity ({}) does not exist (yet). Please check for spelling and typos. {}".format( e, ex ) ) @@ -764,7 +765,7 @@ def _state_entity_state(self): state = s.state except AttributeError as ex: self.log.error( - "Configuration error! State Entity ({}) does not exist. Please check for spelling and typos. {}".format( + "Potential configuration error: State Entity ({}) does not exist (yet). Please check for spelling and typos. {}".format( e, ex ) ) @@ -1182,7 +1183,7 @@ def start_time_callback(self, evt): ) self.update(start_time=parsed_start) - + if self.is_state_entities_on(): self.blocked() else: From 38cd7fe510290ab503aefc87c1fbfd87c5757f2e Mon Sep 17 00:00:00 2001 From: floris-b Date: Mon, 4 Jan 2021 18:27:56 +0100 Subject: [PATCH 5/6] don't ignore if old is None --- 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 5093831..d9cf89f 100644 --- a/custom_components/entity_controller/__init__.py +++ b/custom_components/entity_controller/__init__.py @@ -551,9 +551,9 @@ def sensor_state_change(self, entity, old, new): if new.state == old.state: self.log.debug("sensor_state_change :: Ignore attribute only change") return - except Exception as e: - self.log.debug("sensor_state_change :: old or new state: %s" , e) - return + except AttributeError: + self.log.debug("sensor_state_change :: old NoneType") + pass if self.matches(new.state, self.SENSOR_ON_STATE) and ( self.is_idle() or self.is_active_timer() or self.is_blocked() From 4a7b735e16f741b6bb089895bfa2263bd922c24f Mon Sep 17 00:00:00 2001 From: Darrell Date: Wed, 3 Feb 2021 20:44:12 -0500 Subject: [PATCH 6/6] Typo in name in hacs --- custom_components/entity_controller/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/entity_controller/manifest.json b/custom_components/entity_controller/manifest.json index 2cf1b35..079609b 100644 --- a/custom_components/entity_controller/manifest.json +++ b/custom_components/entity_controller/manifest.json @@ -1,6 +1,6 @@ { "domain": "entity_controller", - "name": "Entity Contoller", + "name": "Entity Controller", "documentation": "https://github.com/danobot/entity-controller/blob/master/README.md", "requirements": [ "transitions==0.6.9"