Use OptionsFlowWithReload in purpleair (#149095)

This commit is contained in:
G Johansson 2025-07-19 21:11:15 +02:00 committed by GitHub
parent 96766fc62a
commit d35dca377f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 9 deletions

View File

@ -20,16 +20,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: PurpleAirConfigEntry) ->
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
entry.async_on_unload(entry.add_update_listener(async_reload_entry))
return True return True
async def async_reload_entry(hass: HomeAssistant, entry: PurpleAirConfigEntry) -> None:
"""Reload config entry."""
await hass.config_entries.async_reload(entry.entry_id)
async def async_unload_entry(hass: HomeAssistant, entry: PurpleAirConfigEntry) -> bool: async def async_unload_entry(hass: HomeAssistant, entry: PurpleAirConfigEntry) -> bool:
"""Unload config entry.""" """Unload config entry."""
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS) return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)

View File

@ -17,7 +17,7 @@ from homeassistant.config_entries import (
ConfigEntry, ConfigEntry,
ConfigFlow, ConfigFlow,
ConfigFlowResult, ConfigFlowResult,
OptionsFlow, OptionsFlowWithReload,
) )
from homeassistant.const import ( from homeassistant.const import (
CONF_API_KEY, CONF_API_KEY,
@ -312,7 +312,7 @@ class PurpleAirConfigFlow(ConfigFlow, domain=DOMAIN):
return await self.async_step_by_coordinates() return await self.async_step_by_coordinates()
class PurpleAirOptionsFlowHandler(OptionsFlow): class PurpleAirOptionsFlowHandler(OptionsFlowWithReload):
"""Handle a PurpleAir options flow.""" """Handle a PurpleAir options flow."""
def __init__(self) -> None: def __init__(self) -> None: