How can i reload a custom integration without having to restart the whole Home Assistant? I have been searching but what i found seems to work with official integrations, but not with self made integrations.
koying
(Chris B)
February 7, 2024, 2:16pm
2
You can’t unless the integration explicitly supports it.
Sir_Goodenough
((SG) WhatAreWeFixing.Today)
February 7, 2024, 2:38pm
3
Event the HACS custom integration is not able to do it, so I don’t hold out much hope there.
Thanks for the response. Do you know how to do it? I have not found documentation about this neither
koying
(Chris B)
February 8, 2024, 8:25am
5
IIRC, you have to implement a reload
service, e.g.
Platform.SWITCH,
]
COORDINATOR_AWARE_PLATFORMS = [SENSOR_DOMAIN, BINARY_SENSOR_DOMAIN]
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the rest platforms."""
_async_setup_shared_data(hass)
async def reload_service_handler(service: ServiceCall) -> None:
"""Remove all user-defined groups and load new ones from config."""
conf = None
with contextlib.suppress(HomeAssistantError):
conf = await async_integration_yaml_config(hass, DOMAIN)
if conf is None:
return
await async_reload_integration_platforms(hass, DOMAIN, PLATFORMS)
_async_setup_shared_data(hass)
await _async_process_config(hass, conf)
1 Like