1 """Platform for switch integration."""
3 from __future__
import annotations
7 from devolo_home_control_api.devices.zwave
import Zwave
8 from devolo_home_control_api.homecontrol
import HomeControl
14 from .
import DevoloHomeControlConfigEntry
15 from .entity
import DevoloDeviceEntity
20 entry: DevoloHomeControlConfigEntry,
21 async_add_entities: AddEntitiesCallback,
23 """Get all devices and setup the switch devices via config entry."""
28 device_instance=device,
29 element_uid=binary_switch,
31 for gateway
in entry.runtime_data
32 for device
in gateway.binary_switch_devices
33 for binary_switch
in device.binary_switch_property
36 if not hasattr(device,
"multi_level_switch_property")
41 """Representation of a switch."""
46 self, homecontrol: HomeControl, device_instance: Zwave, element_uid: str
48 """Initialize a devolo Switch."""
50 homecontrol=homecontrol,
51 device_instance=device_instance,
52 element_uid=element_uid,
60 """Switch on the device."""
64 """Switch off the device."""
67 def _sync(self, message: tuple) ->
None:
68 """Update the binary switch state and consumption."""
69 if message[0].startswith(
"devolo.BinarySwitch"):
None _generic_message(self, tuple message)
None turn_on(self, **Any kwargs)
None _sync(self, tuple message)
None __init__(self, HomeControl homecontrol, Zwave device_instance, str element_uid)
None turn_off(self, **Any kwargs)
None schedule_update_ha_state(self, bool force_refresh=False)
None async_setup_entry(HomeAssistant hass, DevoloHomeControlConfigEntry entry, AddEntitiesCallback async_add_entities)