mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Avoid services unload for Isy994 (#146069)
* Avoid services unload for Isy994 * cleanup
This commit is contained in:
parent
ecc10e9793
commit
bbda1761bf
@ -47,7 +47,7 @@ from .const import (
|
|||||||
)
|
)
|
||||||
from .helpers import _categorize_nodes, _categorize_programs
|
from .helpers import _categorize_nodes, _categorize_programs
|
||||||
from .models import IsyConfigEntry, IsyData
|
from .models import IsyConfigEntry, IsyData
|
||||||
from .services import async_setup_services, async_unload_services
|
from .services import async_setup_services
|
||||||
from .util import _async_cleanup_registry_entries
|
from .util import _async_cleanup_registry_entries
|
||||||
|
|
||||||
CONFIG_SCHEMA = vol.Schema(
|
CONFIG_SCHEMA = vol.Schema(
|
||||||
@ -227,9 +227,6 @@ async def async_unload_entry(hass: HomeAssistant, entry: IsyConfigEntry) -> bool
|
|||||||
_LOGGER.debug("ISY Stopping Event Stream and automatic updates")
|
_LOGGER.debug("ISY Stopping Event Stream and automatic updates")
|
||||||
entry.runtime_data.root.websocket.stop()
|
entry.runtime_data.root.websocket.stop()
|
||||||
|
|
||||||
if not hass.config_entries.async_loaded_entries(DOMAIN):
|
|
||||||
async_unload_services(hass)
|
|
||||||
|
|
||||||
return unload_ok
|
return unload_ok
|
||||||
|
|
||||||
|
|
||||||
|
@ -137,10 +137,6 @@ def async_get_entities(hass: HomeAssistant) -> dict[str, Entity]:
|
|||||||
@callback
|
@callback
|
||||||
def async_setup_services(hass: HomeAssistant) -> None:
|
def async_setup_services(hass: HomeAssistant) -> None:
|
||||||
"""Create and register services for the ISY integration."""
|
"""Create and register services for the ISY integration."""
|
||||||
existing_services = hass.services.async_services_for_domain(DOMAIN)
|
|
||||||
if existing_services and SERVICE_SEND_PROGRAM_COMMAND in existing_services:
|
|
||||||
# Integration-level services have already been added. Return.
|
|
||||||
return
|
|
||||||
|
|
||||||
async def async_send_program_command_service_handler(service: ServiceCall) -> None:
|
async def async_send_program_command_service_handler(service: ServiceCall) -> None:
|
||||||
"""Handle a send program command service call."""
|
"""Handle a send program command service call."""
|
||||||
@ -230,18 +226,3 @@ def async_setup_services(hass: HomeAssistant) -> None:
|
|||||||
schema=cv.make_entity_service_schema(SERVICE_RENAME_NODE_SCHEMA),
|
schema=cv.make_entity_service_schema(SERVICE_RENAME_NODE_SCHEMA),
|
||||||
service_func=_async_rename_node,
|
service_func=_async_rename_node,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@callback
|
|
||||||
def async_unload_services(hass: HomeAssistant) -> None:
|
|
||||||
"""Unload services for the ISY integration."""
|
|
||||||
existing_services = hass.services.async_services_for_domain(DOMAIN)
|
|
||||||
if not existing_services or SERVICE_SEND_PROGRAM_COMMAND not in existing_services:
|
|
||||||
return
|
|
||||||
|
|
||||||
_LOGGER.debug("Unloading ISY994 Services")
|
|
||||||
hass.services.async_remove(domain=DOMAIN, service=SERVICE_SEND_PROGRAM_COMMAND)
|
|
||||||
hass.services.async_remove(domain=DOMAIN, service=SERVICE_SEND_RAW_NODE_COMMAND)
|
|
||||||
hass.services.async_remove(domain=DOMAIN, service=SERVICE_SEND_NODE_COMMAND)
|
|
||||||
hass.services.async_remove(domain=DOMAIN, service=SERVICE_GET_ZWAVE_PARAMETER)
|
|
||||||
hass.services.async_remove(domain=DOMAIN, service=SERVICE_SET_ZWAVE_PARAMETER)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user