Correct memory leak for rfxtrx lighting4 devices (#85354)

This commit is contained in:
Joakim Plate 2023-01-07 10:52:05 +01:00 committed by GitHub
parent 757e4cf9e1
commit dfca3c2448
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -169,7 +169,7 @@ async def async_setup_internal(hass: HomeAssistant, entry: ConfigEntry) -> None:
# Setup some per device config
devices = _get_device_lookup(config[CONF_DEVICES])
pt2262_devices: list[str] = []
pt2262_devices: set[str] = set()
device_registry = dr.async_get(hass)
@ -203,7 +203,7 @@ async def async_setup_internal(hass: HomeAssistant, entry: ConfigEntry) -> None:
if event.device.packettype == DEVICE_PACKET_TYPE_LIGHTING4:
find_possible_pt2262_device(pt2262_devices, event.device.id_string)
pt2262_devices.append(event.device.id_string)
pt2262_devices.add(event.device.id_string)
device_entry = device_registry.async_get_device(
identifiers={(DOMAIN, *device_id)}, # type: ignore[arg-type]
@ -393,7 +393,7 @@ def get_device_data_bits(
return data_bits
def find_possible_pt2262_device(device_ids: list[str], device_id: str) -> str | None:
def find_possible_pt2262_device(device_ids: set[str], device_id: str) -> str | None:
"""Look for the device which id matches the given device_id parameter."""
for dev_id in device_ids:
if len(dev_id) == len(device_id):