- Add button platform (button.py + PLATFORMS) so oven/washer Start/Pause/Stop controls actually appear in HA - Load DTLS cert chain from memory via _load_pem_chain(); eliminate all temp file writes for key material in config_flow and coordinator - Fix PEM boundary: ensure leaf and CA blocks are separated by a newline in the stored fullchain regardless of whether the user pasted a trailing newline - Dryer mode select: add static options tuple and value_fn to decode Course_XX hex strings back to human names; was permanently empty before - Remove callable branch from LocalThingsSelect (options_field covers dynamic case; callable contract was broken — called with no args vs Callable[[dict]]) - Guard native_min/max_value overrides with hasattr + super() fallback to prevent AttributeError when native_min=None and range_field returns nothing - Add async_close() public method to coordinator; __init__ now calls it instead of reaching in to _close_session directly - Update tests: rename CONF_CERT_PEM/KEY_PEM → CA/LEAF variants, add leaf_cert_pem/leaf_key_pem to mock_probe return, fix mock PEM constants (no trailing newlines, matching what .strip() stores)
34 lines
1.2 KiB
Python
34 lines
1.2 KiB
Python
"""Local Things — Samsung appliance local control integration."""
|
|
from __future__ import annotations
|
|
|
|
import logging
|
|
|
|
from homeassistant.config_entries import ConfigEntry
|
|
from homeassistant.core import HomeAssistant
|
|
from homeassistant.exceptions import ConfigEntryNotReady
|
|
|
|
from .const import DOMAIN, PLATFORMS
|
|
from .coordinator import LocalThingsCoordinator
|
|
|
|
_LOGGER = logging.getLogger(__name__)
|
|
|
|
|
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|
hass.data.setdefault(DOMAIN, {})
|
|
coordinator = LocalThingsCoordinator(hass, entry)
|
|
try:
|
|
await coordinator.async_config_entry_first_refresh()
|
|
except Exception as err:
|
|
raise ConfigEntryNotReady(f"Cannot connect to device: {err}") from err
|
|
hass.data[DOMAIN][entry.entry_id] = coordinator
|
|
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
|
return True
|
|
|
|
|
|
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|
unloaded = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
|
if unloaded:
|
|
coordinator: LocalThingsCoordinator = hass.data[DOMAIN].pop(entry.entry_id)
|
|
await coordinator.async_close()
|
|
return unloaded
|