mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Fix deCONZ device refresh service (#42175)
This commit is contained in:
parent
e7d806c832
commit
1a97b0edd9
@ -139,50 +139,14 @@ async def async_refresh_devices_service(hass, data):
|
|||||||
if CONF_BRIDGE_ID in data:
|
if CONF_BRIDGE_ID in data:
|
||||||
gateway = hass.data[DOMAIN][normalize_bridge_id(data[CONF_BRIDGE_ID])]
|
gateway = hass.data[DOMAIN][normalize_bridge_id(data[CONF_BRIDGE_ID])]
|
||||||
|
|
||||||
groups = set(gateway.api.groups.keys())
|
|
||||||
lights = set(gateway.api.lights.keys())
|
|
||||||
scenes = set(gateway.api.scenes.keys())
|
|
||||||
sensors = set(gateway.api.sensors.keys())
|
|
||||||
|
|
||||||
gateway.ignore_state_updates = True
|
gateway.ignore_state_updates = True
|
||||||
await gateway.api.refresh_state()
|
await gateway.api.refresh_state()
|
||||||
gateway.ignore_state_updates = False
|
gateway.ignore_state_updates = False
|
||||||
|
|
||||||
gateway.async_add_device_callback(
|
gateway.async_add_device_callback(NEW_GROUP, list(gateway.api.groups.values()))
|
||||||
NEW_GROUP,
|
gateway.async_add_device_callback(NEW_LIGHT, list(gateway.api.lights.values()))
|
||||||
[
|
gateway.async_add_device_callback(NEW_SCENE, list(gateway.api.scenes.values()))
|
||||||
group
|
gateway.async_add_device_callback(NEW_SENSOR, list(gateway.api.sensors.values()))
|
||||||
for group_id, group in gateway.api.groups.items()
|
|
||||||
if group_id not in groups
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
gateway.async_add_device_callback(
|
|
||||||
NEW_LIGHT,
|
|
||||||
[
|
|
||||||
light
|
|
||||||
for light_id, light in gateway.api.lights.items()
|
|
||||||
if light_id not in lights
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
gateway.async_add_device_callback(
|
|
||||||
NEW_SCENE,
|
|
||||||
[
|
|
||||||
scene
|
|
||||||
for scene_id, scene in gateway.api.scenes.items()
|
|
||||||
if scene_id not in scenes
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
gateway.async_add_device_callback(
|
|
||||||
NEW_SENSOR,
|
|
||||||
[
|
|
||||||
sensor
|
|
||||||
for sensor_id, sensor in gateway.api.sensors.items()
|
|
||||||
if sensor_id not in sensors
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
async def async_remove_orphaned_entries_service(hass, data):
|
async def async_remove_orphaned_entries_service(hass, data):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user