mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Remove hourly weather entity from metoffice (#112452)
This commit is contained in:
parent
69356300f0
commit
b190cdceaf
@ -45,31 +45,24 @@ async def async_setup_entry(
|
|||||||
entity_registry = er.async_get(hass)
|
entity_registry = er.async_get(hass)
|
||||||
hass_data = hass.data[DOMAIN][entry.entry_id]
|
hass_data = hass.data[DOMAIN][entry.entry_id]
|
||||||
|
|
||||||
entities = [
|
# Remove hourly entity from legacy config entries
|
||||||
MetOfficeWeather(
|
if entity_id := entity_registry.async_get_entity_id(
|
||||||
hass_data[METOFFICE_DAILY_COORDINATOR],
|
|
||||||
hass_data[METOFFICE_HOURLY_COORDINATOR],
|
|
||||||
hass_data,
|
|
||||||
False,
|
|
||||||
)
|
|
||||||
]
|
|
||||||
|
|
||||||
# Add hourly entity to legacy config entries
|
|
||||||
if entity_registry.async_get_entity_id(
|
|
||||||
WEATHER_DOMAIN,
|
WEATHER_DOMAIN,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
_calculate_unique_id(hass_data[METOFFICE_COORDINATES], True),
|
_calculate_unique_id(hass_data[METOFFICE_COORDINATES], True),
|
||||||
):
|
):
|
||||||
entities.append(
|
entity_registry.async_remove(entity_id)
|
||||||
|
|
||||||
|
async_add_entities(
|
||||||
|
[
|
||||||
MetOfficeWeather(
|
MetOfficeWeather(
|
||||||
hass_data[METOFFICE_DAILY_COORDINATOR],
|
hass_data[METOFFICE_DAILY_COORDINATOR],
|
||||||
hass_data[METOFFICE_HOURLY_COORDINATOR],
|
hass_data[METOFFICE_HOURLY_COORDINATOR],
|
||||||
hass_data,
|
hass_data,
|
||||||
True,
|
|
||||||
)
|
)
|
||||||
)
|
],
|
||||||
|
False,
|
||||||
async_add_entities(entities, False)
|
)
|
||||||
|
|
||||||
|
|
||||||
def _build_forecast_data(timestep: Timestep) -> Forecast:
|
def _build_forecast_data(timestep: Timestep) -> Forecast:
|
||||||
@ -119,14 +112,9 @@ class MetOfficeWeather(
|
|||||||
coordinator_daily: TimestampDataUpdateCoordinator[MetOfficeData],
|
coordinator_daily: TimestampDataUpdateCoordinator[MetOfficeData],
|
||||||
coordinator_hourly: TimestampDataUpdateCoordinator[MetOfficeData],
|
coordinator_hourly: TimestampDataUpdateCoordinator[MetOfficeData],
|
||||||
hass_data: dict[str, Any],
|
hass_data: dict[str, Any],
|
||||||
use_3hourly: bool,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialise the platform with a data instance."""
|
"""Initialise the platform with a data instance."""
|
||||||
self._hourly = use_3hourly
|
observation_coordinator = coordinator_daily
|
||||||
if use_3hourly:
|
|
||||||
observation_coordinator = coordinator_hourly
|
|
||||||
else:
|
|
||||||
observation_coordinator = coordinator_daily
|
|
||||||
super().__init__(
|
super().__init__(
|
||||||
observation_coordinator,
|
observation_coordinator,
|
||||||
daily_coordinator=coordinator_daily,
|
daily_coordinator=coordinator_daily,
|
||||||
@ -136,9 +124,9 @@ class MetOfficeWeather(
|
|||||||
self._attr_device_info = get_device_info(
|
self._attr_device_info = get_device_info(
|
||||||
coordinates=hass_data[METOFFICE_COORDINATES], name=hass_data[METOFFICE_NAME]
|
coordinates=hass_data[METOFFICE_COORDINATES], name=hass_data[METOFFICE_NAME]
|
||||||
)
|
)
|
||||||
self._attr_name = "3-Hourly" if use_3hourly else "Daily"
|
self._attr_name = "Daily"
|
||||||
self._attr_unique_id = _calculate_unique_id(
|
self._attr_unique_id = _calculate_unique_id(
|
||||||
hass_data[METOFFICE_COORDINATES], use_3hourly
|
hass_data[METOFFICE_COORDINATES], False
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -109,14 +109,6 @@ async def test_site_cannot_update(
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""Test we handle cannot connect error."""
|
"""Test we handle cannot connect error."""
|
||||||
|
|
||||||
# Pre-create the hourly entity
|
|
||||||
entity_registry.async_get_or_create(
|
|
||||||
WEATHER_DOMAIN,
|
|
||||||
DOMAIN,
|
|
||||||
"53.38374_-2.90929",
|
|
||||||
suggested_object_id="met_office_wavertree_3_hourly",
|
|
||||||
)
|
|
||||||
|
|
||||||
entry = MockConfigEntry(
|
entry = MockConfigEntry(
|
||||||
domain=DOMAIN,
|
domain=DOMAIN,
|
||||||
data=METOFFICE_CONFIG_WAVERTREE,
|
data=METOFFICE_CONFIG_WAVERTREE,
|
||||||
@ -125,9 +117,6 @@ async def test_site_cannot_update(
|
|||||||
await hass.config_entries.async_setup(entry.entry_id)
|
await hass.config_entries.async_setup(entry.entry_id)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
weather = hass.states.get("weather.met_office_wavertree_3_hourly")
|
|
||||||
assert weather
|
|
||||||
|
|
||||||
weather = hass.states.get("weather.met_office_wavertree_daily")
|
weather = hass.states.get("weather.met_office_wavertree_daily")
|
||||||
assert weather
|
assert weather
|
||||||
|
|
||||||
@ -138,9 +127,6 @@ async def test_site_cannot_update(
|
|||||||
async_fire_time_changed(hass, future_time)
|
async_fire_time_changed(hass, future_time)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
weather = hass.states.get("weather.met_office_wavertree_3_hourly")
|
|
||||||
assert weather.state == STATE_UNAVAILABLE
|
|
||||||
|
|
||||||
weather = hass.states.get("weather.met_office_wavertree_daily")
|
weather = hass.states.get("weather.met_office_wavertree_daily")
|
||||||
assert weather.state == STATE_UNAVAILABLE
|
assert weather.state == STATE_UNAVAILABLE
|
||||||
|
|
||||||
@ -154,14 +140,6 @@ async def test_one_weather_site_running(
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""Test the Met Office weather platform."""
|
"""Test the Met Office weather platform."""
|
||||||
|
|
||||||
# Pre-create the hourly entity
|
|
||||||
entity_registry.async_get_or_create(
|
|
||||||
WEATHER_DOMAIN,
|
|
||||||
DOMAIN,
|
|
||||||
"53.38374_-2.90929",
|
|
||||||
suggested_object_id="met_office_wavertree_3_hourly",
|
|
||||||
)
|
|
||||||
|
|
||||||
entry = MockConfigEntry(
|
entry = MockConfigEntry(
|
||||||
domain=DOMAIN,
|
domain=DOMAIN,
|
||||||
data=METOFFICE_CONFIG_WAVERTREE,
|
data=METOFFICE_CONFIG_WAVERTREE,
|
||||||
@ -175,30 +153,6 @@ async def test_one_weather_site_running(
|
|||||||
device_wavertree = dev_reg.async_get_device(identifiers=DEVICE_KEY_WAVERTREE)
|
device_wavertree = dev_reg.async_get_device(identifiers=DEVICE_KEY_WAVERTREE)
|
||||||
assert device_wavertree.name == "Met Office Wavertree"
|
assert device_wavertree.name == "Met Office Wavertree"
|
||||||
|
|
||||||
# Wavertree 3-hourly weather platform expected results
|
|
||||||
weather = hass.states.get("weather.met_office_wavertree_3_hourly")
|
|
||||||
assert weather
|
|
||||||
|
|
||||||
assert weather.state == "sunny"
|
|
||||||
assert weather.attributes.get("temperature") == 17
|
|
||||||
assert weather.attributes.get("wind_speed") == 14.48
|
|
||||||
assert weather.attributes.get("wind_speed_unit") == "km/h"
|
|
||||||
assert weather.attributes.get("wind_bearing") == "SSE"
|
|
||||||
assert weather.attributes.get("humidity") == 50
|
|
||||||
|
|
||||||
# Forecasts added - just pick out 1 entry to check
|
|
||||||
assert len(weather.attributes.get("forecast")) == 35
|
|
||||||
|
|
||||||
assert (
|
|
||||||
weather.attributes.get("forecast")[26]["datetime"]
|
|
||||||
== "2020-04-28T21:00:00+00:00"
|
|
||||||
)
|
|
||||||
assert weather.attributes.get("forecast")[26]["condition"] == "cloudy"
|
|
||||||
assert weather.attributes.get("forecast")[26]["precipitation_probability"] == 9
|
|
||||||
assert weather.attributes.get("forecast")[26]["temperature"] == 10
|
|
||||||
assert weather.attributes.get("forecast")[26]["wind_speed"] == 6.44
|
|
||||||
assert weather.attributes.get("forecast")[26]["wind_bearing"] == "NNE"
|
|
||||||
|
|
||||||
# Wavertree daily weather platform expected results
|
# Wavertree daily weather platform expected results
|
||||||
weather = hass.states.get("weather.met_office_wavertree_daily")
|
weather = hass.states.get("weather.met_office_wavertree_daily")
|
||||||
assert weather
|
assert weather
|
||||||
@ -232,20 +186,6 @@ async def test_two_weather_sites_running(
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""Test we handle two different weather sites both running."""
|
"""Test we handle two different weather sites both running."""
|
||||||
|
|
||||||
# Pre-create the hourly entities
|
|
||||||
entity_registry.async_get_or_create(
|
|
||||||
WEATHER_DOMAIN,
|
|
||||||
DOMAIN,
|
|
||||||
"53.38374_-2.90929",
|
|
||||||
suggested_object_id="met_office_wavertree_3_hourly",
|
|
||||||
)
|
|
||||||
entity_registry.async_get_or_create(
|
|
||||||
WEATHER_DOMAIN,
|
|
||||||
DOMAIN,
|
|
||||||
"52.75556_0.44231",
|
|
||||||
suggested_object_id="met_office_king_s_lynn_3_hourly",
|
|
||||||
)
|
|
||||||
|
|
||||||
# all metoffice test data encapsulated in here
|
# all metoffice test data encapsulated in here
|
||||||
mock_json = json.loads(load_fixture("metoffice.json", "metoffice"))
|
mock_json = json.loads(load_fixture("metoffice.json", "metoffice"))
|
||||||
kingslynn_hourly = json.dumps(mock_json["kingslynn_hourly"])
|
kingslynn_hourly = json.dumps(mock_json["kingslynn_hourly"])
|
||||||
@ -279,30 +219,6 @@ async def test_two_weather_sites_running(
|
|||||||
device_wavertree = dev_reg.async_get_device(identifiers=DEVICE_KEY_WAVERTREE)
|
device_wavertree = dev_reg.async_get_device(identifiers=DEVICE_KEY_WAVERTREE)
|
||||||
assert device_wavertree.name == "Met Office Wavertree"
|
assert device_wavertree.name == "Met Office Wavertree"
|
||||||
|
|
||||||
# Wavertree 3-hourly weather platform expected results
|
|
||||||
weather = hass.states.get("weather.met_office_wavertree_3_hourly")
|
|
||||||
assert weather
|
|
||||||
|
|
||||||
assert weather.state == "sunny"
|
|
||||||
assert weather.attributes.get("temperature") == 17
|
|
||||||
assert weather.attributes.get("wind_speed") == 14.48
|
|
||||||
assert weather.attributes.get("wind_speed_unit") == "km/h"
|
|
||||||
assert weather.attributes.get("wind_bearing") == "SSE"
|
|
||||||
assert weather.attributes.get("humidity") == 50
|
|
||||||
|
|
||||||
# Forecasts added - just pick out 1 entry to check
|
|
||||||
assert len(weather.attributes.get("forecast")) == 35
|
|
||||||
|
|
||||||
assert (
|
|
||||||
weather.attributes.get("forecast")[18]["datetime"]
|
|
||||||
== "2020-04-27T21:00:00+00:00"
|
|
||||||
)
|
|
||||||
assert weather.attributes.get("forecast")[18]["condition"] == "clear-night"
|
|
||||||
assert weather.attributes.get("forecast")[18]["precipitation_probability"] == 1
|
|
||||||
assert weather.attributes.get("forecast")[18]["temperature"] == 9
|
|
||||||
assert weather.attributes.get("forecast")[18]["wind_speed"] == 6.44
|
|
||||||
assert weather.attributes.get("forecast")[18]["wind_bearing"] == "NW"
|
|
||||||
|
|
||||||
# Wavertree daily weather platform expected results
|
# Wavertree daily weather platform expected results
|
||||||
weather = hass.states.get("weather.met_office_wavertree_daily")
|
weather = hass.states.get("weather.met_office_wavertree_daily")
|
||||||
assert weather
|
assert weather
|
||||||
@ -327,30 +243,6 @@ async def test_two_weather_sites_running(
|
|||||||
assert weather.attributes.get("forecast")[3]["wind_speed"] == 20.92
|
assert weather.attributes.get("forecast")[3]["wind_speed"] == 20.92
|
||||||
assert weather.attributes.get("forecast")[3]["wind_bearing"] == "SE"
|
assert weather.attributes.get("forecast")[3]["wind_bearing"] == "SE"
|
||||||
|
|
||||||
# King's Lynn 3-hourly weather platform expected results
|
|
||||||
weather = hass.states.get("weather.met_office_king_s_lynn_3_hourly")
|
|
||||||
assert weather
|
|
||||||
|
|
||||||
assert weather.state == "sunny"
|
|
||||||
assert weather.attributes.get("temperature") == 14
|
|
||||||
assert weather.attributes.get("wind_speed") == 3.22
|
|
||||||
assert weather.attributes.get("wind_speed_unit") == "km/h"
|
|
||||||
assert weather.attributes.get("wind_bearing") == "E"
|
|
||||||
assert weather.attributes.get("humidity") == 60
|
|
||||||
|
|
||||||
# Also has Forecast added - just pick out 1 entry to check
|
|
||||||
assert len(weather.attributes.get("forecast")) == 35
|
|
||||||
|
|
||||||
assert (
|
|
||||||
weather.attributes.get("forecast")[18]["datetime"]
|
|
||||||
== "2020-04-27T21:00:00+00:00"
|
|
||||||
)
|
|
||||||
assert weather.attributes.get("forecast")[18]["condition"] == "cloudy"
|
|
||||||
assert weather.attributes.get("forecast")[18]["precipitation_probability"] == 9
|
|
||||||
assert weather.attributes.get("forecast")[18]["temperature"] == 10
|
|
||||||
assert weather.attributes.get("forecast")[18]["wind_speed"] == 11.27
|
|
||||||
assert weather.attributes.get("forecast")[18]["wind_bearing"] == "SE"
|
|
||||||
|
|
||||||
# King's Lynn daily weather platform expected results
|
# King's Lynn daily weather platform expected results
|
||||||
weather = hass.states.get("weather.met_office_king_s_lynn_daily")
|
weather = hass.states.get("weather.met_office_king_s_lynn_daily")
|
||||||
assert weather
|
assert weather
|
||||||
@ -395,33 +287,6 @@ async def test_new_config_entry(
|
|||||||
assert len(er.async_entries_for_config_entry(entity_registry, entry.entry_id)) == 1
|
assert len(er.async_entries_for_config_entry(entity_registry, entry.entry_id)) == 1
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.freeze_time(datetime.datetime(2020, 4, 25, 12, tzinfo=datetime.UTC))
|
|
||||||
async def test_legacy_config_entry(
|
|
||||||
hass: HomeAssistant, entity_registry: er.EntityRegistry, no_sensor, wavertree_data
|
|
||||||
) -> None:
|
|
||||||
"""Test the expected entities are created."""
|
|
||||||
# Pre-create the hourly entity
|
|
||||||
entity_registry.async_get_or_create(
|
|
||||||
WEATHER_DOMAIN,
|
|
||||||
DOMAIN,
|
|
||||||
"53.38374_-2.90929",
|
|
||||||
suggested_object_id="met_office_wavertree_3_hourly",
|
|
||||||
)
|
|
||||||
|
|
||||||
entry = MockConfigEntry(
|
|
||||||
domain=DOMAIN,
|
|
||||||
data=METOFFICE_CONFIG_WAVERTREE,
|
|
||||||
)
|
|
||||||
entry.add_to_hass(hass)
|
|
||||||
|
|
||||||
await hass.config_entries.async_setup(entry.entry_id)
|
|
||||||
await hass.async_block_till_done()
|
|
||||||
|
|
||||||
assert len(hass.states.async_entity_ids("weather")) == 2
|
|
||||||
entry = hass.config_entries.async_entries()[0]
|
|
||||||
assert len(er.async_entries_for_config_entry(entity_registry, entry.entry_id)) == 2
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.freeze_time(datetime.datetime(2020, 4, 25, 12, tzinfo=datetime.UTC))
|
@pytest.mark.freeze_time(datetime.datetime(2020, 4, 25, 12, tzinfo=datetime.UTC))
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
("service"),
|
("service"),
|
||||||
@ -513,27 +378,11 @@ async def test_forecast_service(
|
|||||||
assert response == snapshot
|
assert response == snapshot
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
|
||||||
"entity_id",
|
|
||||||
[
|
|
||||||
"weather.met_office_wavertree_3_hourly",
|
|
||||||
"weather.met_office_wavertree_daily",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
@pytest.mark.freeze_time(datetime.datetime(2020, 4, 25, 12, tzinfo=datetime.UTC))
|
@pytest.mark.freeze_time(datetime.datetime(2020, 4, 25, 12, tzinfo=datetime.UTC))
|
||||||
async def test_forecast_subscription(
|
async def test_legacy_config_entry_is_removed(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant, entity_registry: er.EntityRegistry, no_sensor, wavertree_data
|
||||||
hass_ws_client: WebSocketGenerator,
|
|
||||||
entity_registry: er.EntityRegistry,
|
|
||||||
freezer: FrozenDateTimeFactory,
|
|
||||||
snapshot: SnapshotAssertion,
|
|
||||||
no_sensor,
|
|
||||||
wavertree_data: dict[str, _Matcher],
|
|
||||||
entity_id: str,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test multiple forecast."""
|
"""Test the expected entities are created."""
|
||||||
client = await hass_ws_client(hass)
|
|
||||||
|
|
||||||
# Pre-create the hourly entity
|
# Pre-create the hourly entity
|
||||||
entity_registry.async_get_or_create(
|
entity_registry.async_get_or_create(
|
||||||
WEATHER_DOMAIN,
|
WEATHER_DOMAIN,
|
||||||
@ -551,47 +400,75 @@ async def test_forecast_subscription(
|
|||||||
await hass.config_entries.async_setup(entry.entry_id)
|
await hass.config_entries.async_setup(entry.entry_id)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
for forecast_type in ("daily", "hourly"):
|
assert len(hass.states.async_entity_ids("weather")) == 1
|
||||||
await client.send_json_auto_id(
|
entry = hass.config_entries.async_entries()[0]
|
||||||
{
|
assert len(er.async_entries_for_config_entry(entity_registry, entry.entry_id)) == 1
|
||||||
"type": "weather/subscribe_forecast",
|
|
||||||
"forecast_type": forecast_type,
|
|
||||||
"entity_id": entity_id,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
msg = await client.receive_json()
|
|
||||||
assert msg["success"]
|
|
||||||
assert msg["result"] is None
|
|
||||||
subscription_id = msg["id"]
|
|
||||||
|
|
||||||
msg = await client.receive_json()
|
|
||||||
assert msg["id"] == subscription_id
|
|
||||||
assert msg["type"] == "event"
|
|
||||||
forecast1 = msg["event"]["forecast"]
|
|
||||||
|
|
||||||
assert forecast1 != []
|
@pytest.mark.freeze_time(datetime.datetime(2020, 4, 25, 12, tzinfo=datetime.UTC))
|
||||||
assert forecast1 == snapshot
|
@pytest.mark.parametrize("forecast_type", ["daily", "hourly"])
|
||||||
|
async def test_forecast_subscription(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
hass_ws_client: WebSocketGenerator,
|
||||||
|
entity_registry: er.EntityRegistry,
|
||||||
|
freezer: FrozenDateTimeFactory,
|
||||||
|
snapshot: SnapshotAssertion,
|
||||||
|
no_sensor,
|
||||||
|
wavertree_data: dict[str, _Matcher],
|
||||||
|
forecast_type: str,
|
||||||
|
) -> None:
|
||||||
|
"""Test multiple forecast."""
|
||||||
|
client = await hass_ws_client(hass)
|
||||||
|
|
||||||
freezer.tick(DEFAULT_SCAN_INTERVAL + timedelta(seconds=1))
|
entry = MockConfigEntry(
|
||||||
async_fire_time_changed(hass)
|
domain=DOMAIN,
|
||||||
await hass.async_block_till_done()
|
data=METOFFICE_CONFIG_WAVERTREE,
|
||||||
msg = await client.receive_json()
|
)
|
||||||
|
entry.add_to_hass(hass)
|
||||||
|
|
||||||
assert msg["id"] == subscription_id
|
await hass.config_entries.async_setup(entry.entry_id)
|
||||||
assert msg["type"] == "event"
|
await hass.async_block_till_done()
|
||||||
forecast2 = msg["event"]["forecast"]
|
|
||||||
|
|
||||||
assert forecast2 != []
|
await client.send_json_auto_id(
|
||||||
assert forecast2 == snapshot
|
{
|
||||||
|
"type": "weather/subscribe_forecast",
|
||||||
|
"forecast_type": forecast_type,
|
||||||
|
"entity_id": "weather.met_office_wavertree_daily",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
msg = await client.receive_json()
|
||||||
|
assert msg["success"]
|
||||||
|
assert msg["result"] is None
|
||||||
|
subscription_id = msg["id"]
|
||||||
|
|
||||||
await client.send_json_auto_id(
|
msg = await client.receive_json()
|
||||||
{
|
assert msg["id"] == subscription_id
|
||||||
"type": "unsubscribe_events",
|
assert msg["type"] == "event"
|
||||||
"subscription": subscription_id,
|
forecast1 = msg["event"]["forecast"]
|
||||||
}
|
|
||||||
)
|
assert forecast1 != []
|
||||||
freezer.tick(timedelta(seconds=1))
|
assert forecast1 == snapshot
|
||||||
async_fire_time_changed(hass)
|
|
||||||
await hass.async_block_till_done()
|
freezer.tick(DEFAULT_SCAN_INTERVAL + timedelta(seconds=1))
|
||||||
msg = await client.receive_json()
|
async_fire_time_changed(hass)
|
||||||
assert msg["success"]
|
await hass.async_block_till_done()
|
||||||
|
msg = await client.receive_json()
|
||||||
|
|
||||||
|
assert msg["id"] == subscription_id
|
||||||
|
assert msg["type"] == "event"
|
||||||
|
forecast2 = msg["event"]["forecast"]
|
||||||
|
|
||||||
|
assert forecast2 != []
|
||||||
|
assert forecast2 == snapshot
|
||||||
|
|
||||||
|
await client.send_json_auto_id(
|
||||||
|
{
|
||||||
|
"type": "unsubscribe_events",
|
||||||
|
"subscription": subscription_id,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
freezer.tick(timedelta(seconds=1))
|
||||||
|
async_fire_time_changed(hass)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
msg = await client.receive_json()
|
||||||
|
assert msg["success"]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user