Skip to content

Commit

Permalink
Update device_entry for all devices, should solve issue for mixed sen…
Browse files Browse the repository at this point in the history
…sor and actuator device like DVT_UP1AV
  • Loading branch information
mnordseth committed Aug 23, 2024
1 parent 97fdad8 commit 4cb636e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions custom_components/enet/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


async def async_setup_devices(coordinator):
"""Manage setup of devices from Hue devices."""
"""Manage setup of devices from Enet devices."""
entry = coordinator.config_entry
hass = coordinator.hass
dev_reg = device_registry.async_get(hass)
Expand All @@ -22,8 +22,7 @@ def add_device(enet_device):
params = enet_device.get_device_info()
return dev_reg.async_get_or_create(config_entry_id=entry.entry_id, **params)

# create/update all current devices found in controller
# create/update all current devices found in controller ensuring devices that only generate events also gets registered
for enet_device in coordinator.hub.devices:
if all([not isinstance(c, ActuatorChannel) for c in enet_device.channels]):
hass_device_entry = add_device(enet_device)
enet_device.hass_device_entry = hass_device_entry
hass_device_entry = add_device(enet_device)
enet_device.hass_device_entry = hass_device_entry

0 comments on commit 4cb636e

Please sign in to comment.