mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Improve tracking of existing entities in deconz (#40265)
* Store all entities in dict * Use stored unique id to select if to create entity or not * Remove unnecessary init * Change so same physical sensor doesnt try to create multiple battery sensors Change so groups get created properly * Add controls in tests that entities are logged correctly
This commit is contained in:
@@ -64,6 +64,7 @@ async def test_no_switches(hass):
|
||||
gateway = await setup_deconz_integration(hass)
|
||||
assert len(gateway.deconz_ids) == 0
|
||||
assert len(hass.states.async_all()) == 0
|
||||
assert len(gateway.entities[switch.DOMAIN]) == 0
|
||||
|
||||
|
||||
async def test_switches(hass):
|
||||
@@ -77,6 +78,7 @@ async def test_switches(hass):
|
||||
assert "switch.unsupported_switch" not in gateway.deconz_ids
|
||||
assert "switch.on_off_relay" in gateway.deconz_ids
|
||||
assert len(hass.states.async_all()) == 5
|
||||
assert len(gateway.entities[switch.DOMAIN]) == 4
|
||||
|
||||
on_off_switch = hass.states.get("switch.on_off_switch")
|
||||
assert on_off_switch.state == "on"
|
||||
@@ -173,3 +175,4 @@ async def test_switches(hass):
|
||||
await gateway.async_reset()
|
||||
|
||||
assert len(hass.states.async_all()) == 0
|
||||
assert len(gateway.entities[switch.DOMAIN]) == 0
|
||||
|
||||
Reference in New Issue
Block a user