1 """Support for Qwikswitch devices."""
3 from __future__
import annotations
14 """Qwikswitch Entity base."""
16 _attr_should_poll =
False
19 """Initialize the QSEntity."""
25 """Return the name of the sensor."""
26 return self.
_name_name
30 """Return a unique identifier for this sensor."""
31 return f
"qs{self.qsid}"
35 """Receive update packet from QSUSB. Match dispather_send signature."""
39 """Listen for updates from QSUSb via dispatcher."""
46 """Representation of a Qwikswitch Toggle Entity.
49 - QSLight extends QSToggleEntity and Light[2] (ToggleEntity[1])
50 - QSSwitch extends QSToggleEntity and SwitchEntity[3] (ToggleEntity[1])
52 [1] /helpers/entity.py
53 [2] /components/light/__init__.py
54 [3] /components/switch/__init__.py
58 """Initialize the ToggleEntity."""
59 self.
devicedevice = qsusb.devices[qsid]
64 """Check if device is on (non-zero)."""
65 return self.
devicedevice.value > 0
68 """Turn the device on."""
69 new = kwargs.get(ATTR_BRIGHTNESS, 255)
70 self.
hasshass.data[DOMAIN].devices.set_value(self.
qsidqsid, new)
73 """Turn the device off."""
74 self.
hasshass.data[DOMAIN].devices.set_value(self.
qsidqsid, 0)
def __init__(self, qsid, name)
def async_added_to_hass(self)
def update_packet(self, packet)
def async_turn_on(self, **kwargs)
def __init__(self, qsid, qsusb)
def async_turn_off(self, **_)
None async_write_ha_state(self)
None async_on_remove(self, CALLBACK_TYPE func)
Callable[[], None] async_dispatcher_connect(HomeAssistant hass, str signal, Callable[..., Any] target)