implemented scripts to button entity

This commit is contained in:
Tomaae 2022-01-08 21:05:50 +01:00
parent b29fe1d957
commit 1206793dc3
4 changed files with 222 additions and 60 deletions

View file

@ -67,6 +67,10 @@ async def async_setup_entry(hass, config_entry):
hass.config_entries.async_forward_entry_setup(config_entry, "switch")
)
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(config_entry, "button")
)
hass.services.async_register(
DOMAIN, RUN_SCRIPT_COMMAND, controller.run_script, schema=SCRIPT_SCHEMA
)
@ -102,6 +106,7 @@ async def async_unload_entry(hass, config_entry):
await hass.config_entries.async_forward_entry_unload(config_entry, "binary_sensor")
await hass.config_entries.async_forward_entry_unload(config_entry, "device_tracker")
await hass.config_entries.async_forward_entry_unload(config_entry, "switch")
await hass.config_entries.async_forward_entry_unload(config_entry, "button")
hass.services.async_remove(DOMAIN, RUN_SCRIPT_COMMAND)
await controller.async_reset()
hass.data[DOMAIN][DATA_CLIENT].pop(config_entry.entry_id)