mirror of
https://github.com/home-assistant/core.git
synced 2026-09-20 08:43:45 +01:00
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: frenck <195327+frenck@users.noreply.github.com>
30 lines
743 B
Python
30 lines
743 B
Python
"""The Yale Access Bluetooth integration."""
|
|
|
|
from yalexs_ble import ValidatedLockConfig
|
|
|
|
from homeassistant.core import HomeAssistant, callback
|
|
from homeassistant.util.hass_dict import HassKey
|
|
|
|
CONFIG_CACHE: HassKey[dict[str, ValidatedLockConfig]] = HassKey(
|
|
"yalexs_ble_config_cache"
|
|
)
|
|
|
|
|
|
@callback
|
|
def async_add_validated_config(
|
|
hass: HomeAssistant,
|
|
address: str,
|
|
config: ValidatedLockConfig,
|
|
) -> None:
|
|
"""Add a validated config."""
|
|
hass.data.setdefault(CONFIG_CACHE, {})[address] = config
|
|
|
|
|
|
@callback
|
|
def async_get_validated_config(
|
|
hass: HomeAssistant,
|
|
address: str,
|
|
) -> ValidatedLockConfig | None:
|
|
"""Get the config for a specific address."""
|
|
return hass.data.get(CONFIG_CACHE, {}).get(address)
|