1 """Platform for light 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 .devolo_multi_level_switch
import DevoloMultiLevelSwitchDeviceEntity
20 entry: DevoloHomeControlConfigEntry,
21 async_add_entities: AddEntitiesCallback,
23 """Get all light devices and setup them via config entry."""
28 device_instance=device,
29 element_uid=multi_level_switch.element_uid,
31 for gateway
in entry.runtime_data
32 for device
in gateway.multi_level_switch_devices
33 for multi_level_switch
in device.multi_level_switch_property.values()
34 if multi_level_switch.switch_type ==
"dimmer"
39 """Representation of a light within devolo Home Control."""
41 _attr_color_mode = ColorMode.BRIGHTNESS
44 self, homecontrol: HomeControl, device_instance: Zwave, element_uid: str
46 """Initialize a devolo multi level switch."""
48 homecontrol=homecontrol,
49 device_instance=device_instance,
50 element_uid=element_uid,
55 element_uid.replace(
"Dimmer",
"BinarySwitch")
60 """Return the brightness value of the light."""
65 """Return the state of the light."""
70 if kwargs.get(ATTR_BRIGHTNESS)
is not None:
72 round(kwargs[ATTR_BRIGHTNESS] / 255 * 100)
82 """Turn device off."""
_multi_level_switch_property
None __init__(self, HomeControl homecontrol, Zwave device_instance, str element_uid)
None turn_off(self, **Any kwargs)
None turn_on(self, **Any kwargs)
_attr_supported_color_modes
None async_setup_entry(HomeAssistant hass, DevoloHomeControlConfigEntry entry, AddEntitiesCallback async_add_entities)