mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 22:27:07 +00:00
Merge branch 'dev' into reorder-group-member
This commit is contained in:
commit
b1becfb105
@ -6,6 +6,7 @@
|
|||||||
"documentation": "https://www.home-assistant.io/integrations/airgradient",
|
"documentation": "https://www.home-assistant.io/integrations/airgradient",
|
||||||
"integration_type": "device",
|
"integration_type": "device",
|
||||||
"iot_class": "local_polling",
|
"iot_class": "local_polling",
|
||||||
|
"quality_scale": "platinum",
|
||||||
"requirements": ["airgradient==0.9.2"],
|
"requirements": ["airgradient==0.9.2"],
|
||||||
"zeroconf": ["_airgradient._tcp.local."]
|
"zeroconf": ["_airgradient._tcp.local."]
|
||||||
}
|
}
|
||||||
|
@ -14,9 +14,9 @@ rules:
|
|||||||
status: exempt
|
status: exempt
|
||||||
comment: |
|
comment: |
|
||||||
This integration does not provide additional actions.
|
This integration does not provide additional actions.
|
||||||
docs-high-level-description: todo
|
docs-high-level-description: done
|
||||||
docs-installation-instructions: todo
|
docs-installation-instructions: done
|
||||||
docs-removal-instructions: todo
|
docs-removal-instructions: done
|
||||||
entity-event-setup:
|
entity-event-setup:
|
||||||
status: exempt
|
status: exempt
|
||||||
comment: |
|
comment: |
|
||||||
@ -34,7 +34,7 @@ rules:
|
|||||||
docs-configuration-parameters:
|
docs-configuration-parameters:
|
||||||
status: exempt
|
status: exempt
|
||||||
comment: No options to configure
|
comment: No options to configure
|
||||||
docs-installation-parameters: todo
|
docs-installation-parameters: done
|
||||||
entity-unavailable: done
|
entity-unavailable: done
|
||||||
integration-owner: done
|
integration-owner: done
|
||||||
log-when-unavailable: done
|
log-when-unavailable: done
|
||||||
@ -43,23 +43,19 @@ rules:
|
|||||||
status: exempt
|
status: exempt
|
||||||
comment: |
|
comment: |
|
||||||
This integration does not require authentication.
|
This integration does not require authentication.
|
||||||
test-coverage: todo
|
test-coverage: done
|
||||||
# Gold
|
# Gold
|
||||||
devices: done
|
devices: done
|
||||||
diagnostics: done
|
diagnostics: done
|
||||||
discovery-update-info:
|
discovery-update-info: done
|
||||||
status: todo
|
discovery: done
|
||||||
comment: DHCP is still possible
|
docs-data-update: done
|
||||||
discovery:
|
docs-examples: done
|
||||||
status: todo
|
docs-known-limitations: done
|
||||||
comment: DHCP is still possible
|
docs-supported-devices: done
|
||||||
docs-data-update: todo
|
docs-supported-functions: done
|
||||||
docs-examples: todo
|
docs-troubleshooting: done
|
||||||
docs-known-limitations: todo
|
docs-use-cases: done
|
||||||
docs-supported-devices: todo
|
|
||||||
docs-supported-functions: todo
|
|
||||||
docs-troubleshooting: todo
|
|
||||||
docs-use-cases: todo
|
|
||||||
dynamic-devices:
|
dynamic-devices:
|
||||||
status: exempt
|
status: exempt
|
||||||
comment: |
|
comment: |
|
||||||
|
@ -45,9 +45,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: AirNowConfigEntry) -> bo
|
|||||||
# Store Entity and Initialize Platforms
|
# Store Entity and Initialize Platforms
|
||||||
entry.runtime_data = coordinator
|
entry.runtime_data = coordinator
|
||||||
|
|
||||||
# Listen for option changes
|
|
||||||
entry.async_on_unload(entry.add_update_listener(update_listener))
|
|
||||||
|
|
||||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||||
|
|
||||||
# Clean up unused device entries with no entities
|
# Clean up unused device entries with no entities
|
||||||
@ -88,8 +85,3 @@ async def async_migrate_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
async def async_unload_entry(hass: HomeAssistant, entry: AirNowConfigEntry) -> bool:
|
async def async_unload_entry(hass: HomeAssistant, entry: AirNowConfigEntry) -> bool:
|
||||||
"""Unload a config entry."""
|
"""Unload a config entry."""
|
||||||
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||||
|
|
||||||
|
|
||||||
async def update_listener(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
|
||||||
"""Handle options update."""
|
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
|
@ -13,7 +13,7 @@ from homeassistant.config_entries import (
|
|||||||
ConfigEntry,
|
ConfigEntry,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
OptionsFlow,
|
OptionsFlowWithReload,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_API_KEY, CONF_LATITUDE, CONF_LONGITUDE, CONF_RADIUS
|
from homeassistant.const import CONF_API_KEY, CONF_LATITUDE, CONF_LONGITUDE, CONF_RADIUS
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
@ -126,7 +126,7 @@ class AirNowConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
return AirNowOptionsFlowHandler()
|
return AirNowOptionsFlowHandler()
|
||||||
|
|
||||||
|
|
||||||
class AirNowOptionsFlowHandler(OptionsFlow):
|
class AirNowOptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Handle an options flow for AirNow."""
|
"""Handle an options flow for AirNow."""
|
||||||
|
|
||||||
async def async_step_init(
|
async def async_step_init(
|
||||||
|
@ -55,7 +55,6 @@ async def async_setup_entry(
|
|||||||
entry.runtime_data = AnalyticsInsightsData(coordinator=coordinator, names=names)
|
entry.runtime_data = AnalyticsInsightsData(coordinator=coordinator, names=names)
|
||||||
|
|
||||||
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(update_listener))
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -65,10 +64,3 @@ async def async_unload_entry(
|
|||||||
) -> bool:
|
) -> bool:
|
||||||
"""Unload a config entry."""
|
"""Unload a config entry."""
|
||||||
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||||
|
|
||||||
|
|
||||||
async def update_listener(
|
|
||||||
hass: HomeAssistant, entry: AnalyticsInsightsConfigEntry
|
|
||||||
) -> None:
|
|
||||||
"""Handle options update."""
|
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
|
@ -11,7 +11,11 @@ from python_homeassistant_analytics import (
|
|||||||
from python_homeassistant_analytics.models import Environment, IntegrationType
|
from python_homeassistant_analytics.models import Environment, IntegrationType
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult, OptionsFlow
|
from homeassistant.config_entries import (
|
||||||
|
ConfigFlow,
|
||||||
|
ConfigFlowResult,
|
||||||
|
OptionsFlowWithReload,
|
||||||
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
from homeassistant.helpers.selector import (
|
from homeassistant.helpers.selector import (
|
||||||
@ -129,7 +133,7 @@ class HomeassistantAnalyticsConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class HomeassistantAnalyticsOptionsFlowHandler(OptionsFlow):
|
class HomeassistantAnalyticsOptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Handle Homeassistant Analytics options."""
|
"""Handle Homeassistant Analytics options."""
|
||||||
|
|
||||||
async def async_step_init(
|
async def async_step_init(
|
||||||
|
@ -68,7 +68,6 @@ async def async_setup_entry(
|
|||||||
entry.async_on_unload(
|
entry.async_on_unload(
|
||||||
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, on_hass_stop)
|
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, on_hass_stop)
|
||||||
)
|
)
|
||||||
entry.async_on_unload(entry.add_update_listener(async_update_options))
|
|
||||||
entry.async_on_unload(api.disconnect)
|
entry.async_on_unload(api.disconnect)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
@ -80,13 +79,3 @@ async def async_unload_entry(
|
|||||||
"""Unload a config entry."""
|
"""Unload a config entry."""
|
||||||
_LOGGER.debug("async_unload_entry: %s", entry.data)
|
_LOGGER.debug("async_unload_entry: %s", entry.data)
|
||||||
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||||
|
|
||||||
|
|
||||||
async def async_update_options(
|
|
||||||
hass: HomeAssistant, entry: AndroidTVRemoteConfigEntry
|
|
||||||
) -> None:
|
|
||||||
"""Handle options update."""
|
|
||||||
_LOGGER.debug(
|
|
||||||
"async_update_options: data: %s options: %s", entry.data, entry.options
|
|
||||||
)
|
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
|
@ -19,7 +19,7 @@ from homeassistant.config_entries import (
|
|||||||
SOURCE_RECONFIGURE,
|
SOURCE_RECONFIGURE,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
OptionsFlow,
|
OptionsFlowWithReload,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_HOST, CONF_MAC, CONF_NAME
|
from homeassistant.const import CONF_HOST, CONF_MAC, CONF_NAME
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
@ -116,10 +116,10 @@ class AndroidTVRemoteConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
pin = user_input["pin"]
|
pin = user_input["pin"]
|
||||||
await self.api.async_finish_pairing(pin)
|
await self.api.async_finish_pairing(pin)
|
||||||
if self.source == SOURCE_REAUTH:
|
if self.source == SOURCE_REAUTH:
|
||||||
await self.hass.config_entries.async_reload(
|
return self.async_update_reload_and_abort(
|
||||||
self._get_reauth_entry().entry_id
|
self._get_reauth_entry(), reload_even_if_entry_is_unchanged=True
|
||||||
)
|
)
|
||||||
return self.async_abort(reason="reauth_successful")
|
|
||||||
return self.async_create_entry(
|
return self.async_create_entry(
|
||||||
title=self.name,
|
title=self.name,
|
||||||
data={
|
data={
|
||||||
@ -243,7 +243,7 @@ class AndroidTVRemoteConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
return AndroidTVRemoteOptionsFlowHandler(config_entry)
|
return AndroidTVRemoteOptionsFlowHandler(config_entry)
|
||||||
|
|
||||||
|
|
||||||
class AndroidTVRemoteOptionsFlowHandler(OptionsFlow):
|
class AndroidTVRemoteOptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Android TV Remote options flow."""
|
"""Android TV Remote options flow."""
|
||||||
|
|
||||||
def __init__(self, config_entry: AndroidTVRemoteConfigEntry) -> None:
|
def __init__(self, config_entry: AndroidTVRemoteConfigEntry) -> None:
|
||||||
|
1
homeassistant/components/bauknecht/__init__.py
Normal file
1
homeassistant/components/bauknecht/__init__.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
"""Bauknecht virtual integration."""
|
6
homeassistant/components/bauknecht/manifest.json
Normal file
6
homeassistant/components/bauknecht/manifest.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"domain": "bauknecht",
|
||||||
|
"name": "Bauknecht",
|
||||||
|
"integration_type": "virtual",
|
||||||
|
"supported_by": "whirlpool"
|
||||||
|
}
|
@ -54,16 +54,20 @@ class Control4RuntimeData:
|
|||||||
type Control4ConfigEntry = ConfigEntry[Control4RuntimeData]
|
type Control4ConfigEntry = ConfigEntry[Control4RuntimeData]
|
||||||
|
|
||||||
|
|
||||||
async def call_c4_api_retry(func, *func_args): # noqa: RET503
|
async def call_c4_api_retry(func, *func_args):
|
||||||
"""Call C4 API function and retry on failure."""
|
"""Call C4 API function and retry on failure."""
|
||||||
# Ruff doesn't understand this loop - the exception is always raised after the retries
|
exc = None
|
||||||
for i in range(API_RETRY_TIMES):
|
for i in range(API_RETRY_TIMES):
|
||||||
try:
|
try:
|
||||||
return await func(*func_args)
|
return await func(*func_args)
|
||||||
except client_exceptions.ClientError as exception:
|
except client_exceptions.ClientError as exception:
|
||||||
_LOGGER.error("Error connecting to Control4 account API: %s", exception)
|
_LOGGER.error(
|
||||||
if i == API_RETRY_TIMES - 1:
|
"Try: %d, Error connecting to Control4 account API: %s",
|
||||||
raise ConfigEntryNotReady(exception) from exception
|
i + 1,
|
||||||
|
exception,
|
||||||
|
)
|
||||||
|
exc = exception
|
||||||
|
raise ConfigEntryNotReady(exc) from exc
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistant, entry: Control4ConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistant, entry: Control4ConfigEntry) -> bool:
|
||||||
@ -141,21 +145,11 @@ async def async_setup_entry(hass: HomeAssistant, entry: Control4ConfigEntry) ->
|
|||||||
ui_configuration=ui_configuration,
|
ui_configuration=ui_configuration,
|
||||||
)
|
)
|
||||||
|
|
||||||
entry.async_on_unload(entry.add_update_listener(update_listener))
|
|
||||||
|
|
||||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def update_listener(
|
|
||||||
hass: HomeAssistant, config_entry: Control4ConfigEntry
|
|
||||||
) -> None:
|
|
||||||
"""Update when config_entry options update."""
|
|
||||||
_LOGGER.debug("Config entry was updated, rerunning setup")
|
|
||||||
await hass.config_entries.async_reload(config_entry.entry_id)
|
|
||||||
|
|
||||||
|
|
||||||
async def async_unload_entry(hass: HomeAssistant, entry: Control4ConfigEntry) -> bool:
|
async def async_unload_entry(hass: HomeAssistant, entry: Control4ConfigEntry) -> bool:
|
||||||
"""Unload a config entry."""
|
"""Unload a config entry."""
|
||||||
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||||
|
@ -11,7 +11,11 @@ from pyControl4.director import C4Director
|
|||||||
from pyControl4.error_handling import NotFound, Unauthorized
|
from pyControl4.error_handling import NotFound, Unauthorized
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult, OptionsFlow
|
from homeassistant.config_entries import (
|
||||||
|
ConfigFlow,
|
||||||
|
ConfigFlowResult,
|
||||||
|
OptionsFlowWithReload,
|
||||||
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
CONF_PASSWORD,
|
CONF_PASSWORD,
|
||||||
@ -153,7 +157,7 @@ class Control4ConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
return OptionsFlowHandler()
|
return OptionsFlowHandler()
|
||||||
|
|
||||||
|
|
||||||
class OptionsFlowHandler(OptionsFlow):
|
class OptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Handle a option flow for Control4."""
|
"""Handle a option flow for Control4."""
|
||||||
|
|
||||||
async def async_step_init(
|
async def async_step_init(
|
||||||
|
@ -53,8 +53,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: DenonavrConfigEntry) ->
|
|||||||
raise ConfigEntryNotReady from ex
|
raise ConfigEntryNotReady from ex
|
||||||
receiver = connect_denonavr.receiver
|
receiver = connect_denonavr.receiver
|
||||||
|
|
||||||
entry.async_on_unload(entry.add_update_listener(update_listener))
|
|
||||||
|
|
||||||
entry.runtime_data = receiver
|
entry.runtime_data = receiver
|
||||||
|
|
||||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||||
@ -100,10 +98,3 @@ async def async_unload_entry(
|
|||||||
_LOGGER.debug("Removing zone3 from DenonAvr")
|
_LOGGER.debug("Removing zone3 from DenonAvr")
|
||||||
|
|
||||||
return unload_ok
|
return unload_ok
|
||||||
|
|
||||||
|
|
||||||
async def update_listener(
|
|
||||||
hass: HomeAssistant, config_entry: DenonavrConfigEntry
|
|
||||||
) -> None:
|
|
||||||
"""Handle options update."""
|
|
||||||
await hass.config_entries.async_reload(config_entry.entry_id)
|
|
||||||
|
@ -10,7 +10,11 @@ import denonavr
|
|||||||
from denonavr.exceptions import AvrNetworkError, AvrTimoutError
|
from denonavr.exceptions import AvrNetworkError, AvrTimoutError
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult, OptionsFlow
|
from homeassistant.config_entries import (
|
||||||
|
ConfigFlow,
|
||||||
|
ConfigFlowResult,
|
||||||
|
OptionsFlowWithReload,
|
||||||
|
)
|
||||||
from homeassistant.const import CONF_HOST, CONF_MODEL, CONF_TYPE
|
from homeassistant.const import CONF_HOST, CONF_MODEL, CONF_TYPE
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.helpers.httpx_client import get_async_client
|
from homeassistant.helpers.httpx_client import get_async_client
|
||||||
@ -51,7 +55,7 @@ DEFAULT_USE_TELNET_NEW_INSTALL = True
|
|||||||
CONFIG_SCHEMA = vol.Schema({vol.Optional(CONF_HOST): str})
|
CONFIG_SCHEMA = vol.Schema({vol.Optional(CONF_HOST): str})
|
||||||
|
|
||||||
|
|
||||||
class OptionsFlowHandler(OptionsFlow):
|
class OptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Options for the component."""
|
"""Options for the component."""
|
||||||
|
|
||||||
async def async_step_init(
|
async def async_step_init(
|
||||||
|
@ -13,15 +13,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
"""Set up DNS IP from a config entry."""
|
"""Set up DNS IP from a config entry."""
|
||||||
|
|
||||||
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(update_listener))
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def update_listener(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
|
||||||
"""Handle options update."""
|
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
|
|
||||||
|
|
||||||
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Unload dnsip config entry."""
|
"""Unload dnsip config entry."""
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ from homeassistant.config_entries import (
|
|||||||
ConfigEntry,
|
ConfigEntry,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
OptionsFlow,
|
OptionsFlowWithReload,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_NAME, CONF_PORT
|
from homeassistant.const import CONF_NAME, CONF_PORT
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
@ -165,7 +165,7 @@ class DnsIPConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class DnsIPOptionsFlowHandler(OptionsFlow):
|
class DnsIPOptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Handle a option config flow for dnsip integration."""
|
"""Handle a option config flow for dnsip integration."""
|
||||||
|
|
||||||
async def async_step_init(
|
async def async_step_init(
|
||||||
|
@ -69,16 +69,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: EmonCMSConfigEntry) -> b
|
|||||||
await coordinator.async_config_entry_first_refresh()
|
await coordinator.async_config_entry_first_refresh()
|
||||||
entry.runtime_data = coordinator
|
entry.runtime_data = coordinator
|
||||||
|
|
||||||
entry.async_on_unload(entry.add_update_listener(update_listener))
|
|
||||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def update_listener(hass: HomeAssistant, entry: EmonCMSConfigEntry):
|
|
||||||
"""Handle options update."""
|
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
|
|
||||||
|
|
||||||
async def async_unload_entry(hass: HomeAssistant, entry: EmonCMSConfigEntry) -> bool:
|
async def async_unload_entry(hass: HomeAssistant, entry: EmonCMSConfigEntry) -> bool:
|
||||||
"""Unload a config entry."""
|
"""Unload a config entry."""
|
||||||
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||||
|
@ -11,7 +11,7 @@ from homeassistant.config_entries import (
|
|||||||
ConfigEntry,
|
ConfigEntry,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
OptionsFlow,
|
OptionsFlowWithReload,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_API_KEY, CONF_URL
|
from homeassistant.const import CONF_API_KEY, CONF_URL
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
@ -221,7 +221,7 @@ class EmoncmsConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class EmoncmsOptionsFlow(OptionsFlow):
|
class EmoncmsOptionsFlow(OptionsFlowWithReload):
|
||||||
"""Emoncms Options flow handler."""
|
"""Emoncms Options flow handler."""
|
||||||
|
|
||||||
def __init__(self, config_entry: ConfigEntry) -> None:
|
def __init__(self, config_entry: ConfigEntry) -> None:
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
"mqtt": ["esphome/discover/#"],
|
"mqtt": ["esphome/discover/#"],
|
||||||
"quality_scale": "platinum",
|
"quality_scale": "platinum",
|
||||||
"requirements": [
|
"requirements": [
|
||||||
"aioesphomeapi==36.0.1",
|
"aioesphomeapi==37.0.2",
|
||||||
"esphome-dashboard-api==1.3.0",
|
"esphome-dashboard-api==1.3.0",
|
||||||
"bleak-esphome==3.1.0"
|
"bleak-esphome==3.1.0"
|
||||||
],
|
],
|
||||||
|
@ -32,8 +32,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: FeedReaderConfigEntry) -
|
|||||||
|
|
||||||
await coordinator.async_config_entry_first_refresh()
|
await coordinator.async_config_entry_first_refresh()
|
||||||
|
|
||||||
entry.async_on_unload(entry.add_update_listener(_async_update_listener))
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
@ -46,10 +44,3 @@ async def async_unload_entry(hass: HomeAssistant, entry: FeedReaderConfigEntry)
|
|||||||
if len(entries) == 1:
|
if len(entries) == 1:
|
||||||
hass.data.pop(MY_KEY)
|
hass.data.pop(MY_KEY)
|
||||||
return await hass.config_entries.async_unload_platforms(entry, [Platform.EVENT])
|
return await hass.config_entries.async_unload_platforms(entry, [Platform.EVENT])
|
||||||
|
|
||||||
|
|
||||||
async def _async_update_listener(
|
|
||||||
hass: HomeAssistant, entry: FeedReaderConfigEntry
|
|
||||||
) -> None:
|
|
||||||
"""Handle reconfiguration."""
|
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
|
@ -14,7 +14,7 @@ from homeassistant.config_entries import (
|
|||||||
ConfigEntry,
|
ConfigEntry,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
OptionsFlow,
|
OptionsFlowWithReload,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_URL
|
from homeassistant.const import CONF_URL
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
@ -44,7 +44,7 @@ class FeedReaderConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
@callback
|
@callback
|
||||||
def async_get_options_flow(
|
def async_get_options_flow(
|
||||||
config_entry: ConfigEntry,
|
config_entry: ConfigEntry,
|
||||||
) -> OptionsFlow:
|
) -> FeedReaderOptionsFlowHandler:
|
||||||
"""Get the options flow for this handler."""
|
"""Get the options flow for this handler."""
|
||||||
return FeedReaderOptionsFlowHandler()
|
return FeedReaderOptionsFlowHandler()
|
||||||
|
|
||||||
@ -119,11 +119,10 @@ class FeedReaderConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
errors={"base": "url_error"},
|
errors={"base": "url_error"},
|
||||||
)
|
)
|
||||||
|
|
||||||
self.hass.config_entries.async_update_entry(reconfigure_entry, data=user_input)
|
return self.async_update_reload_and_abort(reconfigure_entry, data=user_input)
|
||||||
return self.async_abort(reason="reconfigure_successful")
|
|
||||||
|
|
||||||
|
|
||||||
class FeedReaderOptionsFlowHandler(OptionsFlow):
|
class FeedReaderOptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Handle an options flow."""
|
"""Handle an options flow."""
|
||||||
|
|
||||||
async def async_step_init(
|
async def async_step_init(
|
||||||
|
@ -29,7 +29,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
await hass.config_entries.async_forward_entry_setups(
|
await hass.config_entries.async_forward_entry_setups(
|
||||||
entry, [Platform(entry.data[CONF_PLATFORM])]
|
entry, [Platform(entry.data[CONF_PLATFORM])]
|
||||||
)
|
)
|
||||||
entry.async_on_unload(entry.add_update_listener(update_listener))
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -41,11 +40,6 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def update_listener(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
|
||||||
"""Handle options update."""
|
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
|
|
||||||
|
|
||||||
async def async_migrate_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
|
async def async_migrate_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
|
||||||
"""Migrate config entry."""
|
"""Migrate config entry."""
|
||||||
if config_entry.version > 2:
|
if config_entry.version > 2:
|
||||||
|
@ -11,7 +11,7 @@ from homeassistant.config_entries import (
|
|||||||
ConfigEntry,
|
ConfigEntry,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
OptionsFlow,
|
OptionsFlowWithReload,
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_FILE_PATH,
|
CONF_FILE_PATH,
|
||||||
@ -131,7 +131,7 @@ class FileConfigFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
return await self._async_handle_step(Platform.SENSOR.value, user_input)
|
return await self._async_handle_step(Platform.SENSOR.value, user_input)
|
||||||
|
|
||||||
|
|
||||||
class FileOptionsFlowHandler(OptionsFlow):
|
class FileOptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Handle File options."""
|
"""Handle File options."""
|
||||||
|
|
||||||
async def async_step_init(
|
async def async_step_init(
|
||||||
|
@ -47,8 +47,6 @@ async def async_setup_entry(
|
|||||||
|
|
||||||
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_update_options))
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
@ -57,10 +55,3 @@ async def async_unload_entry(
|
|||||||
) -> bool:
|
) -> bool:
|
||||||
"""Unload a config entry."""
|
"""Unload a config entry."""
|
||||||
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||||
|
|
||||||
|
|
||||||
async def async_update_options(
|
|
||||||
hass: HomeAssistant, entry: ForecastSolarConfigEntry
|
|
||||||
) -> None:
|
|
||||||
"""Update options."""
|
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
|
@ -11,7 +11,7 @@ from homeassistant.config_entries import (
|
|||||||
ConfigEntry,
|
ConfigEntry,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
OptionsFlow,
|
OptionsFlowWithReload,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_API_KEY, CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME
|
from homeassistant.const import CONF_API_KEY, CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
@ -88,7 +88,7 @@ class ForecastSolarFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ForecastSolarOptionFlowHandler(OptionsFlow):
|
class ForecastSolarOptionFlowHandler(OptionsFlowWithReload):
|
||||||
"""Handle options."""
|
"""Handle options."""
|
||||||
|
|
||||||
async def async_step_init(
|
async def async_step_init(
|
||||||
|
@ -75,8 +75,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: FritzConfigEntry) -> boo
|
|||||||
if FRITZ_DATA_KEY not in hass.data:
|
if FRITZ_DATA_KEY not in hass.data:
|
||||||
hass.data[FRITZ_DATA_KEY] = FritzData()
|
hass.data[FRITZ_DATA_KEY] = FritzData()
|
||||||
|
|
||||||
entry.async_on_unload(entry.add_update_listener(update_listener))
|
|
||||||
|
|
||||||
# Load the other platforms like switch
|
# Load the other platforms like switch
|
||||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||||
|
|
||||||
@ -94,9 +92,3 @@ async def async_unload_entry(hass: HomeAssistant, entry: FritzConfigEntry) -> bo
|
|||||||
hass.data.pop(FRITZ_DATA_KEY)
|
hass.data.pop(FRITZ_DATA_KEY)
|
||||||
|
|
||||||
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||||
|
|
||||||
|
|
||||||
async def update_listener(hass: HomeAssistant, entry: FritzConfigEntry) -> None:
|
|
||||||
"""Update when config_entry options update."""
|
|
||||||
if entry.options:
|
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
|
@ -17,7 +17,11 @@ from homeassistant.components.device_tracker import (
|
|||||||
CONF_CONSIDER_HOME,
|
CONF_CONSIDER_HOME,
|
||||||
DEFAULT_CONSIDER_HOME,
|
DEFAULT_CONSIDER_HOME,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult, OptionsFlow
|
from homeassistant.config_entries import (
|
||||||
|
ConfigFlow,
|
||||||
|
ConfigFlowResult,
|
||||||
|
OptionsFlowWithReload,
|
||||||
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
CONF_PASSWORD,
|
CONF_PASSWORD,
|
||||||
@ -409,7 +413,7 @@ class FritzBoxToolsFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class FritzBoxToolsOptionsFlowHandler(OptionsFlow):
|
class FritzBoxToolsOptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Handle an options flow."""
|
"""Handle an options flow."""
|
||||||
|
|
||||||
async def async_step_init(
|
async def async_step_init(
|
||||||
|
@ -48,7 +48,6 @@ async def async_setup_entry(
|
|||||||
raise ConfigEntryNotReady from ex
|
raise ConfigEntryNotReady from ex
|
||||||
|
|
||||||
config_entry.runtime_data = fritzbox_phonebook
|
config_entry.runtime_data = fritzbox_phonebook
|
||||||
config_entry.async_on_unload(config_entry.add_update_listener(update_listener))
|
|
||||||
await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS)
|
await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
@ -59,10 +58,3 @@ async def async_unload_entry(
|
|||||||
) -> bool:
|
) -> bool:
|
||||||
"""Unloading the fritzbox_callmonitor platforms."""
|
"""Unloading the fritzbox_callmonitor platforms."""
|
||||||
return await hass.config_entries.async_unload_platforms(config_entry, PLATFORMS)
|
return await hass.config_entries.async_unload_platforms(config_entry, PLATFORMS)
|
||||||
|
|
||||||
|
|
||||||
async def update_listener(
|
|
||||||
hass: HomeAssistant, config_entry: FritzBoxCallMonitorConfigEntry
|
|
||||||
) -> None:
|
|
||||||
"""Update listener to reload after option has changed."""
|
|
||||||
await hass.config_entries.async_reload(config_entry.entry_id)
|
|
||||||
|
@ -15,7 +15,7 @@ from homeassistant.config_entries import (
|
|||||||
ConfigEntry,
|
ConfigEntry,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
OptionsFlow,
|
OptionsFlowWithReload,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT, CONF_USERNAME
|
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT, CONF_USERNAME
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
@ -263,7 +263,7 @@ class FritzBoxCallMonitorConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
return self.async_abort(reason="reauth_successful")
|
return self.async_abort(reason="reauth_successful")
|
||||||
|
|
||||||
|
|
||||||
class FritzBoxCallMonitorOptionsFlowHandler(OptionsFlow):
|
class FritzBoxCallMonitorOptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Handle a fritzbox_callmonitor options flow."""
|
"""Handle a fritzbox_callmonitor options flow."""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -13,6 +13,7 @@ from gardena_bluetooth.parse import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
from homeassistant.components.number import (
|
from homeassistant.components.number import (
|
||||||
|
NumberDeviceClass,
|
||||||
NumberEntity,
|
NumberEntity,
|
||||||
NumberEntityDescription,
|
NumberEntityDescription,
|
||||||
NumberMode,
|
NumberMode,
|
||||||
@ -54,6 +55,7 @@ DESCRIPTIONS = (
|
|||||||
native_step=60,
|
native_step=60,
|
||||||
entity_category=EntityCategory.CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
char=Valve.manual_watering_time,
|
char=Valve.manual_watering_time,
|
||||||
|
device_class=NumberDeviceClass.DURATION,
|
||||||
),
|
),
|
||||||
GardenaBluetoothNumberEntityDescription(
|
GardenaBluetoothNumberEntityDescription(
|
||||||
key=Valve.remaining_open_time.uuid,
|
key=Valve.remaining_open_time.uuid,
|
||||||
@ -64,6 +66,7 @@ DESCRIPTIONS = (
|
|||||||
native_step=60.0,
|
native_step=60.0,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
char=Valve.remaining_open_time,
|
char=Valve.remaining_open_time,
|
||||||
|
device_class=NumberDeviceClass.DURATION,
|
||||||
),
|
),
|
||||||
GardenaBluetoothNumberEntityDescription(
|
GardenaBluetoothNumberEntityDescription(
|
||||||
key=DeviceConfiguration.rain_pause.uuid,
|
key=DeviceConfiguration.rain_pause.uuid,
|
||||||
@ -75,6 +78,7 @@ DESCRIPTIONS = (
|
|||||||
native_step=6 * 60.0,
|
native_step=6 * 60.0,
|
||||||
entity_category=EntityCategory.CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
char=DeviceConfiguration.rain_pause,
|
char=DeviceConfiguration.rain_pause,
|
||||||
|
device_class=NumberDeviceClass.DURATION,
|
||||||
),
|
),
|
||||||
GardenaBluetoothNumberEntityDescription(
|
GardenaBluetoothNumberEntityDescription(
|
||||||
key=DeviceConfiguration.seasonal_adjust.uuid,
|
key=DeviceConfiguration.seasonal_adjust.uuid,
|
||||||
@ -86,6 +90,7 @@ DESCRIPTIONS = (
|
|||||||
native_step=1.0,
|
native_step=1.0,
|
||||||
entity_category=EntityCategory.CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
char=DeviceConfiguration.seasonal_adjust,
|
char=DeviceConfiguration.seasonal_adjust,
|
||||||
|
device_class=NumberDeviceClass.DURATION,
|
||||||
),
|
),
|
||||||
GardenaBluetoothNumberEntityDescription(
|
GardenaBluetoothNumberEntityDescription(
|
||||||
key=Sensor.threshold.uuid,
|
key=Sensor.threshold.uuid,
|
||||||
@ -153,6 +158,7 @@ class GardenaBluetoothRemainingOpenSetNumber(GardenaBluetoothEntity, NumberEntit
|
|||||||
_attr_native_min_value = 0.0
|
_attr_native_min_value = 0.0
|
||||||
_attr_native_max_value = 24 * 60
|
_attr_native_max_value = 24 * 60
|
||||||
_attr_native_step = 1.0
|
_attr_native_step = 1.0
|
||||||
|
_attr_device_class = NumberDeviceClass.DURATION
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
@ -6,7 +6,11 @@ from typing import Any
|
|||||||
|
|
||||||
from gardena_bluetooth.const import Valve
|
from gardena_bluetooth.const import Valve
|
||||||
|
|
||||||
from homeassistant.components.valve import ValveEntity, ValveEntityFeature
|
from homeassistant.components.valve import (
|
||||||
|
ValveDeviceClass,
|
||||||
|
ValveEntity,
|
||||||
|
ValveEntityFeature,
|
||||||
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||||
|
|
||||||
@ -37,6 +41,7 @@ class GardenaBluetoothValve(GardenaBluetoothEntity, ValveEntity):
|
|||||||
_attr_is_closed: bool | None = None
|
_attr_is_closed: bool | None = None
|
||||||
_attr_reports_position = False
|
_attr_reports_position = False
|
||||||
_attr_supported_features = ValveEntityFeature.OPEN | ValveEntityFeature.CLOSE
|
_attr_supported_features = ValveEntityFeature.OPEN | ValveEntityFeature.CLOSE
|
||||||
|
_attr_device_class = ValveDeviceClass.WATER
|
||||||
|
|
||||||
characteristics = {
|
characteristics = {
|
||||||
Valve.state.uuid,
|
Valve.state.uuid,
|
||||||
|
@ -47,7 +47,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: GithubConfigEntry) -> bo
|
|||||||
async_cleanup_device_registry(hass=hass, entry=entry)
|
async_cleanup_device_registry(hass=hass, entry=entry)
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
|
|
||||||
@ -87,8 +86,3 @@ async def async_unload_entry(hass: HomeAssistant, entry: GithubConfigEntry) -> b
|
|||||||
coordinator.unsubscribe()
|
coordinator.unsubscribe()
|
||||||
|
|
||||||
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||||
|
|
||||||
|
|
||||||
async def async_reload_entry(hass: HomeAssistant, entry: GithubConfigEntry) -> None:
|
|
||||||
"""Handle an options update."""
|
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
|
@ -19,7 +19,7 @@ from homeassistant.config_entries import (
|
|||||||
ConfigEntry,
|
ConfigEntry,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
OptionsFlow,
|
OptionsFlowWithReload,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_ACCESS_TOKEN
|
from homeassistant.const import CONF_ACCESS_TOKEN
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
@ -214,7 +214,7 @@ class GitHubConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
return OptionsFlowHandler()
|
return OptionsFlowHandler()
|
||||||
|
|
||||||
|
|
||||||
class OptionsFlowHandler(OptionsFlow):
|
class OptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Handle a option flow for GitHub."""
|
"""Handle a option flow for GitHub."""
|
||||||
|
|
||||||
async def async_step_init(
|
async def async_step_init(
|
||||||
|
@ -34,16 +34,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
)
|
)
|
||||||
|
|
||||||
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(update_listener))
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def update_listener(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
|
||||||
"""Handle options update."""
|
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
|
|
||||||
|
|
||||||
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Unload a config entry."""
|
"""Unload a config entry."""
|
||||||
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||||
|
@ -12,7 +12,7 @@ from homeassistant.config_entries import (
|
|||||||
ConfigEntry,
|
ConfigEntry,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
OptionsFlow,
|
OptionsFlowWithReload,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_COUNTRY
|
from homeassistant.const import CONF_COUNTRY
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
@ -227,7 +227,7 @@ class HolidayConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class HolidayOptionsFlowHandler(OptionsFlow):
|
class HolidayOptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Handle Holiday options."""
|
"""Handle Holiday options."""
|
||||||
|
|
||||||
async def async_step_init(
|
async def async_step_init(
|
||||||
|
@ -6,5 +6,5 @@
|
|||||||
"documentation": "https://www.home-assistant.io/integrations/homematicip_cloud",
|
"documentation": "https://www.home-assistant.io/integrations/homematicip_cloud",
|
||||||
"iot_class": "cloud_push",
|
"iot_class": "cloud_push",
|
||||||
"loggers": ["homematicip"],
|
"loggers": ["homematicip"],
|
||||||
"requirements": ["homematicip==2.0.7"]
|
"requirements": ["homematicip==2.2.0"]
|
||||||
}
|
}
|
||||||
|
42
homeassistant/components/huum/binary_sensor.py
Normal file
42
homeassistant/components/huum/binary_sensor.py
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
"""Sensor for door state."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from homeassistant.components.binary_sensor import (
|
||||||
|
BinarySensorDeviceClass,
|
||||||
|
BinarySensorEntity,
|
||||||
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||||
|
|
||||||
|
from .coordinator import HuumConfigEntry, HuumDataUpdateCoordinator
|
||||||
|
from .entity import HuumBaseEntity
|
||||||
|
|
||||||
|
|
||||||
|
async def async_setup_entry(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
config_entry: HuumConfigEntry,
|
||||||
|
async_add_entities: AddConfigEntryEntitiesCallback,
|
||||||
|
) -> None:
|
||||||
|
"""Set up door sensor."""
|
||||||
|
async_add_entities(
|
||||||
|
[HuumDoorSensor(config_entry.runtime_data)],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class HuumDoorSensor(HuumBaseEntity, BinarySensorEntity):
|
||||||
|
"""Representation of a BinarySensor."""
|
||||||
|
|
||||||
|
_attr_name = "Door"
|
||||||
|
_attr_device_class = BinarySensorDeviceClass.DOOR
|
||||||
|
|
||||||
|
def __init__(self, coordinator: HuumDataUpdateCoordinator) -> None:
|
||||||
|
"""Initialize the BinarySensor."""
|
||||||
|
super().__init__(coordinator)
|
||||||
|
|
||||||
|
self._attr_unique_id = f"{coordinator.config_entry.entry_id}_door"
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_on(self) -> bool | None:
|
||||||
|
"""Return the current value."""
|
||||||
|
return not self.coordinator.data.door_closed
|
@ -4,4 +4,4 @@ from homeassistant.const import Platform
|
|||||||
|
|
||||||
DOMAIN = "huum"
|
DOMAIN = "huum"
|
||||||
|
|
||||||
PLATFORMS = [Platform.CLIMATE]
|
PLATFORMS = [Platform.BINARY_SENSOR, Platform.CLIMATE]
|
||||||
|
@ -79,13 +79,6 @@ async def async_setup_entry(
|
|||||||
|
|
||||||
await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS)
|
await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS)
|
||||||
|
|
||||||
async def update_listener(
|
|
||||||
hass: HomeAssistant, config_entry: JewishCalendarConfigEntry
|
|
||||||
) -> None:
|
|
||||||
# Trigger update of states for all platforms
|
|
||||||
await hass.config_entries.async_reload(config_entry.entry_id)
|
|
||||||
|
|
||||||
config_entry.async_on_unload(config_entry.add_update_listener(update_listener))
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,7 +9,11 @@ import zoneinfo
|
|||||||
from hdate.translator import Language
|
from hdate.translator import Language
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult, OptionsFlow
|
from homeassistant.config_entries import (
|
||||||
|
ConfigFlow,
|
||||||
|
ConfigFlowResult,
|
||||||
|
OptionsFlowWithReload,
|
||||||
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_ELEVATION,
|
CONF_ELEVATION,
|
||||||
CONF_LANGUAGE,
|
CONF_LANGUAGE,
|
||||||
@ -124,7 +128,7 @@ class JewishCalendarConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
return self.async_update_reload_and_abort(reconfigure_entry, data=user_input)
|
return self.async_update_reload_and_abort(reconfigure_entry, data=user_input)
|
||||||
|
|
||||||
|
|
||||||
class JewishCalendarOptionsFlowHandler(OptionsFlow):
|
class JewishCalendarOptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Handle Jewish Calendar options."""
|
"""Handle Jewish Calendar options."""
|
||||||
|
|
||||||
async def async_step_init(
|
async def async_step_init(
|
||||||
|
@ -101,19 +101,12 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
# Start a reauth flow
|
# Start a reauth flow
|
||||||
entry.async_start_reauth(hass)
|
entry.async_start_reauth(hass)
|
||||||
|
|
||||||
entry.async_on_unload(entry.add_update_listener(_async_update_listener))
|
|
||||||
|
|
||||||
# Notify backup listeners
|
# Notify backup listeners
|
||||||
hass.async_create_task(_notify_backup_listeners(hass), eager_start=False)
|
hass.async_create_task(_notify_backup_listeners(hass), eager_start=False)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def _async_update_listener(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
|
||||||
"""Handle update."""
|
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
|
|
||||||
|
|
||||||
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Unload config entry."""
|
"""Unload config entry."""
|
||||||
# Notify backup listeners
|
# Notify backup listeners
|
||||||
|
@ -13,7 +13,7 @@ from homeassistant.config_entries import (
|
|||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
ConfigSubentryFlow,
|
ConfigSubentryFlow,
|
||||||
OptionsFlow,
|
OptionsFlowWithReload,
|
||||||
SubentryFlowResult,
|
SubentryFlowResult,
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
@ -65,7 +65,7 @@ class KitchenSinkConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
return self.async_abort(reason="reauth_successful")
|
return self.async_abort(reason="reauth_successful")
|
||||||
|
|
||||||
|
|
||||||
class OptionsFlowHandler(OptionsFlow):
|
class OptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Handle options."""
|
"""Handle options."""
|
||||||
|
|
||||||
async def async_step_init(
|
async def async_step_init(
|
||||||
|
@ -120,8 +120,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
|
|
||||||
hass.data[KNX_MODULE_KEY] = knx_module
|
hass.data[KNX_MODULE_KEY] = knx_module
|
||||||
|
|
||||||
entry.async_on_unload(entry.add_update_listener(async_update_entry))
|
|
||||||
|
|
||||||
if CONF_KNX_EXPOSE in config:
|
if CONF_KNX_EXPOSE in config:
|
||||||
for expose_config in config[CONF_KNX_EXPOSE]:
|
for expose_config in config[CONF_KNX_EXPOSE]:
|
||||||
knx_module.exposures.append(
|
knx_module.exposures.append(
|
||||||
@ -174,11 +172,6 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
return unload_ok
|
return unload_ok
|
||||||
|
|
||||||
|
|
||||||
async def async_update_entry(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
|
||||||
"""Update a given config entry."""
|
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
|
|
||||||
|
|
||||||
async def async_remove_entry(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
async def async_remove_entry(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
||||||
"""Remove a config entry."""
|
"""Remove a config entry."""
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ from homeassistant.config_entries import (
|
|||||||
ConfigEntry,
|
ConfigEntry,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
OptionsFlow,
|
OptionsFlowWithReload,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_HOST, CONF_PORT
|
from homeassistant.const import CONF_HOST, CONF_PORT
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
@ -899,7 +899,7 @@ class KNXConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class KNXOptionsFlow(OptionsFlow):
|
class KNXOptionsFlow(OptionsFlowWithReload):
|
||||||
"""Handle KNX options."""
|
"""Handle KNX options."""
|
||||||
|
|
||||||
def __init__(self, config_entry: ConfigEntry) -> None:
|
def __init__(self, config_entry: ConfigEntry) -> None:
|
||||||
|
@ -154,13 +154,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: LaMarzoccoConfigEntry) -
|
|||||||
|
|
||||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||||
|
|
||||||
async def update_listener(
|
|
||||||
hass: HomeAssistant, entry: LaMarzoccoConfigEntry
|
|
||||||
) -> None:
|
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
|
|
||||||
entry.async_on_unload(entry.add_update_listener(update_listener))
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ from homeassistant.config_entries import (
|
|||||||
SOURCE_RECONFIGURE,
|
SOURCE_RECONFIGURE,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
OptionsFlow,
|
OptionsFlowWithReload,
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_ADDRESS,
|
CONF_ADDRESS,
|
||||||
@ -363,7 +363,7 @@ class LmConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
return LmOptionsFlowHandler()
|
return LmOptionsFlowHandler()
|
||||||
|
|
||||||
|
|
||||||
class LmOptionsFlowHandler(OptionsFlow):
|
class LmOptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Handles options flow for the component."""
|
"""Handles options flow for the component."""
|
||||||
|
|
||||||
async def async_step_init(
|
async def async_step_init(
|
||||||
|
@ -16,7 +16,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: LastFMConfigEntry) -> bo
|
|||||||
entry.runtime_data = coordinator
|
entry.runtime_data = coordinator
|
||||||
|
|
||||||
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(update_listener))
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -24,8 +23,3 @@ async def async_setup_entry(hass: HomeAssistant, entry: LastFMConfigEntry) -> bo
|
|||||||
async def async_unload_entry(hass: HomeAssistant, entry: LastFMConfigEntry) -> bool:
|
async def async_unload_entry(hass: HomeAssistant, entry: LastFMConfigEntry) -> bool:
|
||||||
"""Unload lastfm config entry."""
|
"""Unload lastfm config entry."""
|
||||||
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||||
|
|
||||||
|
|
||||||
async def update_listener(hass: HomeAssistant, entry: LastFMConfigEntry) -> None:
|
|
||||||
"""Handle options update."""
|
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
|
@ -8,7 +8,11 @@ from typing import Any
|
|||||||
from pylast import LastFMNetwork, PyLastError, User, WSError
|
from pylast import LastFMNetwork, PyLastError, User, WSError
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult, OptionsFlow
|
from homeassistant.config_entries import (
|
||||||
|
ConfigFlow,
|
||||||
|
ConfigFlowResult,
|
||||||
|
OptionsFlowWithReload,
|
||||||
|
)
|
||||||
from homeassistant.const import CONF_API_KEY
|
from homeassistant.const import CONF_API_KEY
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.helpers.selector import (
|
from homeassistant.helpers.selector import (
|
||||||
@ -155,7 +159,7 @@ class LastFmConfigFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class LastFmOptionsFlowHandler(OptionsFlow):
|
class LastFmOptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""LastFm Options flow handler."""
|
"""LastFm Options flow handler."""
|
||||||
|
|
||||||
config_entry: LastFMConfigEntry
|
config_entry: LastFMConfigEntry
|
||||||
|
@ -47,7 +47,6 @@ async def async_setup_entry(
|
|||||||
|
|
||||||
config_entry.runtime_data = coordinator
|
config_entry.runtime_data = coordinator
|
||||||
|
|
||||||
config_entry.async_on_unload(config_entry.add_update_listener(async_update_entry))
|
|
||||||
config_entry.async_on_unload(coordinator.untrack_home)
|
config_entry.async_on_unload(coordinator.untrack_home)
|
||||||
|
|
||||||
await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS)
|
await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS)
|
||||||
@ -64,11 +63,6 @@ async def async_unload_entry(
|
|||||||
return await hass.config_entries.async_unload_platforms(config_entry, PLATFORMS)
|
return await hass.config_entries.async_unload_platforms(config_entry, PLATFORMS)
|
||||||
|
|
||||||
|
|
||||||
async def async_update_entry(hass: HomeAssistant, config_entry: MetWeatherConfigEntry):
|
|
||||||
"""Reload Met component when options changed."""
|
|
||||||
await hass.config_entries.async_reload(config_entry.entry_id)
|
|
||||||
|
|
||||||
|
|
||||||
async def cleanup_old_device(hass: HomeAssistant) -> None:
|
async def cleanup_old_device(hass: HomeAssistant) -> None:
|
||||||
"""Cleanup device without proper device identifier."""
|
"""Cleanup device without proper device identifier."""
|
||||||
device_reg = dr.async_get(hass)
|
device_reg = dr.async_get(hass)
|
||||||
|
@ -10,7 +10,7 @@ from homeassistant.config_entries import (
|
|||||||
ConfigEntry,
|
ConfigEntry,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
OptionsFlow,
|
OptionsFlowWithReload,
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_ELEVATION,
|
CONF_ELEVATION,
|
||||||
@ -147,7 +147,7 @@ class MetConfigFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
return MetOptionsFlowHandler()
|
return MetOptionsFlowHandler()
|
||||||
|
|
||||||
|
|
||||||
class MetOptionsFlowHandler(OptionsFlow):
|
class MetOptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Options flow for Met component."""
|
"""Options flow for Met component."""
|
||||||
|
|
||||||
async def async_step_init(
|
async def async_step_init(
|
||||||
|
@ -120,8 +120,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
|
|
||||||
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(update_listener))
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
@ -145,8 +143,3 @@ async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) ->
|
|||||||
multicast.Stop_listen()
|
multicast.Stop_listen()
|
||||||
|
|
||||||
return unload_ok
|
return unload_ok
|
||||||
|
|
||||||
|
|
||||||
async def update_listener(hass: HomeAssistant, config_entry: ConfigEntry) -> None:
|
|
||||||
"""Handle options update."""
|
|
||||||
await hass.config_entries.async_reload(config_entry.entry_id)
|
|
||||||
|
@ -12,7 +12,7 @@ from homeassistant.config_entries import (
|
|||||||
ConfigEntry,
|
ConfigEntry,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
OptionsFlow,
|
OptionsFlowWithReload,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_API_KEY, CONF_HOST
|
from homeassistant.const import CONF_API_KEY, CONF_HOST
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
@ -38,7 +38,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class OptionsFlowHandler(OptionsFlow):
|
class OptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Options for the component."""
|
"""Options for the component."""
|
||||||
|
|
||||||
async def async_step_init(
|
async def async_step_init(
|
||||||
|
@ -277,11 +277,6 @@ def _add_camera(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def _async_entry_updated(hass: HomeAssistant, config_entry: ConfigEntry) -> None:
|
|
||||||
"""Handle entry updates."""
|
|
||||||
await hass.config_entries.async_reload(config_entry.entry_id)
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Set up motionEye from a config entry."""
|
"""Set up motionEye from a config entry."""
|
||||||
hass.data.setdefault(DOMAIN, {})
|
hass.data.setdefault(DOMAIN, {})
|
||||||
@ -382,7 +377,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
coordinator.async_add_listener(_async_process_motioneye_cameras)
|
coordinator.async_add_listener(_async_process_motioneye_cameras)
|
||||||
)
|
)
|
||||||
await coordinator.async_refresh()
|
await coordinator.async_refresh()
|
||||||
entry.async_on_unload(entry.add_update_listener(_async_entry_updated))
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ from homeassistant.config_entries import (
|
|||||||
ConfigEntry,
|
ConfigEntry,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
OptionsFlow,
|
OptionsFlowWithReload,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_URL, CONF_WEBHOOK_ID
|
from homeassistant.const import CONF_URL, CONF_WEBHOOK_ID
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
@ -186,7 +186,7 @@ class MotionEyeConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
return MotionEyeOptionsFlow()
|
return MotionEyeOptionsFlow()
|
||||||
|
|
||||||
|
|
||||||
class MotionEyeOptionsFlow(OptionsFlow):
|
class MotionEyeOptionsFlow(OptionsFlowWithReload):
|
||||||
"""motionEye options flow."""
|
"""motionEye options flow."""
|
||||||
|
|
||||||
async def async_step_init(
|
async def async_step_init(
|
||||||
|
@ -678,7 +678,7 @@
|
|||||||
},
|
},
|
||||||
"data_description": {
|
"data_description": {
|
||||||
"discovery_topic": "The [discovery topic]({url}#discovery-topic) to publish the discovery payload, used to trigger MQTT discovery. An empty payload published to this topic will remove the device and discovered entities.",
|
"discovery_topic": "The [discovery topic]({url}#discovery-topic) to publish the discovery payload, used to trigger MQTT discovery. An empty payload published to this topic will remove the device and discovered entities.",
|
||||||
"discovery_payload": "The JSON [discovery payload]({url}#discovery-discovery-payload) that contains information about the MQTT device."
|
"discovery_payload": "The JSON [discovery payload]({url}#device-discovery-payload) that contains information about the MQTT device."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -61,8 +61,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
|
|
||||||
hass.data.setdefault(DOMAIN, {})
|
hass.data.setdefault(DOMAIN, {})
|
||||||
|
|
||||||
entry.async_on_unload(entry.add_update_listener(update_listener))
|
|
||||||
|
|
||||||
async def async_update_devices() -> bool:
|
async def async_update_devices() -> bool:
|
||||||
"""Fetch data from the router."""
|
"""Fetch data from the router."""
|
||||||
if router.track_devices:
|
if router.track_devices:
|
||||||
@ -194,11 +192,6 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
return unload_ok
|
return unload_ok
|
||||||
|
|
||||||
|
|
||||||
async def update_listener(hass: HomeAssistant, config_entry: ConfigEntry) -> None:
|
|
||||||
"""Handle options update."""
|
|
||||||
await hass.config_entries.async_reload(config_entry.entry_id)
|
|
||||||
|
|
||||||
|
|
||||||
async def async_remove_config_entry_device(
|
async def async_remove_config_entry_device(
|
||||||
hass: HomeAssistant, config_entry: ConfigEntry, device_entry: dr.DeviceEntry
|
hass: HomeAssistant, config_entry: ConfigEntry, device_entry: dr.DeviceEntry
|
||||||
) -> bool:
|
) -> bool:
|
||||||
|
@ -13,7 +13,7 @@ from homeassistant.config_entries import (
|
|||||||
ConfigEntry,
|
ConfigEntry,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
OptionsFlow,
|
OptionsFlowWithReload,
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
@ -65,7 +65,7 @@ def _ordered_shared_schema(schema_input):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class OptionsFlowHandler(OptionsFlow):
|
class OptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Options for the component."""
|
"""Options for the component."""
|
||||||
|
|
||||||
async def async_step_init(
|
async def async_step_init(
|
||||||
|
@ -37,8 +37,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: NinaConfigEntry) -> bool
|
|||||||
|
|
||||||
await coordinator.async_config_entry_first_refresh()
|
await coordinator.async_config_entry_first_refresh()
|
||||||
|
|
||||||
entry.async_on_unload(entry.add_update_listener(_async_update_listener))
|
|
||||||
|
|
||||||
entry.runtime_data = coordinator
|
entry.runtime_data = coordinator
|
||||||
|
|
||||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||||
@ -49,8 +47,3 @@ async def async_setup_entry(hass: HomeAssistant, entry: NinaConfigEntry) -> bool
|
|||||||
async def async_unload_entry(hass: HomeAssistant, entry: NinaConfigEntry) -> bool:
|
async def async_unload_entry(hass: HomeAssistant, entry: NinaConfigEntry) -> bool:
|
||||||
"""Unload a config entry."""
|
"""Unload a config entry."""
|
||||||
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||||
|
|
||||||
|
|
||||||
async def _async_update_listener(hass: HomeAssistant, entry: NinaConfigEntry) -> None:
|
|
||||||
"""Handle options update."""
|
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
|
@ -11,7 +11,7 @@ from homeassistant.config_entries import (
|
|||||||
ConfigEntry,
|
ConfigEntry,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
OptionsFlow,
|
OptionsFlowWithReload,
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.helpers import config_validation as cv, entity_registry as er
|
from homeassistant.helpers import config_validation as cv, entity_registry as er
|
||||||
@ -165,8 +165,8 @@ class NinaConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
return OptionsFlowHandler(config_entry)
|
return OptionsFlowHandler(config_entry)
|
||||||
|
|
||||||
|
|
||||||
class OptionsFlowHandler(OptionsFlow):
|
class OptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Handle a option flow for nut."""
|
"""Handle an option flow for NINA."""
|
||||||
|
|
||||||
def __init__(self, config_entry: ConfigEntry) -> None:
|
def __init__(self, config_entry: ConfigEntry) -> None:
|
||||||
"""Initialize options flow."""
|
"""Initialize options flow."""
|
||||||
|
@ -88,16 +88,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
devices = domain_data.setdefault(NMAP_TRACKED_DEVICES, NmapTrackedDevices())
|
devices = domain_data.setdefault(NMAP_TRACKED_DEVICES, NmapTrackedDevices())
|
||||||
scanner = domain_data[entry.entry_id] = NmapDeviceScanner(hass, entry, devices)
|
scanner = domain_data[entry.entry_id] = NmapDeviceScanner(hass, entry, devices)
|
||||||
await scanner.async_setup()
|
await scanner.async_setup()
|
||||||
entry.async_on_unload(entry.add_update_listener(_async_update_listener))
|
|
||||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def _async_update_listener(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
|
||||||
"""Handle options update."""
|
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
|
|
||||||
|
|
||||||
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Unload a config entry."""
|
"""Unload a config entry."""
|
||||||
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||||
|
@ -18,7 +18,7 @@ from homeassistant.config_entries import (
|
|||||||
ConfigEntry,
|
ConfigEntry,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
OptionsFlow,
|
OptionsFlowWithReload,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_EXCLUDE, CONF_HOSTS
|
from homeassistant.const import CONF_EXCLUDE, CONF_HOSTS
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
@ -138,7 +138,7 @@ async def _async_build_schema_with_user_input(
|
|||||||
return vol.Schema(schema)
|
return vol.Schema(schema)
|
||||||
|
|
||||||
|
|
||||||
class OptionsFlowHandler(OptionsFlow):
|
class OptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Handle a option flow for homekit."""
|
"""Handle a option flow for homekit."""
|
||||||
|
|
||||||
def __init__(self, config_entry: ConfigEntry) -> None:
|
def __init__(self, config_entry: ConfigEntry) -> None:
|
||||||
|
@ -42,8 +42,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
|
|
||||||
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(options_update_listener))
|
|
||||||
|
|
||||||
await hub.start()
|
await hub.start()
|
||||||
|
|
||||||
return True
|
return True
|
||||||
@ -58,10 +56,3 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
hass.data[DOMAIN].pop(entry.entry_id)
|
hass.data[DOMAIN].pop(entry.entry_id)
|
||||||
|
|
||||||
return unload_ok
|
return unload_ok
|
||||||
|
|
||||||
|
|
||||||
async def options_update_listener(
|
|
||||||
hass: HomeAssistant, config_entry: ConfigEntry
|
|
||||||
) -> None:
|
|
||||||
"""Handle options update."""
|
|
||||||
await hass.config_entries.async_reload(config_entry.entry_id)
|
|
||||||
|
@ -12,7 +12,7 @@ from homeassistant.config_entries import (
|
|||||||
ConfigEntry,
|
ConfigEntry,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
OptionsFlow,
|
OptionsFlowWithReload,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_IP_ADDRESS
|
from homeassistant.const import CONF_IP_ADDRESS
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
@ -173,7 +173,7 @@ class NoboHubConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
@callback
|
@callback
|
||||||
def async_get_options_flow(
|
def async_get_options_flow(
|
||||||
config_entry: ConfigEntry,
|
config_entry: ConfigEntry,
|
||||||
) -> OptionsFlow:
|
) -> OptionsFlowHandler:
|
||||||
"""Get the options flow for this handler."""
|
"""Get the options flow for this handler."""
|
||||||
return OptionsFlowHandler()
|
return OptionsFlowHandler()
|
||||||
|
|
||||||
@ -187,7 +187,7 @@ class NoboHubConnectError(HomeAssistantError):
|
|||||||
self.msg = msg
|
self.msg = msg
|
||||||
|
|
||||||
|
|
||||||
class OptionsFlowHandler(OptionsFlow):
|
class OptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Handles options flow for the component."""
|
"""Handles options flow for the component."""
|
||||||
|
|
||||||
async def async_step_init(self, user_input=None) -> ConfigFlowResult:
|
async def async_step_init(self, user_input=None) -> ConfigFlowResult:
|
||||||
|
@ -116,7 +116,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: NutConfigEntry) -> bool:
|
|||||||
|
|
||||||
_LOGGER.debug("NUT Sensors Available: %s", status if status else None)
|
_LOGGER.debug("NUT Sensors Available: %s", status if status else None)
|
||||||
|
|
||||||
entry.async_on_unload(entry.add_update_listener(_async_update_listener))
|
|
||||||
unique_id = _unique_id_from_status(status)
|
unique_id = _unique_id_from_status(status)
|
||||||
if unique_id is None:
|
if unique_id is None:
|
||||||
unique_id = entry.entry_id
|
unique_id = entry.entry_id
|
||||||
@ -199,11 +198,6 @@ async def async_remove_config_entry_device(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def _async_update_listener(hass: HomeAssistant, entry: NutConfigEntry) -> None:
|
|
||||||
"""Handle options update."""
|
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
|
|
||||||
|
|
||||||
def _manufacturer_from_status(status: dict[str, str]) -> str | None:
|
def _manufacturer_from_status(status: dict[str, str]) -> str | None:
|
||||||
"""Find the best manufacturer value from the status."""
|
"""Find the best manufacturer value from the status."""
|
||||||
return (
|
return (
|
||||||
|
@ -39,8 +39,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: OneWireConfigEntry) -> b
|
|||||||
|
|
||||||
onewire_hub.schedule_scan_for_new_devices()
|
onewire_hub.schedule_scan_for_new_devices()
|
||||||
|
|
||||||
entry.async_on_unload(entry.add_update_listener(options_update_listener))
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
@ -59,11 +57,3 @@ async def async_unload_entry(
|
|||||||
) -> bool:
|
) -> bool:
|
||||||
"""Unload a config entry."""
|
"""Unload a config entry."""
|
||||||
return await hass.config_entries.async_unload_platforms(config_entry, _PLATFORMS)
|
return await hass.config_entries.async_unload_platforms(config_entry, _PLATFORMS)
|
||||||
|
|
||||||
|
|
||||||
async def options_update_listener(
|
|
||||||
hass: HomeAssistant, entry: OneWireConfigEntry
|
|
||||||
) -> None:
|
|
||||||
"""Handle options update."""
|
|
||||||
_LOGGER.debug("Configuration options updated, reloading OneWire integration")
|
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
|
@ -8,7 +8,11 @@ from typing import Any
|
|||||||
from pyownet import protocol
|
from pyownet import protocol
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult, OptionsFlow
|
from homeassistant.config_entries import (
|
||||||
|
ConfigFlow,
|
||||||
|
ConfigFlowResult,
|
||||||
|
OptionsFlowWithReload,
|
||||||
|
)
|
||||||
from homeassistant.const import CONF_HOST, CONF_PORT
|
from homeassistant.const import CONF_HOST, CONF_PORT
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers import config_validation as cv, device_registry as dr
|
from homeassistant.helpers import config_validation as cv, device_registry as dr
|
||||||
@ -160,7 +164,7 @@ class OneWireFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
return OnewireOptionsFlowHandler(config_entry)
|
return OnewireOptionsFlowHandler(config_entry)
|
||||||
|
|
||||||
|
|
||||||
class OnewireOptionsFlowHandler(OptionsFlow):
|
class OnewireOptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Handle OneWire Config options."""
|
"""Handle OneWire Config options."""
|
||||||
|
|
||||||
configurable_devices: dict[str, str]
|
configurable_devices: dict[str, str]
|
||||||
|
@ -47,7 +47,6 @@ async def async_setup(hass: HomeAssistant, _: ConfigType) -> bool:
|
|||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistant, entry: OnkyoConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistant, entry: OnkyoConfigEntry) -> bool:
|
||||||
"""Set up the Onkyo config entry."""
|
"""Set up the Onkyo config entry."""
|
||||||
entry.async_on_unload(entry.add_update_listener(update_listener))
|
|
||||||
|
|
||||||
host = entry.data[CONF_HOST]
|
host = entry.data[CONF_HOST]
|
||||||
|
|
||||||
@ -82,8 +81,3 @@ async def async_unload_entry(hass: HomeAssistant, entry: OnkyoConfigEntry) -> bo
|
|||||||
receiver.conn.close()
|
receiver.conn.close()
|
||||||
|
|
||||||
return unload_ok
|
return unload_ok
|
||||||
|
|
||||||
|
|
||||||
async def update_listener(hass: HomeAssistant, entry: OnkyoConfigEntry) -> None:
|
|
||||||
"""Handle options update."""
|
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
|
@ -12,7 +12,7 @@ from homeassistant.config_entries import (
|
|||||||
ConfigEntry,
|
ConfigEntry,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
OptionsFlow,
|
OptionsFlowWithReload,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_HOST
|
from homeassistant.const import CONF_HOST
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
@ -329,7 +329,7 @@ class OnkyoConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@callback
|
@callback
|
||||||
def async_get_options_flow(config_entry: ConfigEntry) -> OptionsFlow:
|
def async_get_options_flow(config_entry: ConfigEntry) -> OptionsFlowWithReload:
|
||||||
"""Return the options flow."""
|
"""Return the options flow."""
|
||||||
return OnkyoOptionsFlowHandler()
|
return OnkyoOptionsFlowHandler()
|
||||||
|
|
||||||
@ -357,7 +357,7 @@ OPTIONS_STEP_INIT_SCHEMA = vol.Schema(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class OnkyoOptionsFlowHandler(OptionsFlow):
|
class OnkyoOptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Handle an options flow for Onkyo."""
|
"""Handle an options flow for Onkyo."""
|
||||||
|
|
||||||
_data: dict[str, Any]
|
_data: dict[str, Any]
|
||||||
|
@ -50,16 +50,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: PingConfigEntry) -> bool
|
|||||||
entry.runtime_data = coordinator
|
entry.runtime_data = coordinator
|
||||||
|
|
||||||
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: PingConfigEntry) -> None:
|
|
||||||
"""Handle an options update."""
|
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
|
|
||||||
|
|
||||||
async def async_unload_entry(hass: HomeAssistant, entry: PingConfigEntry) -> bool:
|
async def async_unload_entry(hass: HomeAssistant, entry: PingConfigEntry) -> bool:
|
||||||
"""Unload a config entry."""
|
"""Unload a config entry."""
|
||||||
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||||
|
@ -15,7 +15,7 @@ from homeassistant.config_entries import (
|
|||||||
ConfigEntry,
|
ConfigEntry,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
OptionsFlow,
|
OptionsFlowWithReload,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_HOST
|
from homeassistant.const import CONF_HOST
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
@ -71,12 +71,12 @@ class PingConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
@callback
|
@callback
|
||||||
def async_get_options_flow(
|
def async_get_options_flow(
|
||||||
config_entry: ConfigEntry,
|
config_entry: ConfigEntry,
|
||||||
) -> OptionsFlow:
|
) -> OptionsFlowHandler:
|
||||||
"""Create the options flow."""
|
"""Create the options flow."""
|
||||||
return OptionsFlowHandler()
|
return OptionsFlowHandler()
|
||||||
|
|
||||||
|
|
||||||
class OptionsFlowHandler(OptionsFlow):
|
class OptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Handle an options flow for Ping."""
|
"""Handle an options flow for Ping."""
|
||||||
|
|
||||||
async def async_step_init(
|
async def async_step_init(
|
||||||
|
@ -43,17 +43,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ProximityConfigEntry) ->
|
|||||||
entry.runtime_data = coordinator
|
entry.runtime_data = coordinator
|
||||||
|
|
||||||
await hass.config_entries.async_forward_entry_setups(entry, [Platform.SENSOR])
|
await hass.config_entries.async_forward_entry_setups(entry, [Platform.SENSOR])
|
||||||
entry.async_on_unload(entry.add_update_listener(_async_update_listener))
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_unload_entry(hass: HomeAssistant, entry: ProximityConfigEntry) -> bool:
|
async def async_unload_entry(hass: HomeAssistant, entry: ProximityConfigEntry) -> bool:
|
||||||
"""Unload a config entry."""
|
"""Unload a config entry."""
|
||||||
return await hass.config_entries.async_unload_platforms(entry, [Platform.SENSOR])
|
return await hass.config_entries.async_unload_platforms(entry, [Platform.SENSOR])
|
||||||
|
|
||||||
|
|
||||||
async def _async_update_listener(
|
|
||||||
hass: HomeAssistant, entry: ProximityConfigEntry
|
|
||||||
) -> None:
|
|
||||||
"""Handle options update."""
|
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
|
@ -13,7 +13,7 @@ from homeassistant.config_entries import (
|
|||||||
ConfigEntry,
|
ConfigEntry,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
OptionsFlow,
|
OptionsFlowWithReload,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_ZONE, UnitOfLength
|
from homeassistant.const import CONF_ZONE, UnitOfLength
|
||||||
from homeassistant.core import State, callback
|
from homeassistant.core import State, callback
|
||||||
@ -87,7 +87,7 @@ class ProximityConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@callback
|
@callback
|
||||||
def async_get_options_flow(config_entry: ConfigEntry) -> OptionsFlow:
|
def async_get_options_flow(config_entry: ConfigEntry) -> ProximityOptionsFlow:
|
||||||
"""Get the options flow for this handler."""
|
"""Get the options flow for this handler."""
|
||||||
return ProximityOptionsFlow()
|
return ProximityOptionsFlow()
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ class ProximityConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ProximityOptionsFlow(OptionsFlow):
|
class ProximityOptionsFlow(OptionsFlowWithReload):
|
||||||
"""Handle a option flow."""
|
"""Handle a option flow."""
|
||||||
|
|
||||||
def _user_form_schema(self, user_input: dict[str, Any]) -> vol.Schema:
|
def _user_form_schema(self, user_input: dict[str, Any]) -> vol.Schema:
|
||||||
|
@ -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)
|
||||||
|
@ -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:
|
||||||
|
@ -218,6 +218,9 @@ def _async_fix_device_id(
|
|||||||
for device_entry in device_entries:
|
for device_entry in device_entries:
|
||||||
unique_id = str(next(iter(device_entry.identifiers))[1])
|
unique_id = str(next(iter(device_entry.identifiers))[1])
|
||||||
device_entry_map[unique_id] = device_entry
|
device_entry_map[unique_id] = device_entry
|
||||||
|
if unique_id.startswith(mac_address):
|
||||||
|
# Already in the correct format
|
||||||
|
continue
|
||||||
if (suffix := unique_id.removeprefix(str(serial_number))) != unique_id:
|
if (suffix := unique_id.removeprefix(str(serial_number))) != unique_id:
|
||||||
migrations[unique_id] = f"{mac_address}{suffix}"
|
migrations[unique_id] = f"{mac_address}{suffix}"
|
||||||
|
|
||||||
|
@ -243,10 +243,6 @@ async def async_setup_entry(
|
|||||||
|
|
||||||
await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS)
|
await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS)
|
||||||
|
|
||||||
config_entry.async_on_unload(
|
|
||||||
config_entry.add_update_listener(entry_update_listener)
|
|
||||||
)
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
@ -295,13 +291,6 @@ async def register_callbacks(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def entry_update_listener(
|
|
||||||
hass: HomeAssistant, config_entry: ReolinkConfigEntry
|
|
||||||
) -> None:
|
|
||||||
"""Update the configuration of the host entity."""
|
|
||||||
await hass.config_entries.async_reload(config_entry.entry_id)
|
|
||||||
|
|
||||||
|
|
||||||
async def async_unload_entry(
|
async def async_unload_entry(
|
||||||
hass: HomeAssistant, config_entry: ReolinkConfigEntry
|
hass: HomeAssistant, config_entry: ReolinkConfigEntry
|
||||||
) -> bool:
|
) -> bool:
|
||||||
|
@ -23,7 +23,7 @@ from homeassistant.config_entries import (
|
|||||||
SOURCE_RECONFIGURE,
|
SOURCE_RECONFIGURE,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
OptionsFlow,
|
OptionsFlowWithReload,
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
@ -61,7 +61,7 @@ DEFAULT_OPTIONS = {CONF_PROTOCOL: DEFAULT_PROTOCOL}
|
|||||||
API_STARTUP_TIME = 5
|
API_STARTUP_TIME = 5
|
||||||
|
|
||||||
|
|
||||||
class ReolinkOptionsFlowHandler(OptionsFlow):
|
class ReolinkOptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Handle Reolink options."""
|
"""Handle Reolink options."""
|
||||||
|
|
||||||
async def async_step_init(
|
async def async_step_init(
|
||||||
|
@ -402,7 +402,12 @@
|
|||||||
"default": "mdi:thermometer"
|
"default": "mdi:thermometer"
|
||||||
},
|
},
|
||||||
"battery_state": {
|
"battery_state": {
|
||||||
"default": "mdi:battery-charging"
|
"default": "mdi:battery-unknown",
|
||||||
|
"state": {
|
||||||
|
"discharging": "mdi:battery-minus-variant",
|
||||||
|
"charging": "mdi:battery-charging",
|
||||||
|
"chargecomplete": "mdi:battery-check"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"day_night_state": {
|
"day_night_state": {
|
||||||
"default": "mdi:theme-light-dark"
|
"default": "mdi:theme-light-dark"
|
||||||
|
@ -43,8 +43,6 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
async def async_setup_entry(hass: HomeAssistant, entry: RoborockConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistant, entry: RoborockConfigEntry) -> bool:
|
||||||
"""Set up roborock from a config entry."""
|
"""Set up roborock from a config entry."""
|
||||||
|
|
||||||
entry.async_on_unload(entry.add_update_listener(update_listener))
|
|
||||||
|
|
||||||
user_data = UserData.from_dict(entry.data[CONF_USER_DATA])
|
user_data = UserData.from_dict(entry.data[CONF_USER_DATA])
|
||||||
api_client = RoborockApiClient(
|
api_client = RoborockApiClient(
|
||||||
entry.data[CONF_USERNAME],
|
entry.data[CONF_USERNAME],
|
||||||
@ -336,12 +334,6 @@ async def async_unload_entry(hass: HomeAssistant, entry: RoborockConfigEntry) ->
|
|||||||
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||||
|
|
||||||
|
|
||||||
async def update_listener(hass: HomeAssistant, entry: RoborockConfigEntry) -> None:
|
|
||||||
"""Handle options update."""
|
|
||||||
# Reload entry to update data
|
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
|
|
||||||
|
|
||||||
async def async_remove_entry(hass: HomeAssistant, entry: RoborockConfigEntry) -> None:
|
async def async_remove_entry(hass: HomeAssistant, entry: RoborockConfigEntry) -> None:
|
||||||
"""Handle removal of an entry."""
|
"""Handle removal of an entry."""
|
||||||
await async_remove_map_storage(hass, entry.entry_id)
|
await async_remove_map_storage(hass, entry.entry_id)
|
||||||
|
@ -23,7 +23,7 @@ from homeassistant.config_entries import (
|
|||||||
SOURCE_REAUTH,
|
SOURCE_REAUTH,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
OptionsFlow,
|
OptionsFlowWithReload,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_USERNAME
|
from homeassistant.const import CONF_USERNAME
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
@ -124,14 +124,9 @@ class RoborockFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
if self.source == SOURCE_REAUTH:
|
if self.source == SOURCE_REAUTH:
|
||||||
self._abort_if_unique_id_mismatch(reason="wrong_account")
|
self._abort_if_unique_id_mismatch(reason="wrong_account")
|
||||||
reauth_entry = self._get_reauth_entry()
|
reauth_entry = self._get_reauth_entry()
|
||||||
self.hass.config_entries.async_update_entry(
|
return self.async_update_reload_and_abort(
|
||||||
reauth_entry,
|
reauth_entry, data_updates={CONF_USER_DATA: user_data.as_dict()}
|
||||||
data={
|
|
||||||
**reauth_entry.data,
|
|
||||||
CONF_USER_DATA: user_data.as_dict(),
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
return self.async_abort(reason="reauth_successful")
|
|
||||||
self._abort_if_unique_id_configured(error="already_configured_account")
|
self._abort_if_unique_id_configured(error="already_configured_account")
|
||||||
return self._create_entry(self._client, self._username, user_data)
|
return self._create_entry(self._client, self._username, user_data)
|
||||||
|
|
||||||
@ -202,7 +197,7 @@ class RoborockFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
return RoborockOptionsFlowHandler(config_entry)
|
return RoborockOptionsFlowHandler(config_entry)
|
||||||
|
|
||||||
|
|
||||||
class RoborockOptionsFlowHandler(OptionsFlow):
|
class RoborockOptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Handle an option flow for Roborock."""
|
"""Handle an option flow for Roborock."""
|
||||||
|
|
||||||
def __init__(self, config_entry: RoborockConfigEntry) -> None:
|
def __init__(self, config_entry: RoborockConfigEntry) -> None:
|
||||||
|
@ -5,5 +5,5 @@
|
|||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/integrations/schlage",
|
"documentation": "https://www.home-assistant.io/integrations/schlage",
|
||||||
"iot_class": "cloud_polling",
|
"iot_class": "cloud_polling",
|
||||||
"requirements": ["pyschlage==2025.4.0"]
|
"requirements": ["pyschlage==2025.7.2"]
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,6 @@ from homeassistant.exceptions import ConfigEntryNotReady
|
|||||||
|
|
||||||
from .const import CONF_SYSTEM_ID, DATA_SOMFY_MYLINK, DOMAIN, MYLINK_STATUS, PLATFORMS
|
from .const import CONF_SYSTEM_ID, DATA_SOMFY_MYLINK, DOMAIN, MYLINK_STATUS, PLATFORMS
|
||||||
|
|
||||||
UNDO_UPDATE_LISTENER = "undo_update_listener"
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@ -44,12 +42,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
if "result" not in mylink_status:
|
if "result" not in mylink_status:
|
||||||
raise ConfigEntryNotReady("The Somfy MyLink device returned an empty result")
|
raise ConfigEntryNotReady("The Somfy MyLink device returned an empty result")
|
||||||
|
|
||||||
undo_listener = entry.add_update_listener(_async_update_listener)
|
|
||||||
|
|
||||||
hass.data[DOMAIN][entry.entry_id] = {
|
hass.data[DOMAIN][entry.entry_id] = {
|
||||||
DATA_SOMFY_MYLINK: somfy_mylink,
|
DATA_SOMFY_MYLINK: somfy_mylink,
|
||||||
MYLINK_STATUS: mylink_status,
|
MYLINK_STATUS: mylink_status,
|
||||||
UNDO_UPDATE_LISTENER: undo_listener,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||||
@ -57,18 +52,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def _async_update_listener(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
|
||||||
"""Handle options update."""
|
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
|
|
||||||
|
|
||||||
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Unload a config entry."""
|
"""Unload a config entry."""
|
||||||
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
if unload_ok := await hass.config_entries.async_unload_platforms(entry, PLATFORMS):
|
||||||
|
|
||||||
hass.data[DOMAIN][entry.entry_id][UNDO_UPDATE_LISTENER]()
|
|
||||||
|
|
||||||
if unload_ok:
|
|
||||||
hass.data[DOMAIN].pop(entry.entry_id)
|
hass.data[DOMAIN].pop(entry.entry_id)
|
||||||
|
|
||||||
return unload_ok
|
return unload_ok
|
||||||
|
@ -14,7 +14,7 @@ from homeassistant.config_entries import (
|
|||||||
ConfigEntryState,
|
ConfigEntryState,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
OptionsFlow,
|
OptionsFlowWithReload,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_HOST, CONF_PORT
|
from homeassistant.const import CONF_HOST, CONF_PORT
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
@ -125,7 +125,7 @@ class SomfyConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
return OptionsFlowHandler(config_entry)
|
return OptionsFlowHandler(config_entry)
|
||||||
|
|
||||||
|
|
||||||
class OptionsFlowHandler(OptionsFlow):
|
class OptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Handle a option flow for somfy_mylink."""
|
"""Handle a option flow for somfy_mylink."""
|
||||||
|
|
||||||
def __init__(self, config_entry: ConfigEntry) -> None:
|
def __init__(self, config_entry: ConfigEntry) -> None:
|
||||||
|
@ -42,7 +42,6 @@ async def async_setup_entry(
|
|||||||
async_at_started(hass, _async_finish_startup)
|
async_at_started(hass, _async_finish_startup)
|
||||||
|
|
||||||
await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS)
|
await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS)
|
||||||
config_entry.async_on_unload(config_entry.add_update_listener(update_listener))
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -52,10 +51,3 @@ async def async_unload_entry(
|
|||||||
) -> bool:
|
) -> bool:
|
||||||
"""Unload SpeedTest Entry from config_entry."""
|
"""Unload SpeedTest Entry from config_entry."""
|
||||||
return await hass.config_entries.async_unload_platforms(config_entry, PLATFORMS)
|
return await hass.config_entries.async_unload_platforms(config_entry, PLATFORMS)
|
||||||
|
|
||||||
|
|
||||||
async def update_listener(
|
|
||||||
hass: HomeAssistant, config_entry: SpeedTestConfigEntry
|
|
||||||
) -> None:
|
|
||||||
"""Handle options update."""
|
|
||||||
await hass.config_entries.async_reload(config_entry.entry_id)
|
|
||||||
|
@ -6,7 +6,11 @@ from typing import Any
|
|||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult, OptionsFlow
|
from homeassistant.config_entries import (
|
||||||
|
ConfigFlow,
|
||||||
|
ConfigFlowResult,
|
||||||
|
OptionsFlowWithReload,
|
||||||
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
@ -45,7 +49,7 @@ class SpeedTestFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
return self.async_create_entry(title=DEFAULT_NAME, data=user_input)
|
return self.async_create_entry(title=DEFAULT_NAME, data=user_input)
|
||||||
|
|
||||||
|
|
||||||
class SpeedTestOptionsFlowHandler(OptionsFlow):
|
class SpeedTestOptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Handle SpeedTest options."""
|
"""Handle SpeedTest options."""
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
|
@ -87,11 +87,6 @@ def remove_configured_db_url_if_not_needed(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def async_update_listener(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
|
||||||
"""Update listener for options."""
|
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
"""Set up SQL from yaml config."""
|
"""Set up SQL from yaml config."""
|
||||||
if (conf := config.get(DOMAIN)) is None:
|
if (conf := config.get(DOMAIN)) is None:
|
||||||
@ -115,8 +110,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
if entry.options.get(CONF_DB_URL) == get_instance(hass).db_url:
|
if entry.options.get(CONF_DB_URL) == get_instance(hass).db_url:
|
||||||
remove_configured_db_url_if_not_needed(hass, entry)
|
remove_configured_db_url_if_not_needed(hass, entry)
|
||||||
|
|
||||||
entry.async_on_unload(entry.add_update_listener(async_update_listener))
|
|
||||||
|
|
||||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
@ -23,7 +23,7 @@ from homeassistant.config_entries import (
|
|||||||
ConfigEntry,
|
ConfigEntry,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
OptionsFlow,
|
OptionsFlowWithReload,
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_DEVICE_CLASS,
|
CONF_DEVICE_CLASS,
|
||||||
@ -209,7 +209,7 @@ class SQLConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class SQLOptionsFlowHandler(OptionsFlow):
|
class SQLOptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Handle SQL options."""
|
"""Handle SQL options."""
|
||||||
|
|
||||||
async def async_step_init(
|
async def async_step_init(
|
||||||
|
@ -112,9 +112,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: SqueezeboxConfigEntry) -
|
|||||||
if not status:
|
if not status:
|
||||||
# pysqueezebox's async_query returns None on various issues,
|
# pysqueezebox's async_query returns None on various issues,
|
||||||
# including HTTP errors where it sets lms.http_status.
|
# including HTTP errors where it sets lms.http_status.
|
||||||
http_status = getattr(lms, "http_status", "N/A")
|
|
||||||
|
|
||||||
if http_status == HTTPStatus.UNAUTHORIZED:
|
if lms.http_status == HTTPStatus.UNAUTHORIZED:
|
||||||
_LOGGER.warning("Authentication failed for Squeezebox server %s", host)
|
_LOGGER.warning("Authentication failed for Squeezebox server %s", host)
|
||||||
raise ConfigEntryAuthFailed(
|
raise ConfigEntryAuthFailed(
|
||||||
translation_domain=DOMAIN,
|
translation_domain=DOMAIN,
|
||||||
@ -128,14 +127,14 @@ async def async_setup_entry(hass: HomeAssistant, entry: SqueezeboxConfigEntry) -
|
|||||||
_LOGGER.warning(
|
_LOGGER.warning(
|
||||||
"LMS %s returned no status or an error (HTTP status: %s). Retrying setup",
|
"LMS %s returned no status or an error (HTTP status: %s). Retrying setup",
|
||||||
host,
|
host,
|
||||||
http_status,
|
lms.http_status,
|
||||||
)
|
)
|
||||||
raise ConfigEntryNotReady(
|
raise ConfigEntryNotReady(
|
||||||
translation_domain=DOMAIN,
|
translation_domain=DOMAIN,
|
||||||
translation_key="init_get_status_failed",
|
translation_key="init_get_status_failed",
|
||||||
translation_placeholders={
|
translation_placeholders={
|
||||||
"host": str(host),
|
"host": str(host),
|
||||||
"http_status": str(http_status),
|
"http_status": str(lms.http_status),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ async def async_setup_entry(
|
|||||||
|
|
||||||
|
|
||||||
class ServerStatusBinarySensor(LMSStatusEntity, BinarySensorEntity):
|
class ServerStatusBinarySensor(LMSStatusEntity, BinarySensorEntity):
|
||||||
"""LMS Status based sensor from LMS via cooridnatior."""
|
"""LMS Status based sensor from LMS via coordinator."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self) -> bool:
|
def is_on(self) -> bool:
|
||||||
|
@ -30,7 +30,7 @@ from .const import (
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class LMSStatusDataUpdateCoordinator(DataUpdateCoordinator):
|
class LMSStatusDataUpdateCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||||
"""LMS Status custom coordinator."""
|
"""LMS Status custom coordinator."""
|
||||||
|
|
||||||
config_entry: SqueezeboxConfigEntry
|
config_entry: SqueezeboxConfigEntry
|
||||||
@ -59,13 +59,13 @@ class LMSStatusDataUpdateCoordinator(DataUpdateCoordinator):
|
|||||||
else:
|
else:
|
||||||
_LOGGER.warning("Can't query server capabilities %s", self.lms.name)
|
_LOGGER.warning("Can't query server capabilities %s", self.lms.name)
|
||||||
|
|
||||||
async def _async_update_data(self) -> dict:
|
async def _async_update_data(self) -> dict[str, Any]:
|
||||||
"""Fetch data from LMS status call.
|
"""Fetch data from LMS status call.
|
||||||
|
|
||||||
Then we process only a subset to make then nice for HA
|
Then we process only a subset to make then nice for HA
|
||||||
"""
|
"""
|
||||||
async with timeout(STATUS_API_TIMEOUT):
|
async with timeout(STATUS_API_TIMEOUT):
|
||||||
data: dict | None = await self.lms.async_prepared_status()
|
data: dict[str, Any] | None = await self.lms.async_prepared_status()
|
||||||
|
|
||||||
if not data:
|
if not data:
|
||||||
raise UpdateFailed(
|
raise UpdateFailed(
|
||||||
@ -111,7 +111,7 @@ class SqueezeBoxPlayerUpdateCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
|||||||
# Only update players available at last update, unavailable players are rediscovered instead
|
# Only update players available at last update, unavailable players are rediscovered instead
|
||||||
await self.player.async_update()
|
await self.player.async_update()
|
||||||
|
|
||||||
if self.player.connected is False:
|
if not self.player.connected:
|
||||||
_LOGGER.info("Player %s is not available", self.name)
|
_LOGGER.info("Player %s is not available", self.name)
|
||||||
self.available = False
|
self.available = False
|
||||||
|
|
||||||
|
@ -226,10 +226,7 @@ def get_announce_timeout(extra: dict) -> int | None:
|
|||||||
|
|
||||||
|
|
||||||
class SqueezeBoxMediaPlayerEntity(SqueezeboxEntity, MediaPlayerEntity):
|
class SqueezeBoxMediaPlayerEntity(SqueezeboxEntity, MediaPlayerEntity):
|
||||||
"""Representation of the media player features of a SqueezeBox device.
|
"""Representation of the media player features of a SqueezeBox device."""
|
||||||
|
|
||||||
Wraps a pysqueezebox.Player() object.
|
|
||||||
"""
|
|
||||||
|
|
||||||
_attr_supported_features = (
|
_attr_supported_features = (
|
||||||
MediaPlayerEntityFeature.BROWSE_MEDIA
|
MediaPlayerEntityFeature.BROWSE_MEDIA
|
||||||
@ -286,9 +283,11 @@ class SqueezeBoxMediaPlayerEntity(SqueezeboxEntity, MediaPlayerEntity):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def browse_limit(self) -> int:
|
def browse_limit(self) -> int:
|
||||||
"""Return the step to be used for volume up down."""
|
"""Return the max number of items to return from browse."""
|
||||||
return self.coordinator.config_entry.options.get( # type: ignore[no-any-return]
|
return int(
|
||||||
CONF_BROWSE_LIMIT, DEFAULT_BROWSE_LIMIT
|
self.coordinator.config_entry.options.get(
|
||||||
|
CONF_BROWSE_LIMIT, DEFAULT_BROWSE_LIMIT
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -88,7 +88,7 @@ async def async_setup_entry(
|
|||||||
|
|
||||||
|
|
||||||
class ServerStatusSensor(LMSStatusEntity, SensorEntity):
|
class ServerStatusSensor(LMSStatusEntity, SensorEntity):
|
||||||
"""LMS Status based sensor from LMS via cooridnatior."""
|
"""LMS Status based sensor from LMS via coordinator."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def native_value(self) -> StateType:
|
def native_value(self) -> StateType:
|
||||||
|
@ -136,7 +136,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: SynologyDSMConfigEntry)
|
|||||||
coordinator_switches=coordinator_switches,
|
coordinator_switches=coordinator_switches,
|
||||||
)
|
)
|
||||||
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_update_listener))
|
|
||||||
|
|
||||||
if entry.options[CONF_BACKUP_SHARE]:
|
if entry.options[CONF_BACKUP_SHARE]:
|
||||||
|
|
||||||
@ -172,13 +171,6 @@ async def async_unload_entry(
|
|||||||
return unload_ok
|
return unload_ok
|
||||||
|
|
||||||
|
|
||||||
async def _async_update_listener(
|
|
||||||
hass: HomeAssistant, entry: SynologyDSMConfigEntry
|
|
||||||
) -> None:
|
|
||||||
"""Handle options update."""
|
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
|
|
||||||
|
|
||||||
async def async_remove_config_entry_device(
|
async def async_remove_config_entry_device(
|
||||||
hass: HomeAssistant, entry: SynologyDSMConfigEntry, device_entry: dr.DeviceEntry
|
hass: HomeAssistant, entry: SynologyDSMConfigEntry, device_entry: dr.DeviceEntry
|
||||||
) -> bool:
|
) -> bool:
|
||||||
|
@ -24,7 +24,7 @@ from homeassistant.config_entries import (
|
|||||||
ConfigEntry,
|
ConfigEntry,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
OptionsFlow,
|
OptionsFlowWithReload,
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_DISKS,
|
CONF_DISKS,
|
||||||
@ -441,7 +441,7 @@ class SynologyDSMFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
class SynologyDSMOptionsFlowHandler(OptionsFlow):
|
class SynologyDSMOptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Handle a option flow."""
|
"""Handle a option flow."""
|
||||||
|
|
||||||
config_entry: SynologyDSMConfigEntry
|
config_entry: SynologyDSMConfigEntry
|
||||||
|
@ -23,8 +23,6 @@ async def async_setup_entry(
|
|||||||
|
|
||||||
entry.runtime_data = coordinator
|
entry.runtime_data = coordinator
|
||||||
|
|
||||||
entry.async_on_unload(entry.add_update_listener(_async_update_listener))
|
|
||||||
|
|
||||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
@ -35,10 +33,3 @@ async def async_unload_entry(
|
|||||||
) -> bool:
|
) -> bool:
|
||||||
"""Unload Tankerkoenig config entry."""
|
"""Unload Tankerkoenig config entry."""
|
||||||
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||||
|
|
||||||
|
|
||||||
async def _async_update_listener(
|
|
||||||
hass: HomeAssistant, entry: TankerkoenigConfigEntry
|
|
||||||
) -> None:
|
|
||||||
"""Handle options update."""
|
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
|
@ -18,7 +18,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,
|
||||||
@ -229,7 +229,7 @@ class FlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class OptionsFlowHandler(OptionsFlow):
|
class OptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Handle an options flow."""
|
"""Handle an options flow."""
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
|
@ -42,7 +42,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: TVTrainConfigEntry) -> b
|
|||||||
)
|
)
|
||||||
|
|
||||||
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(update_listener))
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -53,11 +52,6 @@ async def async_unload_entry(hass: HomeAssistant, entry: TVTrainConfigEntry) ->
|
|||||||
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||||
|
|
||||||
|
|
||||||
async def update_listener(hass: HomeAssistant, entry: TVTrainConfigEntry) -> None:
|
|
||||||
"""Handle options update."""
|
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
|
|
||||||
|
|
||||||
async def async_migrate_entry(hass: HomeAssistant, entry: TVTrainConfigEntry) -> bool:
|
async def async_migrate_entry(hass: HomeAssistant, entry: TVTrainConfigEntry) -> bool:
|
||||||
"""Migrate config entry."""
|
"""Migrate config entry."""
|
||||||
_LOGGER.debug("Migrating from version %s", entry.version)
|
_LOGGER.debug("Migrating from version %s", entry.version)
|
||||||
|
@ -20,7 +20,7 @@ from homeassistant.config_entries import (
|
|||||||
ConfigEntry,
|
ConfigEntry,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
OptionsFlow,
|
OptionsFlowWithReload,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_API_KEY, CONF_NAME, CONF_WEEKDAY, WEEKDAYS
|
from homeassistant.const import CONF_API_KEY, CONF_NAME, CONF_WEEKDAY, WEEKDAYS
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
@ -329,7 +329,7 @@ class TVTrainConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class TVTrainOptionsFlowHandler(OptionsFlow):
|
class TVTrainOptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Handle Trafikverket Train options."""
|
"""Handle Trafikverket Train options."""
|
||||||
|
|
||||||
async def async_step_init(
|
async def async_step_init(
|
||||||
|
@ -114,7 +114,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: UFPConfigEntry) -> bool:
|
|||||||
hass.config_entries.async_update_entry(entry, unique_id=nvr_info.mac)
|
hass.config_entries.async_update_entry(entry, unique_id=nvr_info.mac)
|
||||||
|
|
||||||
entry.runtime_data = data_service
|
entry.runtime_data = data_service
|
||||||
entry.async_on_unload(entry.add_update_listener(_async_options_updated))
|
|
||||||
entry.async_on_unload(
|
entry.async_on_unload(
|
||||||
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, data_service.async_stop)
|
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, data_service.async_stop)
|
||||||
)
|
)
|
||||||
@ -139,11 +138,6 @@ async def _async_setup_entry(
|
|||||||
hass.http.register_view(VideoEventProxyView(hass))
|
hass.http.register_view(VideoEventProxyView(hass))
|
||||||
|
|
||||||
|
|
||||||
async def _async_options_updated(hass: HomeAssistant, entry: UFPConfigEntry) -> None:
|
|
||||||
"""Update options."""
|
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
|
|
||||||
|
|
||||||
async def async_unload_entry(hass: HomeAssistant, entry: UFPConfigEntry) -> bool:
|
async def async_unload_entry(hass: HomeAssistant, entry: UFPConfigEntry) -> bool:
|
||||||
"""Unload UniFi Protect config entry."""
|
"""Unload UniFi Protect config entry."""
|
||||||
if unload_ok := await hass.config_entries.async_unload_platforms(entry, PLATFORMS):
|
if unload_ok := await hass.config_entries.async_unload_platforms(entry, PLATFORMS):
|
||||||
|
@ -20,7 +20,7 @@ from homeassistant.config_entries import (
|
|||||||
ConfigEntryState,
|
ConfigEntryState,
|
||||||
ConfigFlow,
|
ConfigFlow,
|
||||||
ConfigFlowResult,
|
ConfigFlowResult,
|
||||||
OptionsFlow,
|
OptionsFlowWithReload,
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
@ -223,7 +223,7 @@ class ProtectFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
@callback
|
@callback
|
||||||
def async_get_options_flow(
|
def async_get_options_flow(
|
||||||
config_entry: ConfigEntry,
|
config_entry: ConfigEntry,
|
||||||
) -> OptionsFlow:
|
) -> OptionsFlowHandler:
|
||||||
"""Get the options flow for this handler."""
|
"""Get the options flow for this handler."""
|
||||||
return OptionsFlowHandler()
|
return OptionsFlowHandler()
|
||||||
|
|
||||||
@ -372,7 +372,7 @@ class ProtectFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class OptionsFlowHandler(OptionsFlow):
|
class OptionsFlowHandler(OptionsFlowWithReload):
|
||||||
"""Handle options."""
|
"""Handle options."""
|
||||||
|
|
||||||
async def async_step_init(
|
async def async_step_init(
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user