mirror of
https://github.com/home-assistant/core.git
synced 2026-08-24 02:24:51 -05:00
Fix missing device trackers after initial setup in devolo Home Network (#179327)
This commit is contained in:
@@ -75,6 +75,7 @@ async def async_setup_entry(
|
||||
async_add_entities(missing)
|
||||
|
||||
restore_entities()
|
||||
new_device_callback()
|
||||
entry.async_on_unload(
|
||||
coordinators[CONNECTED_WIFI_CLIENTS].async_add_listener(new_device_callback)
|
||||
)
|
||||
|
||||
@@ -10,7 +10,7 @@ from syrupy.assertion import SnapshotAssertion
|
||||
from homeassistant.components.device_tracker import DOMAIN as DEVICE_TRACKER_DOMAIN
|
||||
from homeassistant.components.devolo_home_network.const import (
|
||||
DOMAIN,
|
||||
LONG_UPDATE_INTERVAL,
|
||||
SHORT_UPDATE_INTERVAL,
|
||||
)
|
||||
from homeassistant.const import STATE_NOT_HOME, STATE_UNAVAILABLE
|
||||
from homeassistant.core import HomeAssistant
|
||||
@@ -40,16 +40,13 @@ async def test_device_tracker(
|
||||
entry = configure_integration(hass)
|
||||
await hass.config_entries.async_setup(entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
freezer.tick(LONG_UPDATE_INTERVAL)
|
||||
async_fire_time_changed(hass)
|
||||
await hass.async_block_till_done()
|
||||
assert hass.states.get(entity_id) == snapshot
|
||||
|
||||
# Emulate state change
|
||||
mock_device.device.async_get_wifi_connected_station = AsyncMock(
|
||||
return_value=NO_CONNECTED_STATIONS
|
||||
)
|
||||
freezer.tick(LONG_UPDATE_INTERVAL)
|
||||
freezer.tick(SHORT_UPDATE_INTERVAL)
|
||||
async_fire_time_changed(hass)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
@@ -61,7 +58,7 @@ async def test_device_tracker(
|
||||
mock_device.device.async_get_wifi_connected_station = AsyncMock(
|
||||
side_effect=DeviceUnavailable
|
||||
)
|
||||
freezer.tick(LONG_UPDATE_INTERVAL)
|
||||
freezer.tick(SHORT_UPDATE_INTERVAL)
|
||||
async_fire_time_changed(hass)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user