mirror of https://github.com/simbaja/ha_gehome.git
- added additional logic to handle non-standard ready conditions
This commit is contained in:
parent
75ff9243fb
commit
c2025f97e7
|
@ -35,7 +35,13 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry, asyn
|
|||
]
|
||||
_LOGGER.debug(f'Found {len(entities):d} unregistered binary sensors')
|
||||
async_add_entities(entities)
|
||||
|
||||
# add the ready signal and register the remove callback
|
||||
coordinator.add_signal_remove_callback(
|
||||
async_dispatcher_connect(hass, coordinator.signal_ready, async_devices_discovered))
|
||||
|
||||
#if we're already initialized at this point, call device
|
||||
#discovery directly, otherwise add a callback based on the
|
||||
#ready signal
|
||||
if coordinator.initialized:
|
||||
async_devices_discovered(coordinator.appliance_apis.values())
|
||||
else:
|
||||
# add the ready signal and register the remove callback
|
||||
coordinator.add_signal_remove_callback(
|
||||
async_dispatcher_connect(hass, coordinator.signal_ready, async_devices_discovered))
|
||||
|
|
|
@ -34,6 +34,12 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry, asyn
|
|||
_LOGGER.debug(f'Found {len(entities):d} unregistered buttons ')
|
||||
async_add_entities(entities)
|
||||
|
||||
# add the ready signal and register the remove callback
|
||||
coordinator.add_signal_remove_callback(
|
||||
async_dispatcher_connect(hass, coordinator.signal_ready, async_devices_discovered))
|
||||
#if we're already initialized at this point, call device
|
||||
#discovery directly, otherwise add a callback based on the
|
||||
#ready signal
|
||||
if coordinator.initialized:
|
||||
async_devices_discovered(coordinator.appliance_apis.values())
|
||||
else:
|
||||
# add the ready signal and register the remove callback
|
||||
coordinator.add_signal_remove_callback(
|
||||
async_dispatcher_connect(hass, coordinator.signal_ready, async_devices_discovered))
|
||||
|
|
|
@ -36,6 +36,12 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry, asyn
|
|||
_LOGGER.debug(f'Found {len(entities):d} unregistered climate entities')
|
||||
async_add_entities(entities)
|
||||
|
||||
# add the ready signal and register the remove callback
|
||||
coordinator.add_signal_remove_callback(
|
||||
async_dispatcher_connect(hass, coordinator.signal_ready, async_devices_discovered))
|
||||
#if we're already initialized at this point, call device
|
||||
#discovery directly, otherwise add a callback based on the
|
||||
#ready signal
|
||||
if coordinator.initialized:
|
||||
async_devices_discovered(coordinator.appliance_apis.values())
|
||||
else:
|
||||
# add the ready signal and register the remove callback
|
||||
coordinator.add_signal_remove_callback(
|
||||
async_dispatcher_connect(hass, coordinator.signal_ready, async_devices_discovered))
|
||||
|
|
|
@ -33,6 +33,12 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry, asyn
|
|||
_LOGGER.debug(f'Found {len(entities):d} unregistered humidifiers')
|
||||
async_add_entities(entities)
|
||||
|
||||
# add the ready signal and register the remove callback
|
||||
coordinator.add_signal_remove_callback(
|
||||
async_dispatcher_connect(hass, coordinator.signal_ready, async_devices_discovered))
|
||||
#if we're already initialized at this point, call device
|
||||
#discovery directly, otherwise add a callback based on the
|
||||
#ready signal
|
||||
if coordinator.initialized:
|
||||
async_devices_discovered(coordinator.appliance_apis.values())
|
||||
else:
|
||||
# add the ready signal and register the remove callback
|
||||
coordinator.add_signal_remove_callback(
|
||||
async_dispatcher_connect(hass, coordinator.signal_ready, async_devices_discovered))
|
||||
|
|
|
@ -37,6 +37,12 @@ async def async_setup_entry(
|
|||
_LOGGER.debug(f"Found {len(entities):d} unregistered lights")
|
||||
async_add_entities(entities)
|
||||
|
||||
# add the ready signal and register the remove callback
|
||||
coordinator.add_signal_remove_callback(
|
||||
async_dispatcher_connect(hass, coordinator.signal_ready, async_devices_discovered))
|
||||
#if we're already initialized at this point, call device
|
||||
#discovery directly, otherwise add a callback based on the
|
||||
#ready signal
|
||||
if coordinator.initialized:
|
||||
async_devices_discovered(coordinator.appliance_apis.values())
|
||||
else:
|
||||
# add the ready signal and register the remove callback
|
||||
coordinator.add_signal_remove_callback(
|
||||
async_dispatcher_connect(hass, coordinator.signal_ready, async_devices_discovered))
|
||||
|
|
|
@ -34,6 +34,12 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry, asyn
|
|||
_LOGGER.debug(f'Found {len(entities):d} unregisterd numbers')
|
||||
async_add_entities(entities)
|
||||
|
||||
# add the ready signal and register the remove callback
|
||||
coordinator.add_signal_remove_callback(
|
||||
async_dispatcher_connect(hass, coordinator.signal_ready, async_devices_discovered))
|
||||
#if we're already initialized at this point, call device
|
||||
#discovery directly, otherwise add a callback based on the
|
||||
#ready signal
|
||||
if coordinator.initialized:
|
||||
async_devices_discovered(coordinator.appliance_apis.values())
|
||||
else:
|
||||
# add the ready signal and register the remove callback
|
||||
coordinator.add_signal_remove_callback(
|
||||
async_dispatcher_connect(hass, coordinator.signal_ready, async_devices_discovered))
|
||||
|
|
|
@ -37,6 +37,12 @@ async def async_setup_entry(
|
|||
_LOGGER.debug(f"Found {len(entities):d} unregistered selects")
|
||||
async_add_entities(entities)
|
||||
|
||||
# add the ready signal and register the remove callback
|
||||
coordinator.add_signal_remove_callback(
|
||||
async_dispatcher_connect(hass, coordinator.signal_ready, async_devices_discovered))
|
||||
#if we're already initialized at this point, call device
|
||||
#discovery directly, otherwise add a callback based on the
|
||||
#ready signal
|
||||
if coordinator.initialized:
|
||||
async_devices_discovered(coordinator.appliance_apis.values())
|
||||
else:
|
||||
# add the ready signal and register the remove callback
|
||||
coordinator.add_signal_remove_callback(
|
||||
async_dispatcher_connect(hass, coordinator.signal_ready, async_devices_discovered))
|
||||
|
|
|
@ -47,9 +47,15 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry, asyn
|
|||
_LOGGER.debug(f'Found {len(entities):d} unregistered sensors')
|
||||
async_add_entities(entities)
|
||||
|
||||
# add the ready signal and register the remove callback
|
||||
coordinator.add_signal_remove_callback(
|
||||
async_dispatcher_connect(hass, coordinator.signal_ready, async_devices_discovered))
|
||||
#if we're already initialized at this point, call device
|
||||
#discovery directly, otherwise add a callback based on the
|
||||
#ready signal
|
||||
if coordinator.initialized:
|
||||
async_devices_discovered(coordinator.appliance_apis.values())
|
||||
else:
|
||||
# add the ready signal and register the remove callback
|
||||
coordinator.add_signal_remove_callback(
|
||||
async_dispatcher_connect(hass, coordinator.signal_ready, async_devices_discovered))
|
||||
|
||||
# register set_timer entity service
|
||||
platform.async_register_entity_service(
|
||||
|
|
|
@ -33,6 +33,12 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry, asyn
|
|||
_LOGGER.debug(f'Found {len(entities):d} unregistered switches')
|
||||
async_add_entities(entities)
|
||||
|
||||
# add the ready signal and register the remove callback
|
||||
coordinator.add_signal_remove_callback(
|
||||
async_dispatcher_connect(hass, coordinator.signal_ready, async_devices_discovered))
|
||||
#if we're already initialized at this point, call device
|
||||
#discovery directly, otherwise add a callback based on the
|
||||
#ready signal
|
||||
if coordinator.initialized:
|
||||
async_devices_discovered(coordinator.appliance_apis.values())
|
||||
else:
|
||||
# add the ready signal and register the remove callback
|
||||
coordinator.add_signal_remove_callback(
|
||||
async_dispatcher_connect(hass, coordinator.signal_ready, async_devices_discovered))
|
||||
|
|
|
@ -112,7 +112,11 @@ class GeHomeUpdateCoordinator(DataUpdateCoordinator):
|
|||
@property
|
||||
def signal_ready(self) -> str:
|
||||
"""Event specific per entry to signal readiness"""
|
||||
return f"{DOMAIN}-ready-{self._config_entry.entry_id}"
|
||||
return f"{DOMAIN}-ready-{self._config_entry.entry_id}"
|
||||
|
||||
@property
|
||||
def initialized(self) -> bool:
|
||||
return self._init_done
|
||||
|
||||
@property
|
||||
def online(self) -> bool:
|
||||
|
|
|
@ -35,6 +35,12 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry, asyn
|
|||
_LOGGER.debug(f'Found {len(entities):d} unregistered water heaters')
|
||||
async_add_entities(entities)
|
||||
|
||||
# add the ready signal and register the remove callback
|
||||
coordinator.add_signal_remove_callback(
|
||||
async_dispatcher_connect(hass, coordinator.signal_ready, async_devices_discovered))
|
||||
#if we're already initialized at this point, call device
|
||||
#discovery directly, otherwise add a callback based on the
|
||||
#ready signal
|
||||
if coordinator.initialized:
|
||||
async_devices_discovered(coordinator.appliance_apis.values())
|
||||
else:
|
||||
# add the ready signal and register the remove callback
|
||||
coordinator.add_signal_remove_callback(
|
||||
async_dispatcher_connect(hass, coordinator.signal_ready, async_devices_discovered))
|
||||
|
|
Loading…
Reference in New Issue