From 305324ad2114620237e8727ebe10a80b57a5e46f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benedikt=20H=C3=BCbschen?= Date: Sun, 30 Jun 2024 20:03:13 +0200 Subject: [PATCH] default values --- custom_components/delayed_action/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/custom_components/delayed_action/__init__.py b/custom_components/delayed_action/__init__.py index 977ed3d..a4ebd69 100644 --- a/custom_components/delayed_action/__init__.py +++ b/custom_components/delayed_action/__init__.py @@ -39,7 +39,7 @@ { DOMAIN: vol.Schema( { - vol.Optional(CONF_DOMAINS, default=[]): vol.All(cv.ensure_list, [cv.string]), + vol.Optional(CONF_DOMAINS, default=["automation", "climate", "cover", "fan", "humidifier", "light", "lock", "media_player", "script", "switch", "vacuum", "water_heater"]): vol.All(cv.ensure_list, [cv.string]), } ) }, @@ -49,7 +49,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Delayed Action component.""" _LOGGER.info("Setting up Delayed Action component") - hass.data[DOMAIN] = {"tasks": {}, "domains": config.get(DOMAIN, {}).get(CONF_DOMAINS, [])} + hass.data[DOMAIN] = {"tasks": {}, "domains": config.get(DOMAIN, {}).get(CONF_DOMAINS, ["automation", "climate", "cover", "fan", "humidifier", "light", "lock", "media_player", "script", "switch", "vacuum", "water_heater"])} async def handle_event(event): hass.bus.fire(f"{DOMAIN}_get_config_response", event.data) @@ -62,7 +62,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: _LOGGER.info("Setting up Delayed Action from config entry") config = entry.options - hass.data[DOMAIN]["domains"] = config.get(CONF_DOMAINS, []) + hass.data[DOMAIN]["domains"] = config.get(CONF_DOMAINS, ["automation", "climate", "cover", "fan", "humidifier", "light", "lock", "media_player", "script", "switch", "vacuum", "water_heater"]) _LOGGER.info("Delayed Action component setup complete") @@ -207,7 +207,7 @@ def _serialize_actions(actions): def serialize_config(config): """Serialize the domains.""" serialized = {} - serialized[CONF_DOMAINS] = config.get(CONF_DOMAINS, []) + serialized[CONF_DOMAINS] = config.get(CONF_DOMAINS, ["automation", "climate", "cover", "fan", "humidifier", "light", "lock", "media_player", "script", "switch", "vacuum", "water_heater"]) return serialized hass.services.async_register(DOMAIN, SERVICE_DELAYED_ACTION, handle_delayed_action, schema=SERVICE_DELAY_SCHEMA)