From 38acd841768d649e0fea09a0845e7dc0dc46553e Mon Sep 17 00:00:00 2001 From: Matthew McClintock Date: Sun, 19 Jul 2026 16:52:31 -0600 Subject: [PATCH 1/2] Fix UniFi setup crash on cellular/5G WAN without monitors (#176223) --- homeassistant/components/unifi/sensor.py | 2 +- tests/components/unifi/test_sensor.py | 41 ++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/unifi/sensor.py b/homeassistant/components/unifi/sensor.py index cc8e0fc234e5e..c9cd0f796905f 100644 --- a/homeassistant/components/unifi/sensor.py +++ b/homeassistant/components/unifi/sensor.py @@ -259,7 +259,7 @@ def _device_wan_latency_monitor( ) -> TypedDeviceUptimeStatsWanMonitor | None: """Return the target of the WAN latency monitor.""" if device.uptime_stats and (uptime_stats_wan := device.uptime_stats.get(wan)): - for monitor in uptime_stats_wan["monitors"]: + for monitor in uptime_stats_wan.get("monitors", []): if monitor_target in monitor["target"]: return monitor return None diff --git a/tests/components/unifi/test_sensor.py b/tests/components/unifi/test_sensor.py index 85eef64c8da07..a56b20ddb4544 100644 --- a/tests/components/unifi/test_sensor.py +++ b/tests/components/unifi/test_sensor.py @@ -1718,6 +1718,47 @@ async def test_wan_monitor_latency_with_no_uptime( assert latency_entry is None +@pytest.mark.parametrize( + "device_payload", + [ + [ + { + "board_rev": 2, + "device_id": "mock-id", + "ip": "10.0.1.1", + "mac": "10:00:00:00:01:01", + "last_seen": 1562600145, + "model": "US16P150", + "name": "mock-name", + "port_overrides": [], + # A cellular/5G WAN reports uptime stats without a "monitors" key. + "uptime_stats": { + "WAN": { + "availability": 100.0, + "latency_average": 39, + }, + }, + "state": 1, + "type": "usw", + "version": "4.0.42.10433", + } + ] + ], +) +@pytest.mark.usefixtures("config_entry_setup") +async def test_wan_monitor_latency_without_monitors_key( + hass: HomeAssistant, + entity_registry: er.EntityRegistry, +) -> None: + """Verify setup succeeds when a WAN's uptime stats omit the 'monitors' key.""" + + assert len(hass.states.async_all()) == 6 + assert len(hass.states.async_entity_ids(SENSOR_DOMAIN)) == 2 + + latency_entry = entity_registry.async_get("sensor.mock_name_google_wan_latency") + assert latency_entry is None + + @pytest.mark.parametrize( "device_payload", [ From 5865d633c6d69240bc1a6e8bcb3b066ff30ce5e3 Mon Sep 17 00:00:00 2001 From: Allen Porter Date: Sun, 19 Jul 2026 17:11:04 -0700 Subject: [PATCH 2/2] Bump ical to 14.0.1 (#176860) --- homeassistant/components/google/manifest.json | 2 +- homeassistant/components/local_calendar/manifest.json | 2 +- homeassistant/components/local_todo/manifest.json | 2 +- homeassistant/components/remote_calendar/manifest.json | 2 +- requirements_all.txt | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/google/manifest.json b/homeassistant/components/google/manifest.json index 724a2033c3bab..3a3242898ce4b 100644 --- a/homeassistant/components/google/manifest.json +++ b/homeassistant/components/google/manifest.json @@ -8,5 +8,5 @@ "integration_type": "service", "iot_class": "cloud_polling", "loggers": ["googleapiclient"], - "requirements": ["gcal-sync==9.1.0", "oauth2client==4.1.3", "ical==13.3.0"] + "requirements": ["gcal-sync==9.1.0", "oauth2client==4.1.3", "ical==14.0.1"] } diff --git a/homeassistant/components/local_calendar/manifest.json b/homeassistant/components/local_calendar/manifest.json index 1cae20632f8c9..dbb058974a86e 100644 --- a/homeassistant/components/local_calendar/manifest.json +++ b/homeassistant/components/local_calendar/manifest.json @@ -7,5 +7,5 @@ "documentation": "https://www.home-assistant.io/integrations/local_calendar", "iot_class": "local_polling", "loggers": ["ical"], - "requirements": ["ical==13.3.0"] + "requirements": ["ical==14.0.1"] } diff --git a/homeassistant/components/local_todo/manifest.json b/homeassistant/components/local_todo/manifest.json index 0fe844c12b9d1..59bbc47444f63 100644 --- a/homeassistant/components/local_todo/manifest.json +++ b/homeassistant/components/local_todo/manifest.json @@ -5,5 +5,5 @@ "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/local_todo", "iot_class": "local_polling", - "requirements": ["ical==13.3.0"] + "requirements": ["ical==14.0.1"] } diff --git a/homeassistant/components/remote_calendar/manifest.json b/homeassistant/components/remote_calendar/manifest.json index 8a90cf7f904ba..3feafc86e6f6d 100644 --- a/homeassistant/components/remote_calendar/manifest.json +++ b/homeassistant/components/remote_calendar/manifest.json @@ -8,5 +8,5 @@ "iot_class": "cloud_polling", "loggers": ["ical"], "quality_scale": "silver", - "requirements": ["ical==13.3.0"] + "requirements": ["ical==14.0.1"] } diff --git a/requirements_all.txt b/requirements_all.txt index 76609c5364aed..6904551eac9d8 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1329,7 +1329,7 @@ ibeacon-ble==1.2.0 # homeassistant.components.local_calendar # homeassistant.components.local_todo # homeassistant.components.remote_calendar -ical==13.3.0 +ical==14.0.1 # homeassistant.components.caldav icalendar==6.3.1