Allow per-device removal from the integration
Some checks are pending
Validate / validate-hacs (push) Waiting to run
Some checks are pending
Validate / validate-hacs (push) Waiting to run
HA blocks "Delete device" (and the equivalent config/device_registry/remove_config_entry WS call) unless an integration implements async_remove_config_entry_device. Add the hook returning True so users can prune devices that are gone from their Samsung Find account without editing the registry by hand. A returning device with the same dvceID will be recreated on the next coordinator setup. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
4c26792c37
commit
cddc1e9d72
1 changed files with 12 additions and 0 deletions
|
|
@ -90,6 +90,18 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
)
|
)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
async def async_remove_config_entry_device(
|
||||||
|
hass: HomeAssistant, entry: ConfigEntry, device
|
||||||
|
) -> bool:
|
||||||
|
"""Allow the user to remove a device from this config entry.
|
||||||
|
|
||||||
|
Returning True unconditionally lets HA delete the device + its entities
|
||||||
|
from the registry. If the same dvceID later reappears in Samsung's
|
||||||
|
response, the next setup will recreate fresh entries for it.
|
||||||
|
"""
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Unload a config entry."""
|
"""Unload a config entry."""
|
||||||
unload_success = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
unload_success = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue