diff --git a/homeassistant/components/huawei_lte/__init__.py b/homeassistant/components/huawei_lte/__init__.py index f21f084a544..929ca0193af 100644 --- a/homeassistant/components/huawei_lte/__init__.py +++ b/homeassistant/components/huawei_lte/__init__.py @@ -143,9 +143,11 @@ class Router: url: str data: dict[str, Any] = field(default_factory=dict, init=False) - subscriptions: dict[str, set[str]] = field( + # Values are lists rather than sets, because the same item may be used by more than + # one thing, such as MonthDuration for CurrentMonth{Download,Upload}. + subscriptions: dict[str, list[str]] = field( default_factory=lambda: defaultdict( - set, ((x, {"initial_scan"}) for x in ALL_KEYS) + list, ((x, ["initial_scan"]) for x in ALL_KEYS) ), init=False, ) diff --git a/homeassistant/components/huawei_lte/binary_sensor.py b/homeassistant/components/huawei_lte/binary_sensor.py index a1a26b51657..2d96a4e0426 100644 --- a/homeassistant/components/huawei_lte/binary_sensor.py +++ b/homeassistant/components/huawei_lte/binary_sensor.py @@ -65,7 +65,9 @@ class HuaweiLteBaseBinarySensor(HuaweiLteBaseEntityWithDevice, BinarySensorEntit async def async_added_to_hass(self) -> None: """Subscribe to needed data on add.""" await super().async_added_to_hass() - self.router.subscriptions[self.key].add(f"{BINARY_SENSOR_DOMAIN}/{self.item}") + self.router.subscriptions[self.key].append( + f"{BINARY_SENSOR_DOMAIN}/{self.item}" + ) async def async_will_remove_from_hass(self) -> None: """Unsubscribe from needed data on remove.""" diff --git a/homeassistant/components/huawei_lte/device_tracker.py b/homeassistant/components/huawei_lte/device_tracker.py index b8833b24d92..665c96e4888 100644 --- a/homeassistant/components/huawei_lte/device_tracker.py +++ b/homeassistant/components/huawei_lte/device_tracker.py @@ -90,8 +90,8 @@ async def async_setup_entry( async_add_entities(known_entities, True) # Tell parent router to poll hosts list to gather new devices - router.subscriptions[KEY_LAN_HOST_INFO].add(_DEVICE_SCAN) - router.subscriptions[KEY_WLAN_HOST_LIST].add(_DEVICE_SCAN) + router.subscriptions[KEY_LAN_HOST_INFO].append(_DEVICE_SCAN) + router.subscriptions[KEY_WLAN_HOST_LIST].append(_DEVICE_SCAN) async def _async_maybe_add_new_entities(unique_id: str) -> None: """Add new entities if the update signal comes from our router.""" diff --git a/homeassistant/components/huawei_lte/sensor.py b/homeassistant/components/huawei_lte/sensor.py index 133b569c751..a4321bfd93f 100644 --- a/homeassistant/components/huawei_lte/sensor.py +++ b/homeassistant/components/huawei_lte/sensor.py @@ -724,9 +724,9 @@ class HuaweiLteSensor(HuaweiLteBaseEntityWithDevice, SensorEntity): async def async_added_to_hass(self) -> None: """Subscribe to needed data on add.""" await super().async_added_to_hass() - self.router.subscriptions[self.key].add(f"{SENSOR_DOMAIN}/{self.item}") + self.router.subscriptions[self.key].append(f"{SENSOR_DOMAIN}/{self.item}") if self.entity_description.last_reset_item: - self.router.subscriptions[self.key].add( + self.router.subscriptions[self.key].append( f"{SENSOR_DOMAIN}/{self.entity_description.last_reset_item}" ) diff --git a/homeassistant/components/huawei_lte/switch.py b/homeassistant/components/huawei_lte/switch.py index 2fe064d6300..f75cf14e89b 100644 --- a/homeassistant/components/huawei_lte/switch.py +++ b/homeassistant/components/huawei_lte/switch.py @@ -69,7 +69,7 @@ class HuaweiLteBaseSwitch(HuaweiLteBaseEntityWithDevice, SwitchEntity): async def async_added_to_hass(self) -> None: """Subscribe to needed data on add.""" await super().async_added_to_hass() - self.router.subscriptions[self.key].add(f"{SWITCH_DOMAIN}/{self.item}") + self.router.subscriptions[self.key].append(f"{SWITCH_DOMAIN}/{self.item}") async def async_will_remove_from_hass(self) -> None: """Unsubscribe from needed data on remove."""