1 """Support for XS1 switches."""
3 from __future__
import annotations
7 from xs1_api_client.api_constants
import ActuatorType
14 from .
import ACTUATORS, DOMAIN
as COMPONENT_DOMAIN
15 from .entity
import XS1DeviceEntity
21 add_entities: AddEntitiesCallback,
22 discovery_info: DiscoveryInfoType |
None =
None,
24 """Set up the XS1 switch platform."""
25 actuators = hass.data[COMPONENT_DOMAIN][ACTUATORS]
29 for actuator
in actuators
30 if (actuator.type() == ActuatorType.SWITCH)
31 or (actuator.type() == ActuatorType.DIMMER)
36 """Representation of a XS1 switch actuator."""
40 """Return the name of the device if any."""
45 """Return true if switch is on."""
46 return self.
devicedevice.value() == 100
49 """Turn the device on."""
53 """Turn the device off."""
None turn_off(self, **Any kwargs)
None turn_on(self, **Any kwargs)
None add_entities(AsusWrtRouter router, AddEntitiesCallback async_add_entities, set[str] tracked)
None setup_platform(HomeAssistant hass, ConfigType config, AddEntitiesCallback add_entities, DiscoveryInfoType|None discovery_info=None)