Cloud: Make sure on_connect forwards platform only once (#24582)
* Make sure on_connect forwards platform only once * Make sure right handler
This commit is contained in:
1 parent
ca70b96005
commit
f382be4c15
2 files changed
+30
No files matched your search
@@ -191,8 +191,16 @@ async def async_setup(hass, config):
|
||||
hass.helpers.service.async_register_admin_service(
|
||||
DOMAIN, SERVICE_REMOTE_DISCONNECT, _service_handler)
|
||||
|
||||
loaded_binary_sensor = False
|
||||
|
||||
async def _on_connect():
|
||||
"""Discover RemoteUI binary sensor."""
|
||||
nonlocal loaded_binary_sensor
|
||||
|
||||
if loaded_binary_sensor:
|
||||
return
|
||||
|
||||
loaded_binary_sensor = True
|
||||
hass.async_create_task(hass.helpers.discovery.async_load_platform(
|
||||
'binary_sensor', DOMAIN, {}, config))
|
||||
|
||||
|
||||
Reference in new issue
Block a user