Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow removal of myuplink device from GUI #117009

Merged
merged 2 commits into from
Jun 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions homeassistant/components/myuplink/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
config_entry_oauth2_flow,
device_registry as dr,
)
from homeassistant.helpers.device_registry import DeviceEntry

from .api import AsyncConfigEntryAuth
from .const import DOMAIN, OAUTH2_SCOPES
Expand Down Expand Up @@ -96,3 +97,14 @@ def create_devices(
sw_version=device.firmwareCurrent,
serial_number=device.product_serial_number,
)


async def async_remove_config_entry_device(
hass: HomeAssistant, config_entry: ConfigEntry, device_entry: DeviceEntry
) -> bool:
"""Remove myuplink config entry from a device."""

myuplink_data: MyUplinkDataCoordinator = hass.data[DOMAIN][config_entry.entry_id]
return not device_entry.identifiers.intersection(
(DOMAIN, device_id) for device_id in myuplink_data.data.devices
)