mirror of
https://github.com/home-assistant/core.git
synced 2026-06-01 21:24:17 +01:00
d766aae436
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: frenck <195327+frenck@users.noreply.github.com>
29 lines
880 B
Python
29 lines
880 B
Python
"""Support for Qwikswitch relays."""
|
|
|
|
from homeassistant.components.switch import SwitchEntity
|
|
from homeassistant.core import HomeAssistant
|
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
|
|
|
from .const import DATA_QUIKSWITCH, DOMAIN
|
|
from .entity import QSToggleEntity
|
|
|
|
|
|
async def async_setup_platform(
|
|
hass: HomeAssistant,
|
|
_: ConfigType,
|
|
add_entities: AddEntitiesCallback,
|
|
discovery_info: DiscoveryInfoType | None = None,
|
|
) -> None:
|
|
"""Add switches from the main Qwikswitch component."""
|
|
if discovery_info is None:
|
|
return
|
|
|
|
qsusb = hass.data[DATA_QUIKSWITCH]
|
|
devs = [QSSwitch(qsid, qsusb) for qsid in discovery_info[DOMAIN]]
|
|
add_entities(devs)
|
|
|
|
|
|
class QSSwitch(QSToggleEntity, SwitchEntity):
|
|
"""Switch based on a Qwikswitch relay module."""
|