From 7224ef306161ed4b03a48b84fe890524acc7f60d Mon Sep 17 00:00:00 2001 From: Rob Chandhok Date: Thu, 8 Feb 2024 14:58:39 -0800 Subject: [PATCH] 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: