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

Vesync unload error when not all platforms used #134166

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
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
13 changes: 12 additions & 1 deletion homeassistant/components/vesync/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,18 @@ async def async_new_device_discovery(service: ServiceCall) -> None:

async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload a config entry."""
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
in_use_platforms = []
if hass.data[DOMAIN][VS_SWITCHES]:
in_use_platforms.append(Platform.SWITCH)
if hass.data[DOMAIN][VS_FANS]:
in_use_platforms.append(Platform.FAN)
if hass.data[DOMAIN][VS_LIGHTS]:
in_use_platforms.append(Platform.LIGHT)
if hass.data[DOMAIN][VS_SENSORS]:
in_use_platforms.append(Platform.SENSOR)
unload_ok = await hass.config_entries.async_unload_platforms(
entry, in_use_platforms
)
if unload_ok:
hass.data.pop(DOMAIN)

Expand Down