From 253322c22cf800fa8bd582f139e4723520c6ea07 Mon Sep 17 00:00:00 2001 From: Alexey Khit Date: Mon, 8 Apr 2024 15:29:26 +0300 Subject: [PATCH] Fix integration reload --- custom_components/gyverlamp/__init__.py | 5 ++--- custom_components/gyverlamp/light.py | 5 ----- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/custom_components/gyverlamp/__init__.py b/custom_components/gyverlamp/__init__.py index d84a71f..64467dd 100644 --- a/custom_components/gyverlamp/__init__.py +++ b/custom_components/gyverlamp/__init__.py @@ -25,9 +25,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): return True -async def async_update_options(hass: HomeAssistant, entry: ConfigEntry): - # update entity config - hass.data[DOMAIN][entry.entry_id].update_config(entry.options) +async def async_update_options(hass: HomeAssistant, config_entry: ConfigEntry): + await hass.config_entries.async_reload(config_entry.entry_id) async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry): diff --git a/custom_components/gyverlamp/light.py b/custom_components/gyverlamp/light.py index 6aa62c0..c1e6471 100644 --- a/custom_components/gyverlamp/light.py +++ b/custom_components/gyverlamp/light.py @@ -63,11 +63,6 @@ async def async_setup_entry( hass.data[DOMAIN][entry.entry_id] = entity -async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry): - hass.data[DOMAIN].pop(entry.entry_id) - return True - - class GyverLamp(LightEntity): def __init__(self, config: dict, unique_id=None): self._attr_effect_list = config.get(CONF_EFFECTS, EFFECTS)