1 """The Roth Touchline SL integration."""
3 from __future__
import annotations
7 from pytouchlinesl
import TouchlineSL
14 from .const
import DOMAIN
15 from .coordinator
import TouchlineSLModuleCoordinator
17 PLATFORMS: list[Platform] = [Platform.CLIMATE]
19 type TouchlineSLConfigEntry = ConfigEntry[list[TouchlineSLModuleCoordinator]]
23 """Set up Roth Touchline SL from a config entry."""
24 account = TouchlineSL(
25 username=entry.data[CONF_USERNAME], password=entry.data[CONF_PASSWORD]
28 coordinators: list[TouchlineSLModuleCoordinator] = [
34 coordinator.async_config_entry_first_refresh()
35 for coordinator
in coordinators
39 device_registry = dr.async_get(hass)
42 for c
in coordinators:
43 module = c.data.module
44 device_registry.async_get_or_create(
45 config_entry_id=entry.entry_id,
46 identifiers={(DOMAIN, module.id)},
50 sw_version=module.version,
53 entry.runtime_data = coordinators
54 await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
60 hass: HomeAssistant, entry: TouchlineSLConfigEntry
62 """Unload a config entry."""
63 return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
bool async_unload_entry(HomeAssistant hass, TouchlineSLConfigEntry entry)
bool async_setup_entry(HomeAssistant hass, TouchlineSLConfigEntry entry)