mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 09:47:52 +00:00

* Add APsystems local API integration * Fix session usage in config_flow in apsystems local api * Remove skip check option for apsystems_loca api * Update APsystems API dependency and increased test coverage to 100% * Utilize EntityDescriptions for APsystems Local integration * Ensure coverage entries are sorted (#114424) * Ensure coverage entries are sorted * Use autofix * Adjust * Add comment to coverage file * test CI * revert CI test --------- Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Use patch instead of Http Mocks for APsystems API tests * Fix linter waring for apsystemsapi * Fix apsystemsapi test * Fix CODEOWNERS for apsystemsapi * Address small PR review changes for apsystems_local * Remove wrong lines in coveragerc * Add serial number for apsystems_local * Remove option of custom refresh interval fro apsystems_local * Remove function override and fix stale comments * Use native device id and name storage instead of custom one for apsystems_local * Use runtime_data for apsystems_local * Don't store entry data in runtime data * Move from apsystems_local to apsystems domain --------- Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> Co-authored-by: Martin Hjelmare <marhje52@gmail.com> Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
"""The APsystems local API integration."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import logging
|
|
|
|
from APsystemsEZ1 import APsystemsEZ1M
|
|
|
|
from homeassistant.config_entries import ConfigEntry
|
|
from homeassistant.const import CONF_IP_ADDRESS, Platform
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
from .coordinator import ApSystemsDataCoordinator
|
|
|
|
_LOGGER = logging.getLogger(__name__)
|
|
|
|
PLATFORMS: list[Platform] = [Platform.SENSOR]
|
|
|
|
|
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|
"""Set up this integration using UI."""
|
|
entry.runtime_data = {}
|
|
api = APsystemsEZ1M(ip_address=entry.data[CONF_IP_ADDRESS], timeout=8)
|
|
coordinator = ApSystemsDataCoordinator(hass, api)
|
|
await coordinator.async_config_entry_first_refresh()
|
|
entry.runtime_data = {"COORDINATOR": coordinator}
|
|
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
|
|
|
return True
|
|
|
|
|
|
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|
"""Unload a config entry."""
|
|
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|