1 """The IronOS integration."""
3 from __future__
import annotations
6 from typing
import TYPE_CHECKING
8 from aiogithubapi
import GitHubAPI
9 from pynecil
import Pynecil
21 from .const
import DOMAIN
22 from .coordinator
import IronOSFirmwareUpdateCoordinator, IronOSLiveDataCoordinator
24 PLATFORMS: list[Platform] = [Platform.NUMBER, Platform.SENSOR, Platform.UPDATE]
27 type IronOSConfigEntry = ConfigEntry[IronOSLiveDataCoordinator]
28 IRON_OS_KEY: HassKey[IronOSFirmwareUpdateCoordinator] =
HassKey(DOMAIN)
30 CONFIG_SCHEMA = cv.config_entry_only_config_schema(DOMAIN)
32 _LOGGER = logging.getLogger(__name__)
35 async
def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
36 """Set up IronOS firmware update coordinator."""
39 github = GitHubAPI(session=session)
42 await hass.data[IRON_OS_KEY].async_request_refresh()
47 """Set up IronOS from a config entry."""
49 assert entry.unique_id
50 ble_device = bluetooth.async_ble_device_from_address(
51 hass, entry.unique_id, connectable=
True
55 translation_domain=DOMAIN,
56 translation_key=
"setup_device_unavailable_exception",
57 translation_placeholders={CONF_NAME: entry.title},
60 device = Pynecil(ble_device)
63 await coordinator.async_config_entry_first_refresh()
65 entry.runtime_data = coordinator
66 await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
72 """Unload a config entry."""
73 return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
bool async_setup(HomeAssistant hass, ConfigType config)
bool async_unload_entry(HomeAssistant hass, IronOSConfigEntry entry)
bool async_setup_entry(HomeAssistant hass, IronOSConfigEntry entry)
aiohttp.ClientSession async_get_clientsession(HomeAssistant hass, bool verify_ssl=True, socket.AddressFamily family=socket.AF_UNSPEC, ssl_util.SSLCipherList ssl_cipher=ssl_util.SSLCipherList.PYTHON_DEFAULT)