diff --git a/custom_components/hiper_drift/__init__.py b/custom_components/hiper_drift/__init__.py index 68ef955..532ef37 100644 --- a/custom_components/hiper_drift/__init__.py +++ b/custom_components/hiper_drift/__init__.py @@ -9,16 +9,7 @@ from homeassistant.helpers.update_coordinator import DataUpdateCoordinator from .component_api import ComponentApi -from .const import ( - CONF_CITY, - CONF_CITY_CHECK, - CONF_GENERAL_MSG, - CONF_REGION, - CONF_STREET, - CONF_STREET_CHECK, - DOMAIN, - LOGGER, -) +from .const import DOMAIN, LOGGER PLATFORMS: list[Platform] = [Platform.BINARY_SENSOR, Platform.SENSOR] @@ -40,12 +31,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: coordinator, entry, async_get_clientsession(hass), - entry.options[CONF_REGION], - entry.options[CONF_GENERAL_MSG], - entry.options[CONF_CITY_CHECK], - entry.options[CONF_CITY], - entry.options[CONF_STREET_CHECK], - entry.options[CONF_STREET], ) entry.async_on_unload(entry.add_update_listener(update_listener)) @@ -85,9 +70,4 @@ async def update_listener( ) -> None: """Reload on config entry update.""" - component_api: ComponentApi = hass.data[DOMAIN][config_entry.entry_id][ - "component_api" - ] - await hass.config_entries.async_reload(config_entry.entry_id) - await component_api.async_update() diff --git a/custom_components/hiper_drift/component_api.py b/custom_components/hiper_drift/component_api.py index 92e581a..4556f1f 100644 --- a/custom_components/hiper_drift/component_api.py +++ b/custom_components/hiper_drift/component_api.py @@ -13,7 +13,19 @@ from homeassistant.core import HomeAssistant, ServiceCall from homeassistant.helpers.update_coordinator import DataUpdateCoordinator -from .const import CONF_CONTENT, CONF_FYN_REGION, CONF_MSG, CONF_SJ_BH_REGION, DOMAIN +from .const import ( + CONF_CITY, + CONF_CITY_CHECK, + CONF_CONTENT, + CONF_FYN_REGION, + CONF_GENERAL_MSG, + CONF_MSG, + CONF_REGION, + CONF_SJ_BH_REGION, + CONF_STREET, + CONF_STREET_CHECK, + DOMAIN, +) # ------------------------------------------------------------------ @@ -28,12 +40,6 @@ def __init__( coordinator: DataUpdateCoordinator, entry: ConfigEntry, session: ClientSession | None, - region: str, - general_msg: bool, - city_check: bool, - city: str, - street_check: bool, - street: str, ) -> None: """Hiper api.""" @@ -41,12 +47,13 @@ def __init__( self.coordinator: DataUpdateCoordinator = coordinator self.entry: ConfigEntry = entry self.session: ClientSession | None = session - self.region: str = region - self.general_msg: bool = general_msg - self.city_check: bool = city_check - self.city: str = city - self.street_check: bool = street_check - self.street: str = street + + self.region: str = entry.options[CONF_REGION] + self.general_msg: bool = entry.options[CONF_GENERAL_MSG] + self.city_check: bool = entry.options[CONF_CITY_CHECK] + self.city: str = entry.options[CONF_CITY] + self.street_check: bool = entry.options[CONF_STREET_CHECK] + self.street: str = entry.options[CONF_STREET] self.request_timeout: int = 10 self.close_session: bool = False diff --git a/custom_components/hiper_drift/manifest.json b/custom_components/hiper_drift/manifest.json index c645bba..d5638c9 100644 --- a/custom_components/hiper_drift/manifest.json +++ b/custom_components/hiper_drift/manifest.json @@ -16,6 +16,6 @@ ], "single_config_entry": true, "ssdp": [], - "version": "1.0.19", + "version": "1.0.20", "zeroconf": [] } \ No newline at end of file