mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +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:
@@ -1,7 +1,7 @@
|
||||
"""Test deCONZ remote events."""
|
||||
from copy import deepcopy
|
||||
|
||||
from homeassistant.components.deconz.deconz_event import CONF_DECONZ_EVENT
|
||||
from homeassistant.components.deconz.deconz_event import CONF_DECONZ_EVENT, EVENT
|
||||
|
||||
from .test_gateway import DECONZ_WEB_REQUEST, setup_deconz_integration
|
||||
|
||||
@@ -62,6 +62,7 @@ async def test_deconz_events(hass):
|
||||
assert "sensor.switch_2_battery_level" in gateway.deconz_ids
|
||||
assert len(hass.states.async_all()) == 3
|
||||
assert len(gateway.events) == 5
|
||||
assert len(gateway.entities[EVENT]) == 5
|
||||
|
||||
switch_1 = hass.states.get("sensor.switch_1")
|
||||
assert switch_1 is None
|
||||
@@ -127,3 +128,4 @@ async def test_deconz_events(hass):
|
||||
|
||||
assert len(hass.states.async_all()) == 0
|
||||
assert len(gateway.events) == 0
|
||||
assert len(gateway.entities[EVENT]) == 0
|
||||
|
||||
Reference in New Issue
Block a user