Use entry.async_on_unload in geofency (#144882)

This commit is contained in:
epenet 2025-05-14 14:30:02 +02:00 committed by GitHub
parent 3b1a33d606
commit fb9be3da79
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 1 additions and 3 deletions

View File

@ -83,7 +83,6 @@ async def async_setup(hass: HomeAssistant, hass_config: ConfigType) -> bool:
hass.data[DOMAIN] = {
"beacons": [slugify(beacon) for beacon in mobile_beacons],
"devices": set(),
"unsub_device_tracker": {},
}
return True
@ -153,7 +152,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload a config entry."""
webhook.async_unregister(hass, entry.data[CONF_WEBHOOK_ID])
hass.data[DOMAIN]["unsub_device_tracker"].pop(entry.entry_id)()
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)

View File

@ -30,7 +30,7 @@ async def async_setup_entry(
async_add_entities([GeofencyEntity(device, gps, location_name, attributes)])
hass.data[DOMAIN]["unsub_device_tracker"][config_entry.entry_id] = (
config_entry.async_on_unload(
async_dispatcher_connect(hass, TRACKER_UPDATE, _receive_data)
)