mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-08-03 09:24:31 +02:00
implemented scripts to button entity
This commit is contained in:
parent
b29fe1d957
commit
1206793dc3
4 changed files with 222 additions and 60 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue