deCONZ - Directly reflect changes to config entry options (#31661)

* Directly reflect changes to config entry options

* Remove print

* Add tests

* Add title to config options
This commit is contained in:
Robert Svensson authored and GitHub committed 2020-02-18 13:24:25 -08:00
1 parent 17f3332c89
commit b5df2ba853
12 files changed
+188 -22

No files matched your search

+26
View File
@@ -245,3 +245,29 @@ async def test_disable_light_groups(hass):
empty_group = hass.states.get("light.empty_group")
assert empty_group is None
hass.config_entries.async_update_entry(
gateway.config_entry, options={deconz.gateway.CONF_ALLOW_DECONZ_GROUPS: True}
)
await hass.async_block_till_done()
assert "light.rgb_light" in gateway.deconz_ids
assert "light.tunable_white_light" in gateway.deconz_ids
assert "light.light_group" in gateway.deconz_ids
assert "light.empty_group" not in gateway.deconz_ids
assert "light.on_off_switch" not in gateway.deconz_ids
# 3 entities
assert len(hass.states.async_all()) == 5
hass.config_entries.async_update_entry(
gateway.config_entry, options={deconz.gateway.CONF_ALLOW_DECONZ_GROUPS: False}
)
await hass.async_block_till_done()
assert "light.rgb_light" in gateway.deconz_ids
assert "light.tunable_white_light" in gateway.deconz_ids
assert "light.light_group" not in gateway.deconz_ids
assert "light.empty_group" not in gateway.deconz_ids
assert "light.on_off_switch" not in gateway.deconz_ids
# 3 entities
assert len(hass.states.async_all()) == 4