Allow loading UniFi entities on config options change (#88762)

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
Robert Svensson
2023-03-06 16:08:14 +01:00
committed by GitHub
co-authored by Franck Nijhof
parent ee6f969c2a
commit 9ff45ca013
4 changed files with 108 additions and 2 deletions
+20 -1
View File
@@ -635,6 +635,15 @@ async def test_option_track_devices(
assert hass.states.get("device_tracker.client")
assert not hass.states.get("device_tracker.device")
hass.config_entries.async_update_entry(
config_entry,
options={CONF_TRACK_DEVICES: True},
)
await hass.async_block_till_done()
assert hass.states.get("device_tracker.client")
assert hass.states.get("device_tracker.device")
async def test_option_ssid_filter(
hass: HomeAssistant,
@@ -1041,7 +1050,7 @@ async def test_dont_track_devices(
"version": "4.0.42.10433",
}
await setup_unifi_integration(
config_entry = await setup_unifi_integration(
hass,
aioclient_mock,
options={CONF_TRACK_DEVICES: False},
@@ -1053,6 +1062,16 @@ async def test_dont_track_devices(
assert hass.states.get("device_tracker.client")
assert not hass.states.get("device_tracker.device")
hass.config_entries.async_update_entry(
config_entry,
options={CONF_TRACK_DEVICES: True},
)
await hass.async_block_till_done()
assert len(hass.states.async_entity_ids(TRACKER_DOMAIN)) == 2
assert hass.states.get("device_tracker.client")
assert hass.states.get("device_tracker.device")
async def test_dont_track_wired_clients(
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker, mock_device_registry