1 """Representation of a switchBinary."""
9 SwitchEntityDescription,
16 from .const
import DOMAIN, ZWaveMePlatform
17 from .entity
import ZWaveMeEntity
19 _LOGGER = logging.getLogger(__name__)
20 DEVICE_NAME = ZWaveMePlatform.SWITCH
22 SWITCH_MAP: dict[str, SwitchEntityDescription] = {
25 device_class=SwitchDeviceClass.SWITCH,
32 config_entry: ConfigEntry,
33 async_add_entities: AddEntitiesCallback,
35 """Set up the switch platform."""
39 controller = hass.data[DOMAIN][config_entry.entry_id]
40 switch =
ZWaveMeSwitch(controller, new_device, SWITCH_MAP[
"generic"])
48 config_entry.async_on_unload(
50 hass, f
"ZWAVE_ME_NEW_{DEVICE_NAME.upper()}", add_new_device
56 """Representation of a ZWaveMe binary switch."""
58 def __init__(self, controller, device, description):
59 """Initialize the device."""
65 """Return the state of the switch."""
66 return self.
devicedevice.level ==
"on"
69 """Turn the entity on."""
73 """Turn the entity off."""
74 self.
controllercontroller.zwave_api.send_command(self.
devicedevice.id,
"off")
None turn_off(self, **Any kwargs)
None turn_on(self, **Any kwargs)
def __init__(self, controller, device, description)
def add_new_device(new_device)
None async_setup_entry(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)
Callable[[], None] async_dispatcher_connect(HomeAssistant hass, str signal, Callable[..., Any] target)