diff --git a/custom_components/adaptive_lighting/__init__.py b/custom_components/adaptive_lighting/__init__.py index e1ad4718..c4a91076 100755 --- a/custom_components/adaptive_lighting/__init__.py +++ b/custom_components/adaptive_lighting/__init__.py @@ -50,7 +50,6 @@ def _all_unique_profiles(value): _DOMAIN_SCHEMA = get_domain_schema(yaml=True) -_LOGGER.error(_DOMAIN_SCHEMA) CONFIG_SCHEMA = vol.Schema( { DOMAIN: vol.All( diff --git a/custom_components/adaptive_lighting/config_flow.py b/custom_components/adaptive_lighting/config_flow.py index a59d00ec..397a3975 100644 --- a/custom_components/adaptive_lighting/config_flow.py +++ b/custom_components/adaptive_lighting/config_flow.py @@ -44,7 +44,6 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): _DOMAIN_SCHEMA = get_domain_schema(yaml=False) schema = {k: v for k, v in _DOMAIN_SCHEMA.items() if k in user_input} vol.Schema(schema)(user_input) - _LOGGER.error(str(user_input) + str(schema)) return self.async_create_entry(title=user_input["name"], data=user_input) @staticmethod diff --git a/custom_components/adaptive_lighting/switch.py b/custom_components/adaptive_lighting/switch.py index 0f599f41..7c1c2f3a 100755 --- a/custom_components/adaptive_lighting/switch.py +++ b/custom_components/adaptive_lighting/switch.py @@ -3,6 +3,7 @@ import asyncio import bisect import logging +from copy import deepcopy from datetime import timedelta import homeassistant.util.dt as dt_util @@ -113,14 +114,15 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity): def __init__(self, hass, name, config_entry): """Initialize the Adaptive Lighting switch.""" - _LOGGER.error(f"title={config_entry.title}") self.hass = hass self._name = name self._entity_id = f"switch.{DOMAIN}_{slugify(name)}" self._icon = ICON defaults = {key: default for key, default, _ in VALIDATION_TUPLES} - data = dict(defaults, **config_entry.options, **config_entry.data) + data = deepcopy(defaults) + data.update(config_entry.options) # come from options flow + data.update(config_entry.data) # all yaml settings come from data data = {key: replace_none(value) for key, value in data.items()} for key, (validate, coerce) in EXTRA_VALIDATION.items(): # Fix the types of the inputs @@ -161,7 +163,9 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity): # Set and unset tracker in async_turn_on and async_turn_off self.unsub_tracker = None _LOGGER.error( - f"Setting up with {self._lights}: config_entry.data: {config_entry.data}, config_entry.options: {config_entry.options}, converted to {data}" + f"Setting up with '{self._lights}'," + f" config_entry.data: '{config_entry.data}'," + f" config_entry.options: '{config_entry.options}', converted to '{data}'." ) @property