@@ -126,24 +126,20 @@ async def _async_update_data(self) -> dict[str, GwEntityData]:
126
126
) from err
127
127
128
128
LOGGER .debug (f"{ self .api .smile_name } data: %s" , data )
129
- await self ._async_add_remove_devices (data , self . config_entry )
129
+ await self ._async_add_remove_devices (data )
130
130
return data
131
131
132
- async def _async_add_remove_devices (
133
- self , data : dict [str , GwEntityData ], entry : ConfigEntry
134
- ) -> None :
132
+ async def _async_add_remove_devices (self , data : dict [str , GwEntityData ]) -> None :
135
133
"""Add new Plugwise devices, remove non-existing devices."""
136
134
# Check for new or removed devices
137
135
self .new_devices = set (data ) - self ._current_devices
138
136
removed_devices = self ._current_devices - set (data )
139
137
self ._current_devices = set (data )
140
138
141
139
if removed_devices :
142
- await self ._async_remove_devices (data , entry )
140
+ await self ._async_remove_devices (data )
143
141
144
- async def _async_remove_devices (
145
- self , data : dict [str , GwEntityData ], entry : ConfigEntry
146
- ) -> None :
142
+ async def _async_remove_devices (self , data : dict [str , GwEntityData ]) -> None :
147
143
"""Clean registries when removed devices found."""
148
144
device_reg = dr .async_get (self .hass )
149
145
device_list = dr .async_entries_for_config_entry (
@@ -164,7 +160,7 @@ async def _async_remove_devices(
164
160
and identifier [1 ] not in data
165
161
):
166
162
device_reg .async_update_device (
167
- device_entry .id , remove_config_entry_id = entry .entry_id
163
+ device_entry .id , remove_config_entry_id = self . config_entry .entry_id
168
164
)
169
165
LOGGER .debug (
170
166
"Removed %s device/zone %s %s from device_registry" ,
0 commit comments