Improve error handling for Entity Parsing

This commit is contained in:
Johannes
2022-04-03 22:04:01 +02:00
committed by GitHub
parent 6e6d72577a
commit b85cdff932

View File

@@ -6,6 +6,9 @@ HA_API = None
class Entity(object): class Entity(object):
def __init__(self, entity_input_config): def __init__(self, entity_input_config):
if type(entity_input_config) is not dict:
LOGGER.error("Config error, not a dict check your entity configs")
else:
self.entityId = entity_input_config.get("entity", "unknown") self.entityId = entity_input_config.get("entity", "unknown")
self.nameOverride = entity_input_config.get("name") self.nameOverride = entity_input_config.get("name")
self.iconOverride = entity_input_config.get("icon") self.iconOverride = entity_input_config.get("icon")