From ef75fc38e8236822875c7ebd6826fcda5a84378c Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Sat, 13 Jan 2024 14:11:16 +0800 Subject: [PATCH 1/3] Update info.md --- info.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/info.md b/info.md index 2f185c3..daa43f6 100644 --- a/info.md +++ b/info.md @@ -5,9 +5,11 @@ Entity Controller (EC) is an implementation of "When This, Then That" 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). +#**Full Documentation:** [Documentation](https://github.com/danobot/entity-controller) ## :clapper: Video Demo I created the following video to give a high-level overview of all EC features, how they work and how you can configure them for your use cases. +[Link](https://youtu.be/HJQrA6sFlPs) [![Video](images/video_thumbnail.png)](https://youtu.be/HJQrA6sFlPs) @@ -21,10 +23,12 @@ entity_controller: entity: light.table_lamp # required, [entity,entities] delay: 300 # optional, overwrites default delay of 180s ``` + ## Support Maintaining and improving this integration is very time consuming because of the sheer number of supported use cases. If you use this component in your home please consider donating or checking the issue tracker to help with the implementation of new features. [Buy me a coffee](https://gofund.me/7a2487d5) -## Full Documentation -[Documentation](https://github.com/danobot/entity-controller) +There are other ways to support development as well: [Ways to support EC](https://danielbkr.net/ways-to-support/) + + From 7224ef306161ed4b03a48b84fe890524acc7f60d Mon Sep 17 00:00:00 2001 From: Rob Chandhok Date: Thu, 8 Feb 2024 14:58:39 -0800 Subject: [PATCH 2/3] Update __init__.py Fixes issue introduced in HA 2024.2.0 release where test against YamlObjects types no longer work, which resulted in no configurations loading. Fix was using isinstance() instead. --- custom_components/entity_controller/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/custom_components/entity_controller/__init__.py b/custom_components/entity_controller/__init__.py index 5c901ff..5313ff0 100644 --- a/custom_components/entity_controller/__init__.py +++ b/custom_components/entity_controller/__init__.py @@ -28,7 +28,7 @@ from datetime import date, datetime, time, timedelta from threading import Timer import pprint -from typing import Optional +from typing import Optional, List import homeassistant.helpers.config_validation as cv import voluptuous as vol @@ -1650,12 +1650,12 @@ def add(self, list, config, key=None): else: v = config - if type(v) is YamlObjects.NodeStrClass: - self.log.debug("Found string value %s for key %s, now adding to exiting list %s. (Type: %s)", v, key, list, type(v)) + if isinstance(v,str): + self.log.debug("Found string value %s for key %s, now adding to existing list %s. (Type: %s)", v, key, list, type(v)) list.append(v) return len(v) > 0 - elif type(v) is YamlObjects.NodeListClass: - self.log.debug("Found list value %s for key %s, now adding to exiting list %s. (Type: %s)", v, key, list, type(v)) + elif isinstance(v, List): + self.log.debug("Found list value %s for key %s, now adding to existing list %s. (Type: %s)", v, key, list, type(v)) list.extend(v) return len(v) > 0 elif v == None: From f32cab8fb3b1125708d4d0ac39f4b15f9d1df483 Mon Sep 17 00:00:00 2001 From: Rob Chandhok Date: Thu, 8 Feb 2024 15:36:35 -0800 Subject: [PATCH 3/3] Update __init__.py Minor syntax fix to regular expressions, to stop warnings that started appearing in 2024.2.0 HA release. --- custom_components/entity_controller/__init__.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/custom_components/entity_controller/__init__.py b/custom_components/entity_controller/__init__.py index 5313ff0..42f68cf 100644 --- a/custom_components/entity_controller/__init__.py +++ b/custom_components/entity_controller/__init__.py @@ -1117,10 +1117,10 @@ def config_times(self, config): # parsed_start = datetime.now() + timedelta(seconds=5) # parsed_end = datetime.now() + timedelta(seconds=10) # FOR OPTIONAL DEBUGGING: subsequently use normal delay - sparts = re.search("^(now\s*[+-]\s*\d+)", config.get(CONF_START_TIME)) + sparts = re.search(r"^(now\s*[+-]\s*\d+)", config.get(CONF_START_TIME)) if sparts is not None: self._start_time_private = sparts.group(1) - eparts = re.search("^(now\s*[+-]\s*\d+)", config.get(CONF_END_TIME)) + eparts = re.search(r"^(now\s*[+-]\s*\d+)", config.get(CONF_END_TIME)) if eparts is not None: self._end_time_private = eparts.group(1) @@ -1364,7 +1364,7 @@ def _parse_time(self, time_str, name=None): parsed_time = None sun = None offset = 0 - parts = re.search("^(\d+)-(\d+)-(\d+)\s+(\d+):(\d+):(\d+)$", str(time_str)) + parts = re.search(r"^(\d+)-(\d+)-(\d+)\s+(\d+):(\d+):(\d+)$", str(time_str)) if parts: this_time = datetime( int(parts.group(1)), @@ -1377,7 +1377,7 @@ def _parse_time(self, time_str, name=None): ) parsed_time = dt.as_local(this_time) else: - parts = re.search("^(\d+):(\d+):(\d+)$", str(time_str)) + parts = re.search(r"^(\d+):(\d+):(\d+)$", str(time_str)) if parts: today = dt.as_local(dt.now()) time_temp = time( @@ -1401,7 +1401,7 @@ def _parse_time(self, time_str, name=None): offset = 0 else: parts = re.search( - "^sunrise\s*([+-])\s*(\d+):(\d+):(\d+)$", str(time_str) + r"^sunrise\s*([+-])\s*(\d+):(\d+):(\d+)$", str(time_str) ) if parts: @@ -1424,7 +1424,7 @@ def _parse_time(self, time_str, name=None): parsed_time = self.sunrise(True) - td else: parts = re.search( - "^sunset\s*([+-])\s*(\d+):(\d+):(\d+)$", str(time_str) + r"^sunset\s*([+-])\s*(\d+):(\d+):(\d+)$", str(time_str) ) if parts: sun = "sunset" @@ -1714,7 +1714,7 @@ def debug_time_wrapper(self, timet): See config_times. """ s = timet - parts = re.search("^now\s*([+-])\s*(\d+)\s*\(?(\d+)?\)?$", timet) + parts = re.search(r"^now\s*([+-])\s*(\d+)\s*\(?(\d+)?\)?$", timet) if parts: sign = parts.group(1) first_delay = parts.group(3)