2020-05-14 10:19:59 +00:00
|
|
|
"""Support for XBee Zigbee switches."""
|
2022-01-03 15:44:20 +00:00
|
|
|
from __future__ import annotations
|
|
|
|
|
2016-09-07 01:28:55 +00:00
|
|
|
import voluptuous as vol
|
|
|
|
|
2020-04-26 16:50:37 +00:00
|
|
|
from homeassistant.components.switch import SwitchEntity
|
2022-01-03 15:44:20 +00:00
|
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
|
|
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
2019-03-21 05:56:46 +00:00
|
|
|
|
2021-02-17 12:15:13 +00:00
|
|
|
from . import PLATFORM_SCHEMA, XBeeDigitalOut, XBeeDigitalOutConfig
|
|
|
|
from .const import CONF_ON_STATE, DOMAIN, STATES
|
2016-01-24 08:02:14 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({vol.Optional(CONF_ON_STATE): vol.In(STATES)})
|
2016-01-24 08:02:14 +00:00
|
|
|
|
|
|
|
|
2022-01-03 15:44:20 +00:00
|
|
|
def setup_platform(
|
|
|
|
hass: HomeAssistant,
|
|
|
|
config: ConfigType,
|
|
|
|
add_entities: AddEntitiesCallback,
|
|
|
|
discovery_info: DiscoveryInfoType | None = None,
|
|
|
|
) -> None:
|
2020-05-14 10:19:59 +00:00
|
|
|
"""Set up the XBee Zigbee switch platform."""
|
2020-04-07 15:41:23 +00:00
|
|
|
zigbee_device = hass.data[DOMAIN]
|
2020-05-14 10:19:59 +00:00
|
|
|
add_entities([XBeeSwitch(XBeeDigitalOutConfig(config), zigbee_device)])
|
2016-01-29 12:00:53 +00:00
|
|
|
|
|
|
|
|
2020-05-14 10:19:59 +00:00
|
|
|
class XBeeSwitch(XBeeDigitalOut, SwitchEntity):
|
|
|
|
"""Representation of a XBee Zigbee Digital Out device."""
|