2016-05-13 06:39:30 +02:00
|
|
|
"""
|
2016-05-21 16:59:52 +02:00
|
|
|
Support for Qwikswitch relays.
|
2016-05-13 06:39:30 +02:00
|
|
|
|
2016-05-21 16:59:52 +02:00
|
|
|
For more details about this platform, please refer to the documentation at
|
|
|
|
https://home-assistant.io/components/switch.qwikswitch/
|
2016-05-13 06:39:30 +02:00
|
|
|
"""
|
2018-03-29 23:29:46 +02:00
|
|
|
from homeassistant.components.qwikswitch import (
|
|
|
|
QSToggleEntity, DOMAIN as QWIKSWITCH)
|
|
|
|
from homeassistant.components.switch import SwitchDevice
|
2017-01-17 23:40:34 +01:00
|
|
|
|
2018-03-29 23:29:46 +02:00
|
|
|
DEPENDENCIES = [QWIKSWITCH]
|
2016-05-13 06:39:30 +02:00
|
|
|
|
|
|
|
|
2018-08-24 16:37:30 +02:00
|
|
|
async def async_setup_platform(hass, _, add_entities, discovery_info=None):
|
2018-03-25 23:32:13 +02:00
|
|
|
"""Add switches from the main Qwikswitch component."""
|
2016-07-24 02:03:29 +02:00
|
|
|
if discovery_info is None:
|
2018-03-29 23:29:46 +02:00
|
|
|
return
|
2016-05-13 06:39:30 +02:00
|
|
|
|
2018-03-29 23:29:46 +02:00
|
|
|
qsusb = hass.data[QWIKSWITCH]
|
|
|
|
devs = [QSSwitch(qsid, qsusb) for qsid in discovery_info[QWIKSWITCH]]
|
2018-08-24 16:37:30 +02:00
|
|
|
add_entities(devs)
|
2018-03-29 23:29:46 +02:00
|
|
|
|
|
|
|
|
|
|
|
class QSSwitch(QSToggleEntity, SwitchDevice):
|
|
|
|
"""Switch based on a Qwikswitch relay module."""
|