2021-11-16 19:59:17 +00:00
|
|
|
"""Support for Hue lights."""
|
2021-10-23 13:35:33 +00:00
|
|
|
from __future__ import annotations
|
|
|
|
|
2021-11-16 19:59:17 +00:00
|
|
|
from homeassistant.config_entries import ConfigEntry
|
|
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
2014-11-12 05:39:17 +00:00
|
|
|
|
2021-11-16 19:59:17 +00:00
|
|
|
from .bridge import HueBridge
|
|
|
|
from .const import DOMAIN
|
|
|
|
from .v1.light import async_setup_entry as setup_entry_v1
|
|
|
|
from .v2.group import async_setup_entry as setup_groups_entry_v2
|
|
|
|
from .v2.light import async_setup_entry as setup_entry_v2
|
2016-09-20 10:35:10 +00:00
|
|
|
|
2019-10-23 05:58:57 +00:00
|
|
|
|
2021-11-16 19:59:17 +00:00
|
|
|
async def async_setup_entry(
|
|
|
|
hass: HomeAssistant,
|
|
|
|
config_entry: ConfigEntry,
|
|
|
|
async_add_entities: AddEntitiesCallback,
|
|
|
|
) -> None:
|
|
|
|
"""Set up light entities."""
|
|
|
|
bridge: HueBridge = hass.data[DOMAIN][config_entry.entry_id]
|
2014-11-12 05:39:17 +00:00
|
|
|
|
2021-11-16 19:59:17 +00:00
|
|
|
if bridge.api_version == 1:
|
|
|
|
await setup_entry_v1(hass, config_entry, async_add_entities)
|
2019-10-28 15:45:08 +00:00
|
|
|
return
|
2021-11-16 19:59:17 +00:00
|
|
|
# v2 setup logic here
|
|
|
|
await setup_entry_v2(hass, config_entry, async_add_entities)
|
|
|
|
await setup_groups_entry_v2(hass, config_entry, async_add_entities)
|