1 """SMLIGHT SLZB Zigbee device integration."""
3 from __future__
import annotations
5 from dataclasses
import dataclass
7 from pysmlight
import Api2
14 from .coordinator
import SmDataUpdateCoordinator, SmFirmwareUpdateCoordinator
16 PLATFORMS: list[Platform] = [
17 Platform.BINARY_SENSOR,
25 @dataclass(kw_only=True)
27 """Coordinator data class."""
29 data: SmDataUpdateCoordinator
30 firmware: SmFirmwareUpdateCoordinator
33 type SmConfigEntry = ConfigEntry[SmlightData]
37 """Set up SMLIGHT Zigbee from a config entry."""
42 hass, entry.data[CONF_HOST], client
45 await data_coordinator.async_config_entry_first_refresh()
46 await firmware_coordinator.async_config_entry_first_refresh()
48 if data_coordinator.data.info.legacy_api < 2:
49 entry.async_create_background_task(
50 hass, client.sse.client(),
"smlight-sse-client"
54 data=data_coordinator, firmware=firmware_coordinator
57 await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
62 """Unload a config entry."""
63 return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
bool async_setup_entry(HomeAssistant hass, SmConfigEntry entry)
bool async_unload_entry(HomeAssistant hass, SmConfigEntry 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)