Fix Insteon startup for users with X10 devices (#94277)

This commit is contained in:
Tom Harris 2023-06-08 12:36:42 -04:00 committed by GitHub
parent c8756ba5bb
commit fceef42b08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -140,6 +140,9 @@ def add_insteon_events(hass: HomeAssistant, device: Device) -> None:
_LOGGER.debug("Firing event %s with %s", event, schema) _LOGGER.debug("Firing event %s with %s", event, schema)
hass.bus.async_fire(event, schema) hass.bus.async_fire(event, schema)
if str(device.address).startswith("X10"):
return
for name_or_group, event in device.events.items(): for name_or_group, event in device.events.items():
if isinstance(name_or_group, int): if isinstance(name_or_group, int):
for _, event in device.events[name_or_group].items(): for _, event in device.events[name_or_group].items():
@ -166,8 +169,9 @@ def register_new_device_callback(hass):
await device.async_status() await device.async_status()
platforms = get_device_platforms(device) platforms = get_device_platforms(device)
for platform in platforms: for platform in platforms:
groups = get_device_platform_groups(device, platform)
signal = f"{SIGNAL_ADD_ENTITIES}_{platform}" signal = f"{SIGNAL_ADD_ENTITIES}_{platform}"
dispatcher_send(hass, signal, {"address": device.address}) dispatcher_send(hass, signal, {"address": device.address, "groups": groups})
add_insteon_events(hass, device) add_insteon_events(hass, device)
devices.subscribe(async_new_insteon_device, force_strong_ref=True) devices.subscribe(async_new_insteon_device, force_strong_ref=True)