Skip to content

Commit

Permalink
Update __init__.py
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
robchandhok committed Feb 8, 2024
1 parent f267df8 commit 7224ef3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions custom_components/entity_controller/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 7224ef3

Please sign in to comment.