Skip to content

Commit 33b6c18

Browse files
committed
async improvements
1 parent 6275994 commit 33b6c18

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

custom_components/plugwise/coordinator.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,21 +117,21 @@ async def _async_update_data(self) -> PlugwiseData:
117117
raise ConfigEntryError("Device with unsupported firmware") from err
118118
else:
119119
LOGGER.debug(f"{self.api.smile_name} data: %s", data)
120-
self._async_add_remove_devices(data, self.config_entry)
120+
await self.async_add_remove_devices(data, self.config_entry)
121121

122122
return data
123123

124-
def _async_add_remove_devices(self, data: PlugwiseData, entry: ConfigEntry) -> None:
124+
async def async_add_remove_devices(self, data: PlugwiseData, entry: ConfigEntry) -> None:
125125
"""Add new Plugwise devices, remove non-existing devices."""
126126
# Check for new or removed devices
127127
self.new_devices = set(data.devices) - self._current_devices
128128
removed_devices = self._current_devices - set(data.devices)
129129
self._current_devices = set(data.devices)
130130

131131
if removed_devices:
132-
self._async_remove_devices(data, entry)
132+
await self.async_remove_devices(data, entry)
133133

134-
def _async_remove_devices(self, data: PlugwiseData, entry: ConfigEntry) -> None:
134+
async def async_remove_devices(self, data: PlugwiseData, entry: ConfigEntry) -> None:
135135
"""Clean registries when removed devices found."""
136136
device_reg = dr.async_get(self.hass)
137137
device_list = dr.async_entries_for_config_entry(

0 commit comments

Comments
 (0)