chore: initial baseline before refactoring

Initial snapshot of Home Assistant config (HAOS 2026.4.4)
prior to dashboard restructuring and helper YAML migration.

Pre-commit cleanup applied:
- Removed blueprints/switch_manager/ (9.4 MB stale, component already gone)
- Removed .storage/switch_manager
- Removed home-assistant.log.{1,old,fault}
- Removed zigbee2mqtt/configuration_backup_v{1..4}.yaml
- Removed zigbee2mqtt/database.db.tmp.2024-09-27 (1.5y old)
- Created empty themes/ to satisfy configuration.yaml include

.gitignore uses allowlist strategy for .storage/ to keep
all tokens, keys, and PINs out of version control.
This commit is contained in:
2026-05-02 14:24:53 +02:00
commit 5f01411780
149 changed files with 47886 additions and 0 deletions
@@ -0,0 +1,46 @@
from cx_const import DefaultActionsMapping, Light, Z2MLight
from cx_core import LightController, Z2MLightController
class AdeoHRC99CZC045LightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Light.ON,
"off": Light.OFF,
"brightness_step_up": Light.HOLD_BRIGHTNESS_UP,
"brightness_step_down": Light.HOLD_BRIGHTNESS_DOWN,
"brightness_stop": Light.RELEASE,
"color_hue_step_up": Light.HOLD_COLOR_UP,
"color_hue_step_down": Light.HOLD_COLOR_DOWN,
"color_saturation_step_up": Light.HOLD_COLOR_UP,
"color_saturation_step_down": Light.HOLD_COLOR_DOWN,
"color_temperature_step_up": Light.HOLD_COLOR_TEMP_UP,
"color_temperature_step_down": Light.HOLD_COLOR_TEMP_DOWN,
"color_stop": Light.RELEASE,
"scene_1": None,
"scene_2": None,
"scene_3": None,
"scene_4": None,
}
class AdeoHRC99CZC045Z2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Z2MLight.ON,
"off": Z2MLight.OFF,
"brightness_step_up": Z2MLight.HOLD_BRIGHTNESS_UP,
"brightness_step_down": Z2MLight.HOLD_BRIGHTNESS_DOWN,
"brightness_stop": Z2MLight.RELEASE,
"color_hue_step_up": Z2MLight.HOLD_COLOR_TEMP_UP,
"color_hue_step_down": Z2MLight.HOLD_COLOR_TEMP_DOWN,
"color_saturation_step_up": Z2MLight.HOLD_COLOR_TEMP_UP,
"color_saturation_step_down": Z2MLight.HOLD_COLOR_TEMP_DOWN,
"color_temperature_step_up": Z2MLight.HOLD_COLOR_TEMP_UP,
"color_temperature_step_down": Z2MLight.HOLD_COLOR_TEMP_DOWN,
"color_stop": Z2MLight.RELEASE,
"scene_1": None,
"scene_2": None,
"scene_3": None,
"scene_4": None,
}
@@ -0,0 +1,878 @@
from cx_const import DefaultActionsMapping, Light, MediaPlayer, Switch, Z2MLight
from cx_core import (
LightController,
MediaPlayerController,
SwitchController,
Z2MLightController,
)
from cx_core.integration import EventData
class WXKG02LMLightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"single_both": Light.TOGGLE,
"double_both": Light.CLICK_BRIGHTNESS_UP,
"hold_both": Light.CLICK_BRIGHTNESS_DOWN,
"single_left": Light.TOGGLE,
"double_left": Light.CLICK_BRIGHTNESS_UP,
"hold_left": Light.CLICK_BRIGHTNESS_DOWN,
"single_right": Light.TOGGLE,
"double_right": Light.CLICK_BRIGHTNESS_UP,
"hold_right": Light.CLICK_BRIGHTNESS_DOWN,
}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1002: Light.TOGGLE, # single left
1001: Light.CLICK_BRIGHTNESS_DOWN, # long left
1004: Light.CLICK_BRIGHTNESS_UP, # double left
2002: Light.TOGGLE, # single right
2001: Light.CLICK_BRIGHTNESS_DOWN, # long right
2004: Light.CLICK_BRIGHTNESS_UP, # double right
3002: Light.TOGGLE, # single both
3001: Light.CLICK_BRIGHTNESS_DOWN, # long both
3004: Light.CLICK_BRIGHTNESS_UP, # double both
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"both_single": Light.TOGGLE,
"both_double": Light.CLICK_BRIGHTNESS_UP,
"both_long press": Light.CLICK_BRIGHTNESS_DOWN,
"left_single": Light.TOGGLE,
"left_double": Light.CLICK_BRIGHTNESS_UP,
"left_long press": Light.CLICK_BRIGHTNESS_DOWN,
"right_single": Light.TOGGLE,
"right_double": Light.CLICK_BRIGHTNESS_UP,
"right_long press": Light.CLICK_BRIGHTNESS_DOWN,
}
def get_zha_action(self, data: EventData) -> str:
command: str = data["command"]
return command
class WXKG02LMZ2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"single_both": Z2MLight.TOGGLE,
"double_both": Z2MLight.CLICK_BRIGHTNESS_UP,
"hold_both": Z2MLight.CLICK_BRIGHTNESS_DOWN,
"single_left": Z2MLight.TOGGLE,
"double_left": Z2MLight.CLICK_BRIGHTNESS_UP,
"hold_left": Z2MLight.CLICK_BRIGHTNESS_DOWN,
"single_right": Z2MLight.TOGGLE,
"double_right": Z2MLight.CLICK_BRIGHTNESS_UP,
"hold_right": Z2MLight.CLICK_BRIGHTNESS_DOWN,
}
class WXKG02LMSwitchController(SwitchController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"single_both": Switch.TOGGLE,
"single_left": Switch.TOGGLE,
"single_right": Switch.TOGGLE,
}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1002: Switch.TOGGLE,
2002: Switch.TOGGLE,
3002: Switch.TOGGLE,
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"both_single": Switch.TOGGLE,
"left_single": Switch.TOGGLE,
"right_single": Switch.TOGGLE,
}
def get_zha_action(self, data: EventData) -> str:
command: str = data["command"]
return command
class WXKG01LMLightController(LightController):
"""
Different states reported from the controller:
single, double, triple, quadruple,
many, hold, release
"""
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"single": Light.TOGGLE,
"double": Light.ON_FULL_BRIGHTNESS,
"triple": Light.ON_MIN_BRIGHTNESS,
"quadruple": Light.SET_HALF_BRIGHTNESS,
"many": None,
"hold": Light.HOLD_BRIGHTNESS_TOGGLE,
"release": Light.RELEASE,
}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1002: Light.TOGGLE, # single
1004: Light.ON_FULL_BRIGHTNESS, # double
1005: Light.ON_MIN_BRIGHTNESS, # triple
1006: Light.SET_HALF_BRIGHTNESS, # quadruple
1010: None, # many
1001: Light.HOLD_BRIGHTNESS_TOGGLE, # hold the button
1003: Light.RELEASE, # release the button
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"single": Light.TOGGLE,
"double": Light.ON_FULL_BRIGHTNESS,
"triple": Light.ON_MIN_BRIGHTNESS,
"quadruple": Light.SET_HALF_BRIGHTNESS,
}
def get_zha_action(self, data: EventData) -> str:
args = data["args"]
if "click_type" in args:
return args["click_type"]
return data["command"]
class WXKG01LMZ2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"single": Z2MLight.TOGGLE,
"double": Z2MLight.ON_FULL_BRIGHTNESS,
"triple": Z2MLight.ON_MIN_BRIGHTNESS,
"quadruple": Z2MLight.SET_HALF_BRIGHTNESS,
"many": None,
"hold": Z2MLight.HOLD_BRIGHTNESS_TOGGLE,
"release": Z2MLight.RELEASE,
}
class WXKG11LMRemoteLightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"single": Light.TOGGLE,
"double": Light.ON_FULL_BRIGHTNESS,
"hold": Light.HOLD_BRIGHTNESS_TOGGLE,
"release": Light.RELEASE,
}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1002: Light.TOGGLE,
1004: Light.ON_FULL_BRIGHTNESS,
1001: Light.HOLD_BRIGHTNESS_TOGGLE,
1003: Light.RELEASE,
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"single": Light.TOGGLE,
"double": Light.ON_FULL_BRIGHTNESS,
"hold": Light.HOLD_BRIGHTNESS_TOGGLE,
"release": Light.RELEASE,
}
def get_zha_action(self, data: EventData) -> str:
command: str = data["command"]
return command
class WXKG11LMRemoteZ2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"single": Z2MLight.TOGGLE,
"double": Z2MLight.ON_FULL_BRIGHTNESS,
"hold": Z2MLight.HOLD_BRIGHTNESS_TOGGLE,
"release": Z2MLight.RELEASE,
}
class WXKG11LMSensorSwitchLightController(LightController):
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1002: Light.TOGGLE,
1004: Light.ON_FULL_BRIGHTNESS,
1005: Light.ON_MIN_BRIGHTNESS,
1006: Light.SET_HALF_BRIGHTNESS,
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"single": Light.TOGGLE,
"double": Light.ON_FULL_BRIGHTNESS,
"triple": Light.ON_MIN_BRIGHTNESS,
"quadruple": Light.SET_HALF_BRIGHTNESS,
}
def get_zha_action(self, data: EventData) -> str:
mapping = {
1: "single",
2: "double",
3: "triple",
4: "quadruple",
}
clicks = data["args"]["value"]
return mapping.get(clicks, "")
class WXKG12LMLightController(LightController):
"""
Different states reported from the controller:
single, double, shake, hold, release
"""
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"single": Light.TOGGLE,
"double": Light.ON_FULL_BRIGHTNESS,
"shake": Light.ON_MIN_BRIGHTNESS,
"hold": Light.HOLD_BRIGHTNESS_TOGGLE,
"release": Light.RELEASE,
}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1002: Light.TOGGLE, # button_1_press
1004: Light.ON_FULL_BRIGHTNESS, # button_1_double_press
1007: Light.ON_MIN_BRIGHTNESS, # button_1_shake
1001: Light.HOLD_BRIGHTNESS_TOGGLE, # button_1_hold
1003: Light.RELEASE, # button_1_release_after_hold
}
class WXKG12LMZ2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"single": Z2MLight.TOGGLE,
"double": Z2MLight.ON_FULL_BRIGHTNESS,
"shake": Z2MLight.ON_MIN_BRIGHTNESS,
"hold": Z2MLight.HOLD_BRIGHTNESS_TOGGLE,
"release": Z2MLight.RELEASE,
}
class MFKZQ01LMLightController(LightController):
"""
This controller allows movement actions for Xiaomi Aqara Smart Cube as
shake, wakeup, fall, slide, flip180 or 90 and rotate_left or right.
Then from the apps.yaml the needed actions can be included and create
different instances for different lights.
"""
# Different states reported from the controller:
# shake, wakeup, fall, tap, slide, flip180
# flip90, rotate_left and rotate_right
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"shake": Light.ON_MIN_BRIGHTNESS,
"tap": Light.TOGGLE,
"slide": Light.ON_FULL_BRIGHTNESS,
"flip180": Light.CLICK_COLOR_UP,
"flip90": Light.CLICK_COLOR_DOWN,
"rotate_left": Light.CLICK_BRIGHTNESS_DOWN,
"rotate_right": Light.CLICK_BRIGHTNESS_UP,
}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1: Light.ON_MIN_BRIGHTNESS,
6: Light.TOGGLE,
5: Light.ON_FULL_BRIGHTNESS,
4: Light.CLICK_COLOR_UP,
3: Light.CLICK_COLOR_DOWN,
8: Light.CLICK_BRIGHTNESS_DOWN,
7: Light.CLICK_BRIGHTNESS_UP,
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"shake": Light.ON_MIN_BRIGHTNESS,
"knock": Light.TOGGLE,
"slide": Light.ON_FULL_BRIGHTNESS,
"flip180": Light.CLICK_COLOR_UP,
"flip90": Light.CLICK_COLOR_DOWN,
"rotate_left": Light.CLICK_BRIGHTNESS_DOWN,
"rotate_right": Light.CLICK_BRIGHTNESS_UP,
}
def get_zha_action(self, data: EventData) -> str:
command: str = data["command"]
action = command
args = data.get("args", {})
if command == "flip":
action = command + str(args["flip_degrees"])
return action
class WXCJKG11LMLightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"button_1_single": Light.OFF,
"button_1_double": Light.ON_MIN_BRIGHTNESS,
"button_1_hold": Light.HOLD_BRIGHTNESS_DOWN,
"button_1_release": Light.RELEASE,
"button_2_single": Light.ON,
"button_2_double": Light.ON_FULL_BRIGHTNESS,
"button_2_hold": Light.HOLD_BRIGHTNESS_UP,
"button_2_release": Light.RELEASE,
}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1002: Light.OFF,
1001: Light.HOLD_BRIGHTNESS_DOWN,
1003: Light.RELEASE,
2002: Light.ON,
2001: Light.HOLD_BRIGHTNESS_UP,
2003: Light.RELEASE,
}
class WXCJKG11LMZ2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"button_1_single": Z2MLight.OFF,
"button_1_double": Z2MLight.ON_MIN_BRIGHTNESS,
"button_1_hold": Z2MLight.HOLD_BRIGHTNESS_DOWN,
"button_1_release": Z2MLight.RELEASE,
"button_2_single": Z2MLight.ON,
"button_2_double": Z2MLight.ON_FULL_BRIGHTNESS,
"button_2_hold": Z2MLight.HOLD_BRIGHTNESS_UP,
"button_2_release": Z2MLight.RELEASE,
}
class WXCJKG12LMLightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"button_1_single": Light.OFF,
"button_1_double": Light.ON_MIN_COLOR_TEMP,
"button_1_triple": None,
"button_1_hold": Light.HOLD_COLOR_DOWN,
"button_1_release": Light.RELEASE,
"button_2_single": Light.ON,
"button_2_double": Light.ON_FULL_COLOR_TEMP,
"button_2_triple": None,
"button_2_hold": Light.HOLD_COLOR_UP,
"button_2_release": Light.RELEASE,
"button_3_single": Light.CLICK_BRIGHTNESS_DOWN,
"button_3_double": Light.ON_MIN_BRIGHTNESS,
"button_3_triple": None,
"button_3_hold": Light.HOLD_BRIGHTNESS_DOWN,
"button_3_release": Light.RELEASE,
"button_4_single": Light.CLICK_BRIGHTNESS_UP,
"button_4_double": Light.ON_FULL_BRIGHTNESS,
"button_4_triple": None,
"button_4_hold": Light.HOLD_BRIGHTNESS_UP,
"button_4_release": Light.RELEASE,
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"1_single": Light.OFF,
"1_double": Light.ON_MIN_COLOR_TEMP,
"1_triple": None,
"1_long press": Light.HOLD_COLOR_DOWN,
"1_release": Light.RELEASE,
"2_single": Light.ON,
"2_double": Light.ON_FULL_COLOR_TEMP,
"2_triple": None,
"2_long press": Light.HOLD_COLOR_UP,
"2_release": Light.RELEASE,
"3_single": Light.CLICK_BRIGHTNESS_DOWN,
"3_double": Light.ON_MIN_BRIGHTNESS,
"3_triple": None,
"3_long press": Light.HOLD_BRIGHTNESS_DOWN,
"3_release": Light.RELEASE,
"4_single": Light.CLICK_BRIGHTNESS_UP,
"4_double": Light.ON_FULL_BRIGHTNESS,
"4_triple": None,
"4_long press": Light.HOLD_BRIGHTNESS_UP,
"4_release": Light.RELEASE,
}
def get_zha_action(self, data: EventData) -> str:
command: str = data["command"]
return command
class WXCJKG12LMZ2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"button_1_single": Z2MLight.OFF,
"button_1_double": Z2MLight.ON_MIN_COLOR_TEMP,
"button_1_triple": None,
"button_1_hold": Z2MLight.HOLD_COLOR_TEMP_DOWN,
"button_1_release": Z2MLight.RELEASE,
"button_2_single": Z2MLight.ON,
"button_2_double": Z2MLight.ON_FULL_COLOR_TEMP,
"button_2_triple": None,
"button_2_hold": Z2MLight.HOLD_COLOR_TEMP_UP,
"button_2_release": Z2MLight.RELEASE,
"button_3_single": Z2MLight.CLICK_BRIGHTNESS_DOWN,
"button_3_double": Z2MLight.ON_MIN_BRIGHTNESS,
"button_3_triple": None,
"button_3_hold": Z2MLight.HOLD_BRIGHTNESS_DOWN,
"button_3_release": Z2MLight.RELEASE,
"button_4_single": Z2MLight.CLICK_BRIGHTNESS_UP,
"button_4_double": Z2MLight.ON_FULL_BRIGHTNESS,
"button_4_triple": None,
"button_4_hold": Z2MLight.HOLD_BRIGHTNESS_UP,
"button_4_release": Z2MLight.RELEASE,
}
class WXCJKG13LMLightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"button_1_single": Light.OFF,
"button_1_double": Light.SYNC,
"button_1_triple": None,
"button_1_hold": None,
"button_1_release": None,
"button_2_single": Light.ON,
"button_2_double": Light.SYNC,
"button_2_triple": None,
"button_2_hold": None,
"button_2_release": None,
"button_3_single": Light.CLICK_BRIGHTNESS_DOWN,
"button_3_double": Light.ON_MIN_BRIGHTNESS,
"button_3_triple": None,
"button_3_hold": Light.HOLD_BRIGHTNESS_DOWN,
"button_3_release": Light.RELEASE,
"button_4_single": Light.CLICK_BRIGHTNESS_UP,
"button_4_double": Light.ON_FULL_BRIGHTNESS,
"button_4_triple": None,
"button_4_hold": Light.HOLD_BRIGHTNESS_UP,
"button_4_release": Light.RELEASE,
"button_5_single": Light.CLICK_COLOR_DOWN,
"button_5_double": Light.ON_MIN_COLOR_TEMP,
"button_5_triple": None,
"button_5_hold": Light.HOLD_COLOR_DOWN,
"button_5_release": Light.RELEASE,
"button_6_single": Light.CLICK_COLOR_UP,
"button_6_double": Light.ON_FULL_COLOR_TEMP,
"button_6_triple": None,
"button_6_hold": Light.HOLD_COLOR_UP,
"button_6_release": Light.RELEASE,
}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1002: Light.OFF,
1004: Light.SYNC,
1005: None,
1001: None,
1003: None,
2002: Light.ON,
2004: Light.SYNC,
2005: None,
2001: None,
2003: None,
3002: Light.CLICK_BRIGHTNESS_DOWN,
3004: Light.ON_MIN_BRIGHTNESS,
3005: None,
3001: Light.HOLD_BRIGHTNESS_DOWN,
3003: Light.RELEASE,
4002: Light.CLICK_BRIGHTNESS_UP,
4004: Light.ON_FULL_BRIGHTNESS,
4005: None,
4001: Light.HOLD_BRIGHTNESS_UP,
4003: Light.RELEASE,
5002: Light.CLICK_COLOR_DOWN,
5004: Light.ON_MIN_COLOR_TEMP,
5005: None,
5001: Light.HOLD_COLOR_DOWN,
5003: Light.RELEASE,
6002: Light.CLICK_COLOR_UP,
6004: Light.ON_FULL_COLOR_TEMP,
6005: None,
6001: Light.HOLD_COLOR_UP,
6003: Light.RELEASE,
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"1_single": Light.OFF,
"1_double": Light.SYNC,
"1_triple": None,
"1_long": None,
"1_release": None,
"2_single": Light.ON,
"2_double": Light.SYNC,
"2_triple": None,
"2_long": None,
"2_release": None,
"3_single": Light.CLICK_BRIGHTNESS_DOWN,
"3_double": Light.ON_MIN_BRIGHTNESS,
"3_triple": None,
"3_long": Light.HOLD_BRIGHTNESS_DOWN,
"3_release": Light.RELEASE,
"4_single": Light.CLICK_BRIGHTNESS_UP,
"4_double": Light.ON_FULL_BRIGHTNESS,
"4_triple": None,
"4_long": Light.HOLD_BRIGHTNESS_UP,
"4_release": Light.RELEASE,
"5_single": Light.CLICK_COLOR_DOWN,
"5_double": Light.ON_MIN_COLOR_TEMP,
"5_triple": None,
"5_long": Light.HOLD_COLOR_DOWN,
"5_release": Light.RELEASE,
"6_single": Light.CLICK_COLOR_UP,
"6_double": Light.ON_FULL_COLOR_TEMP,
"6_triple": None,
"6_long": Light.HOLD_COLOR_UP,
"6_release": Light.RELEASE,
}
def get_zha_action(self, data: EventData) -> str:
command: str = data["command"]
return command
class WXCJKG13LMZ2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"button_1_single": Z2MLight.OFF,
"button_1_double": Z2MLight.ON_FULL_BRIGHTNESS,
"button_1_triple": None,
"button_1_hold": None,
"button_1_release": None,
"button_2_single": Z2MLight.ON,
"button_2_double": Z2MLight.ON_FULL_BRIGHTNESS,
"button_2_triple": None,
"button_2_hold": None,
"button_2_release": None,
"button_3_single": Z2MLight.CLICK_BRIGHTNESS_DOWN,
"button_3_double": Z2MLight.ON_MIN_BRIGHTNESS,
"button_3_triple": None,
"button_3_hold": Z2MLight.HOLD_BRIGHTNESS_DOWN,
"button_3_release": Z2MLight.RELEASE,
"button_4_single": Z2MLight.CLICK_BRIGHTNESS_UP,
"button_4_double": Z2MLight.ON_FULL_BRIGHTNESS,
"button_4_triple": None,
"button_4_hold": Z2MLight.HOLD_BRIGHTNESS_UP,
"button_4_release": Z2MLight.RELEASE,
"button_5_single": Z2MLight.CLICK_COLOR_TEMP_DOWN,
"button_5_double": Z2MLight.ON_MIN_COLOR_TEMP,
"button_5_triple": None,
"button_5_hold": Z2MLight.HOLD_COLOR_TEMP_DOWN,
"button_5_release": Z2MLight.RELEASE,
"button_6_single": Z2MLight.CLICK_COLOR_TEMP_UP,
"button_6_double": Z2MLight.ON_FULL_COLOR_TEMP,
"button_6_triple": None,
"button_6_hold": Z2MLight.HOLD_COLOR_TEMP_UP,
"button_6_release": Z2MLight.RELEASE,
}
class WXCJKG13LMMediaPlayerController(MediaPlayerController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"button_1_single": MediaPlayer.CLICK_VOLUME_DOWN,
"button_1_double": MediaPlayer.MUTE,
"button_1_triple": None,
"button_1_hold": MediaPlayer.HOLD_VOLUME_DOWN,
"button_1_release": MediaPlayer.RELEASE,
"button_2_single": MediaPlayer.CLICK_VOLUME_UP,
"button_2_double": MediaPlayer.PLAY_PAUSE,
"button_2_triple": None,
"button_2_hold": MediaPlayer.HOLD_VOLUME_UP,
"button_2_release": MediaPlayer.RELEASE,
"button_3_single": MediaPlayer.PREVIOUS_TRACK,
"button_3_double": None,
"button_3_triple": None,
"button_3_hold": None,
"button_3_release": None,
"button_4_single": MediaPlayer.NEXT_TRACK,
"button_4_double": None,
"button_4_triple": None,
"button_4_hold": None,
"button_4_release": None,
"button_5_single": MediaPlayer.PREVIOUS_SOURCE,
"button_5_double": None,
"button_5_triple": None,
"button_5_hold": None,
"button_5_release": None,
"button_6_single": MediaPlayer.NEXT_SOURCE,
"button_6_double": None,
"button_6_triple": None,
"button_6_hold": None,
"button_6_release": None,
}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
#######################
# Button layout
#######################
# 1000: top-left
# 2000: top-right
# 3000: middle-left
# 4000: middle-right
# 5000: bottom-left
# 6000: bottom-right
#######################
# Actions
#######################
# 0001: hold
# 0002: click
# 0003: release
# 0004: double-click
# 0005: triple-click
#######################
return {
1002: MediaPlayer.CLICK_VOLUME_DOWN,
1001: MediaPlayer.HOLD_VOLUME_DOWN,
1003: MediaPlayer.RELEASE,
1004: MediaPlayer.MUTE,
1005: None,
2002: MediaPlayer.CLICK_VOLUME_UP,
2001: MediaPlayer.HOLD_VOLUME_UP,
2003: MediaPlayer.RELEASE,
2004: MediaPlayer.PLAY_PAUSE,
2005: None,
3002: MediaPlayer.PREVIOUS_TRACK,
3001: None,
3003: None,
3004: None,
3005: None,
4002: MediaPlayer.NEXT_TRACK,
4001: None,
4003: None,
4004: None,
4005: None,
5002: MediaPlayer.PREVIOUS_SOURCE,
5001: None,
5003: None,
5004: None,
5005: None,
6002: MediaPlayer.NEXT_SOURCE,
6001: None,
6003: None,
6004: None,
6005: None,
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"1_single": MediaPlayer.CLICK_VOLUME_DOWN,
"1_double": MediaPlayer.MUTE,
"1_triple": None,
"1_long": MediaPlayer.HOLD_VOLUME_DOWN,
"1_release": MediaPlayer.RELEASE,
"2_single": MediaPlayer.CLICK_VOLUME_UP,
"2_double": MediaPlayer.PLAY_PAUSE,
"2_triple": None,
"2_long": MediaPlayer.HOLD_VOLUME_UP,
"2_release": MediaPlayer.RELEASE,
"3_single": MediaPlayer.PREVIOUS_TRACK,
"3_double": None,
"3_triple": None,
"3_long": None,
"3_release": None,
"4_single": MediaPlayer.NEXT_TRACK,
"4_double": None,
"4_triple": None,
"4_long": None,
"4_release": None,
"5_single": MediaPlayer.PREVIOUS_SOURCE,
"5_double": None,
"5_triple": None,
"5_long": None,
"5_release": Light.RELEASE,
"6_single": MediaPlayer.NEXT_SOURCE,
"6_double": None,
"6_triple": None,
"6_long": None,
"6_release": None,
}
def get_zha_action(self, data: EventData) -> str:
command: str = data["command"]
return command
class WXKG06LMLightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"single": Light.TOGGLE,
"double": Light.CLICK_BRIGHTNESS_UP,
"hold": Light.CLICK_BRIGHTNESS_UP,
}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1002: Light.TOGGLE,
1001: Light.CLICK_BRIGHTNESS_DOWN,
1004: Light.CLICK_BRIGHTNESS_UP,
}
class WXKG06LMSwitchController(SwitchController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {"single": Light.TOGGLE}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {1002: Light.TOGGLE}
class WXKG07LMLightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"single_both": Light.TOGGLE,
"double_both": Light.CLICK_BRIGHTNESS_UP,
"hold_both": Light.CLICK_BRIGHTNESS_DOWN,
"single_left": Light.TOGGLE,
"double_left": Light.CLICK_BRIGHTNESS_UP,
"hold_left": Light.CLICK_BRIGHTNESS_DOWN,
"single_right": Light.TOGGLE,
"double_right": Light.CLICK_BRIGHTNESS_UP,
"hold_right": Light.CLICK_BRIGHTNESS_DOWN,
}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1001: Light.CLICK_BRIGHTNESS_DOWN, # long left
1002: Light.TOGGLE, # single left
1004: Light.CLICK_BRIGHTNESS_UP, # double left
2001: Light.CLICK_BRIGHTNESS_DOWN, # long right
2002: Light.TOGGLE, # single right
2004: Light.CLICK_BRIGHTNESS_UP, # double right
3001: Light.CLICK_BRIGHTNESS_DOWN, # long both
3002: Light.TOGGLE, # single both
3004: Light.CLICK_BRIGHTNESS_UP, # double both
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"both_single": Light.TOGGLE,
"both_double": Light.CLICK_BRIGHTNESS_UP,
"both_long press": Light.CLICK_BRIGHTNESS_DOWN,
"left_single": Light.TOGGLE,
"left_double": Light.CLICK_BRIGHTNESS_UP,
"left_long press": Light.CLICK_BRIGHTNESS_DOWN,
"right_single": Light.TOGGLE,
"right_double": Light.CLICK_BRIGHTNESS_UP,
"right_long press": Light.CLICK_BRIGHTNESS_DOWN,
}
def get_zha_action(self, data: EventData) -> str:
command: str = data["command"]
return command
class WXKG07LMZ2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"single_both": Z2MLight.TOGGLE,
"double_both": Z2MLight.CLICK_BRIGHTNESS_UP,
"hold_both": Z2MLight.CLICK_BRIGHTNESS_DOWN,
"single_left": Z2MLight.TOGGLE,
"double_left": Z2MLight.CLICK_BRIGHTNESS_UP,
"hold_left": Z2MLight.CLICK_BRIGHTNESS_DOWN,
"single_right": Z2MLight.TOGGLE,
"double_right": Z2MLight.CLICK_BRIGHTNESS_UP,
"hold_right": Z2MLight.CLICK_BRIGHTNESS_DOWN,
}
class WXKG07LMSwitchController(SwitchController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"single_both": Switch.TOGGLE,
"single_left": Switch.TOGGLE,
"single_right": Switch.TOGGLE,
}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1002: Switch.TOGGLE,
2002: Switch.TOGGLE,
3002: Switch.TOGGLE,
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"both_single": Switch.TOGGLE,
"left_single": Switch.TOGGLE,
"right_single": Switch.TOGGLE,
}
def get_zha_action(self, data: EventData) -> str:
command: str = data["command"]
return command
class ZNXNKG02LMLightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"single": Light.TOGGLE,
"double": Light.ON_FULL_BRIGHTNESS,
"hold": Light.HOLD_COLOR_TOGGLE,
"release": Light.RELEASE,
"start_rotating": Light.BRIGHTNESS_FROM_CONTROLLER_ANGLE,
"stop_rotating": Light.RELEASE,
}
class ZNXNKG02LMMediaPlayerController(MediaPlayerController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"single": MediaPlayer.PLAY_PAUSE,
"double": MediaPlayer.NEXT_TRACK,
"hold": MediaPlayer.PREVIOUS_TRACK,
"release": MediaPlayer.RELEASE,
"start_rotating": MediaPlayer.VOLUME_FROM_CONTROLLER_ANGLE,
"stop_rotating": MediaPlayer.RELEASE,
}
class WXKG15LMLightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"single_both": Light.TOGGLE,
"double_both": Light.CLICK_BRIGHTNESS_UP,
"triple_both": Light.CLICK_BRIGHTNESS_DOWN,
"hold_both": Light.ON_FULL_BRIGHTNESS,
"single_left": Light.TOGGLE,
"double_left": Light.CLICK_BRIGHTNESS_UP,
"triple_left": Light.CLICK_BRIGHTNESS_DOWN,
"hold_left": Light.ON_FULL_BRIGHTNESS,
"single_right": Light.TOGGLE,
"double_right": Light.CLICK_BRIGHTNESS_UP,
"triple_right": Light.CLICK_BRIGHTNESS_DOWN,
"hold_right": Light.ON_FULL_BRIGHTNESS,
}
class WXKG15LMZ2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"single_both": Z2MLight.TOGGLE,
"double_both": Z2MLight.CLICK_BRIGHTNESS_UP,
"triple_both": Z2MLight.CLICK_BRIGHTNESS_DOWN,
"hold_both": Z2MLight.ON_FULL_BRIGHTNESS,
"single_left": Z2MLight.TOGGLE,
"double_left": Z2MLight.CLICK_BRIGHTNESS_UP,
"triple_left": Z2MLight.CLICK_BRIGHTNESS_DOWN,
"hold_left": Z2MLight.ON_FULL_BRIGHTNESS,
"single_right": Z2MLight.TOGGLE,
"double_right": Z2MLight.CLICK_BRIGHTNESS_UP,
"triple_right": Z2MLight.CLICK_BRIGHTNESS_DOWN,
"hold_right": Z2MLight.ON_FULL_BRIGHTNESS,
}
class WXKG15LMSwitchController(SwitchController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"single_both": Switch.TOGGLE,
"single_left": Switch.TOGGLE,
"single_right": Switch.TOGGLE,
}
@@ -0,0 +1,37 @@
from cx_const import DefaultActionsMapping, Light
from cx_core import LightController
from cx_core.integration import EventData
class AUA1ZBR2GWLightController(LightController):
# Different states reported from the controller:
# on, off, brightness_step_up, brightness_step_down,
# color_temperature_step_up, color_temperature_step_down
# There is one copy of these actions per endpoint
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"1_toggle": Light.TOGGLE,
"1_step_up": Light.CLICK_BRIGHTNESS_UP,
"1_step_down": Light.CLICK_BRIGHTNESS_DOWN,
"1_step_color_temp_up": Light.CLICK_COLOR_TEMP_UP,
"1_step_color_temp_down": Light.CLICK_COLOR_TEMP_DOWN,
"2_toggle": Light.TOGGLE,
"2_step_up": Light.CLICK_BRIGHTNESS_UP,
"2_step_down": Light.CLICK_BRIGHTNESS_DOWN,
"2_step_color_temp_up": Light.CLICK_COLOR_TEMP_UP,
"2_step_color_temp_down": Light.CLICK_COLOR_TEMP_DOWN,
}
def get_zha_action(self, data: EventData) -> str:
endpoint_id = data.get("endpoint_id", 1)
command: str = data["command"]
action = command
args = data.get("args", [])
if command == "step" or command == "step_color_temp":
args_mapping = {0: "up", 1: "down", 3: "up"}
action = "_".join((action, args_mapping[args[0]]))
if command == "on" or command == "off":
action = "toggle"
action = f"{endpoint_id}_{action}"
return action
@@ -0,0 +1,78 @@
from cx_const import DefaultActionsMapping, Light
from cx_core import LightController
class HMPB2WM552LightController(LightController):
def get_homematic_actions_mapping(self) -> DefaultActionsMapping:
return {
"PRESS_SHORT_1": Light.OFF,
"PRESS_LONG_1": Light.HOLD_BRIGHTNESS_DOWN,
"PRESS_CONT_1": None,
"PRESS_LONG_RELEASE_1": Light.RELEASE,
"PRESS_SHORT_2": Light.ON,
"PRESS_LONG_2": Light.HOLD_BRIGHTNESS_UP,
"PRESS_CONT_2": None,
"PRESS_LONG_RELEASE_2": Light.RELEASE,
}
class HMPBI4FMLightController(LightController):
def get_homematic_actions_mapping(self) -> DefaultActionsMapping:
return {
"PRESS_SHORT_1": Light.OFF,
"PRESS_CONT_1": None,
"PRESS_LONG_1": Light.CLICK_COLOR_DOWN,
"PRESS_SHORT_2": Light.ON,
"PRESS_CONT_2": None,
"PRESS_LONG_2": Light.CLICK_COLOR_UP,
"PRESS_SHORT_3": Light.CLICK_BRIGHTNESS_DOWN,
"PRESS_CONT_3": None,
"PRESS_LONG_3": Light.ON_MIN_BRIGHTNESS,
"PRESS_SHORT_4": Light.CLICK_BRIGHTNESS_UP,
"PRESS_CONT_4": None,
"PRESS_LONG_4": Light.ON_FULL_BRIGHTNESS,
}
class HMPB6WM55LightController(LightController):
def get_homematic_actions_mapping(self) -> DefaultActionsMapping:
return {
"PRESS_SHORT_1": Light.OFF,
"PRESS_CONT_1": None,
"PRESS_LONG_1": Light.SYNC,
"PRESS_LONG_RELEASE_1": Light.RELEASE,
"PRESS_SHORT_2": Light.ON,
"PRESS_CONT_2": None,
"PRESS_LONG_2": Light.SYNC,
"PRESS_LONG_RELEASE_2": Light.RELEASE,
"PRESS_SHORT_3": Light.CLICK_BRIGHTNESS_DOWN,
"PRESS_CONT_3": None,
"PRESS_LONG_3": Light.HOLD_BRIGHTNESS_DOWN,
"PRESS_LONG_RELEASE_3": Light.RELEASE,
"PRESS_SHORT_4": Light.CLICK_BRIGHTNESS_UP,
"PRESS_CONT_4": None,
"PRESS_LONG_4": Light.HOLD_BRIGHTNESS_UP,
"PRESS_LONG_RELEASE_4": Light.RELEASE,
"PRESS_SHORT_5": Light.CLICK_COLOR_DOWN,
"PRESS_CONT_5": None,
"PRESS_LONG_5": Light.HOLD_COLOR_DOWN,
"PRESS_LONG_RELEASE_5": Light.RELEASE,
"PRESS_SHORT_6": Light.CLICK_COLOR_UP,
"PRESS_CONT_6": None,
"PRESS_LONG_6": Light.HOLD_COLOR_UP,
"PRESS_LONG_RELEASE_6": Light.RELEASE,
}
class HMSenMDIRWM55LightController(LightController):
def get_homematic_actions_mapping(self) -> DefaultActionsMapping:
return {
"PRESS_SHORT_1": Light.OFF,
"PRESS_LONG_1": Light.HOLD_BRIGHTNESS_DOWN,
"PRESS_CONT_1": None,
"PRESS_LONG_RELEASE_1": Light.RELEASE,
"PRESS_SHORT_2": Light.ON,
"PRESS_LONG_2": Light.HOLD_BRIGHTNESS_UP,
"PRESS_CONT_2": None,
"PRESS_LONG_RELEASE_2": Light.RELEASE,
}
@@ -0,0 +1,844 @@
from cx_const import (
Cover,
DefaultActionsMapping,
Light,
MediaPlayer,
PredefinedActionsMapping,
Switch,
Z2MLight,
)
from cx_core import (
CoverController,
LightController,
MediaPlayerController,
SwitchController,
Z2MLightController,
action,
)
from cx_core.integration import EventData
class E1810Controller(LightController):
# Different states reported from the controller:
# toggle, brightness_up_click, brightness_down_click
# arrow_left_click, arrow_right_click, brightness_up_hold
# brightness_up_release, brightness_down_hold, brightness_down_release,
# arrow_left_hold, arrow_left_release, arrow_right_hold
# arrow_right_release
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"toggle": Light.TOGGLE,
"toggle_hold": Light.SYNC,
"brightness_up_click": Light.CLICK_BRIGHTNESS_UP,
"brightness_down_click": Light.CLICK_BRIGHTNESS_DOWN,
"arrow_left_click": Light.CLICK_COLOR_DOWN,
"arrow_right_click": Light.CLICK_COLOR_UP,
"brightness_up_hold": Light.HOLD_BRIGHTNESS_UP,
"brightness_up_release": Light.RELEASE,
"brightness_down_hold": Light.HOLD_BRIGHTNESS_DOWN,
"brightness_down_release": Light.RELEASE,
"arrow_left_hold": Light.HOLD_COLOR_DOWN,
"arrow_left_release": Light.RELEASE,
"arrow_right_hold": Light.HOLD_COLOR_UP,
"arrow_right_release": Light.RELEASE,
}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1002: Light.TOGGLE,
1001: Light.SYNC,
2002: Light.CLICK_BRIGHTNESS_UP,
3002: Light.CLICK_BRIGHTNESS_DOWN,
4002: Light.CLICK_COLOR_DOWN,
5002: Light.CLICK_COLOR_UP,
2001: Light.HOLD_BRIGHTNESS_UP,
2003: Light.RELEASE,
3001: Light.HOLD_BRIGHTNESS_DOWN,
3003: Light.RELEASE,
4001: Light.HOLD_COLOR_DOWN,
4003: Light.RELEASE,
5001: Light.HOLD_COLOR_UP,
5003: Light.RELEASE,
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"toggle": Light.TOGGLE,
"press_2_0_0": Light.SYNC,
"step_with_on_off_0_43_5": Light.CLICK_BRIGHTNESS_UP,
"step_1_43_5_0_0": Light.CLICK_BRIGHTNESS_DOWN,
"press_257_13_0": Light.CLICK_COLOR_DOWN,
"press_256_13_0": Light.CLICK_COLOR_UP,
"move_with_on_off_0_83": Light.HOLD_BRIGHTNESS_UP,
"move_with_on_off_0_84": Light.HOLD_BRIGHTNESS_UP, # ZigBee 3.0 firmware
"move_1_83_0_0": Light.HOLD_BRIGHTNESS_DOWN,
"move_1_84_0_0": Light.HOLD_BRIGHTNESS_DOWN, # ZigBee 3.0 firmware
"hold_3329_0": Light.HOLD_COLOR_DOWN,
"hold_3328_0": Light.HOLD_COLOR_UP,
"stop": Light.RELEASE,
"stop_with_on_off": Light.RELEASE,
"release": Light.RELEASE,
}
class E1810Z2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"toggle": Z2MLight.TOGGLE,
"toggle_hold": Z2MLight.ON_FULL_BRIGHTNESS,
"brightness_up_click": Z2MLight.CLICK_BRIGHTNESS_UP,
"brightness_down_click": Z2MLight.CLICK_BRIGHTNESS_DOWN,
"arrow_left_click": Z2MLight.CLICK_COLOR_TEMP_DOWN,
"arrow_right_click": Z2MLight.CLICK_COLOR_TEMP_UP,
"brightness_up_hold": Z2MLight.HOLD_BRIGHTNESS_UP,
"brightness_up_release": Z2MLight.RELEASE,
"brightness_down_hold": Z2MLight.HOLD_BRIGHTNESS_DOWN,
"brightness_down_release": Z2MLight.RELEASE,
"arrow_left_hold": Z2MLight.HOLD_COLOR_TEMP_DOWN,
"arrow_left_release": Z2MLight.RELEASE,
"arrow_right_hold": Z2MLight.HOLD_COLOR_TEMP_UP,
"arrow_right_release": Z2MLight.RELEASE,
}
class E1810MediaPlayerController(MediaPlayerController):
# Different states reported from the controller:
# toggle, brightness_up_click, brightness_down_click
# arrow_left_click, arrow_right_click, brightness_up_hold
# brightness_up_release, brightness_down_hold, brightness_down_release,
# arrow_left_hold, arrow_left_release, arrow_right_hold
# arrow_right_release
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"toggle": MediaPlayer.PLAY_PAUSE,
"brightness_up_click": MediaPlayer.CLICK_VOLUME_UP,
"brightness_down_click": MediaPlayer.CLICK_VOLUME_DOWN,
"arrow_left_click": MediaPlayer.PREVIOUS_TRACK,
"arrow_right_click": MediaPlayer.NEXT_TRACK,
"arrow_left_hold": MediaPlayer.PREVIOUS_SOURCE,
"arrow_right_hold": MediaPlayer.NEXT_SOURCE,
"brightness_up_hold": MediaPlayer.HOLD_VOLUME_UP,
"brightness_up_release": MediaPlayer.RELEASE,
"brightness_down_hold": MediaPlayer.HOLD_VOLUME_DOWN,
"brightness_down_release": MediaPlayer.RELEASE,
}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1002: MediaPlayer.PLAY_PAUSE,
2002: MediaPlayer.CLICK_VOLUME_UP,
3002: MediaPlayer.CLICK_VOLUME_DOWN,
4002: MediaPlayer.PREVIOUS_TRACK,
5002: MediaPlayer.NEXT_TRACK,
2001: MediaPlayer.HOLD_VOLUME_UP,
2003: MediaPlayer.RELEASE,
3001: MediaPlayer.HOLD_VOLUME_DOWN,
3003: MediaPlayer.RELEASE,
4001: MediaPlayer.PREVIOUS_SOURCE,
5001: MediaPlayer.NEXT_SOURCE,
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"toggle": MediaPlayer.PLAY_PAUSE,
"step_with_on_off_0_43_5": MediaPlayer.CLICK_VOLUME_UP,
"step_1_43_5_0_0": MediaPlayer.CLICK_VOLUME_DOWN,
"press_257_13_0": MediaPlayer.PREVIOUS_TRACK,
"press_256_13_0": MediaPlayer.NEXT_TRACK,
"move_with_on_off_0_83": MediaPlayer.HOLD_VOLUME_UP,
"move_with_on_off_0_84": MediaPlayer.HOLD_VOLUME_UP, # ZigBee 3.0 firmware
"stop": MediaPlayer.RELEASE,
"stop_with_on_off": MediaPlayer.RELEASE,
"move_1_83_0_0": MediaPlayer.HOLD_VOLUME_DOWN,
"move_1_84_0_0": MediaPlayer.HOLD_VOLUME_DOWN, # ZigBee 3.0 firmware
"hold_3329_0": MediaPlayer.PREVIOUS_SOURCE,
"hold_3328_0": MediaPlayer.NEXT_SOURCE,
"release": MediaPlayer.RELEASE,
}
class E1743Controller(LightController):
# Different states reported from the controller:
# on, off, brightness_up, brightness_down, brightness_stop
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Light.ON,
"off": Light.OFF,
"brightness_move_up": Light.HOLD_BRIGHTNESS_UP,
"brightness_move_down": Light.HOLD_BRIGHTNESS_DOWN,
"brightness_stop": Light.RELEASE,
}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1002: Light.ON,
2002: Light.OFF,
1001: Light.HOLD_BRIGHTNESS_UP,
2001: Light.HOLD_BRIGHTNESS_DOWN,
1003: Light.RELEASE,
2003: Light.RELEASE,
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Light.ON,
"off": Light.OFF,
"move_with_on_off_0_83": Light.HOLD_BRIGHTNESS_UP,
"move_1_83_0_0": Light.HOLD_BRIGHTNESS_DOWN,
"stop": Light.RELEASE,
"stop_with_on_off": Light.RELEASE,
}
class E1743Z2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Z2MLight.ON,
"off": Z2MLight.OFF,
"brightness_move_up": Z2MLight.HOLD_BRIGHTNESS_UP,
"brightness_move_down": Z2MLight.HOLD_BRIGHTNESS_DOWN,
"brightness_stop": Z2MLight.RELEASE,
}
class E1743MediaPlayerController(MediaPlayerController):
# Different states reported from the controller:
# on, off, brightness_up, brightness_down, brightness_stop
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": MediaPlayer.PLAY_PAUSE,
"off": MediaPlayer.NEXT_TRACK,
"brightness_move_up": MediaPlayer.HOLD_VOLUME_UP,
"brightness_move_down": MediaPlayer.HOLD_VOLUME_DOWN,
"brightness_stop": MediaPlayer.RELEASE,
}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1002: MediaPlayer.PLAY_PAUSE,
2002: MediaPlayer.NEXT_TRACK,
1001: MediaPlayer.HOLD_VOLUME_UP,
2001: MediaPlayer.HOLD_VOLUME_DOWN,
1003: MediaPlayer.RELEASE,
2003: MediaPlayer.RELEASE,
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": MediaPlayer.PLAY_PAUSE,
"off": MediaPlayer.NEXT_TRACK,
"move_with_on_off_0_83": MediaPlayer.HOLD_VOLUME_UP,
"move_1_83_0_0": MediaPlayer.HOLD_VOLUME_DOWN,
"stop": MediaPlayer.RELEASE,
"stop_with_on_off": MediaPlayer.RELEASE,
}
class E1743SwitchController(SwitchController):
# Different states reported from the controller:
# on, off
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {"on": Switch.ON, "off": Switch.OFF}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {1002: Switch.ON, 2002: Switch.OFF}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {"on": Switch.ON, "off": Switch.OFF}
class E1743CoverController(CoverController):
# Different states reported from the controller:
# on, off
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Cover.TOGGLE_OPEN,
"off": Cover.TOGGLE_CLOSE,
"brightness_move_up": Cover.OPEN,
"brightness_move_down": Cover.CLOSE,
"brightness_stop": Cover.STOP,
}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1002: Cover.TOGGLE_OPEN,
2002: Cover.TOGGLE_CLOSE,
1001: Cover.OPEN,
2001: Cover.CLOSE,
1003: Cover.STOP,
2003: Cover.STOP,
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Cover.TOGGLE_OPEN,
"off": Cover.TOGGLE_CLOSE,
"move_with_on_off_0_83": Cover.OPEN,
"move_1_83_0_0": Cover.CLOSE,
"stop": Cover.STOP,
"stop_with_on_off": Cover.STOP,
}
class E2201LightController(E1743Controller):
pass
class E2201Z2MLightController(E1743Z2MLightController):
pass
class E2201MediaPlayerController(E1743MediaPlayerController):
pass
class E2201SwitchController(E1743SwitchController):
pass
class E2201CoverController(E1743CoverController):
pass
class ICTCG1Controller(LightController):
# Different states reported from the controller:
# rotate_left, rotate_left_quick
# rotate_right, rotate_right_quick
# rotate_stop
@action
async def rotate_left_quick(self) -> None:
await self.release()
await self.off()
@action
async def rotate_right_quick(self) -> None:
await self.release()
await self.on_full(LightController.ATTRIBUTE_BRIGHTNESS)
def get_predefined_actions_mapping(self) -> PredefinedActionsMapping:
parent_mapping = super().get_predefined_actions_mapping()
mapping: PredefinedActionsMapping = {
"rotate_left_quick": self.rotate_left_quick,
"rotate_right_quick": self.rotate_right_quick,
}
mapping.update(parent_mapping)
return mapping
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"brightness_move_up": Light.HOLD_BRIGHTNESS_UP,
"brightness_move_down": Light.HOLD_BRIGHTNESS_DOWN,
"brightness_stop": Light.RELEASE,
"brightness_move_to_level": Light.BRIGHTNESS_FROM_CONTROLLER_LEVEL,
}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1002: "rotate_right_quick",
2002: Light.CLICK_BRIGHTNESS_UP,
3002: Light.CLICK_BRIGHTNESS_DOWN,
4002: "rotate_left_quick",
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"move_1_70": Light.HOLD_BRIGHTNESS_DOWN,
"move_1_195": Light.HOLD_BRIGHTNESS_DOWN,
"move_to_level_with_on_off_0_1": "rotate_left_quick",
"move_with_on_off_0_70": Light.HOLD_BRIGHTNESS_UP,
"move_with_on_off_0_195": Light.ON,
"move_to_level_with_on_off_255_1": "rotate_right_quick",
"stop": Light.RELEASE,
}
class ICTCG1Z2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"brightness_move_up": Z2MLight.HOLD_BRIGHTNESS_UP,
"brightness_move_down": Z2MLight.HOLD_BRIGHTNESS_DOWN,
"brightness_stop": Z2MLight.RELEASE,
"brightness_move_to_level": Z2MLight.BRIGHTNESS_FROM_CONTROLLER_LEVEL,
}
class ICTCG1MediaPlayerController(MediaPlayerController):
# Different states reported from the controller:
# rotate_left, rotate_left_quick
# rotate_right, rotate_right_quick
# rotate_stop
@action
async def rotate_left_quick(self) -> None:
await self.release()
await self.pause()
@action
async def rotate_right_quick(self) -> None:
await self.release()
await self.play()
def get_predefined_actions_mapping(self) -> PredefinedActionsMapping:
parent_mapping = super().get_predefined_actions_mapping()
mapping: PredefinedActionsMapping = {
"rotate_left_quick": self.rotate_left_quick,
"rotate_right_quick": self.rotate_right_quick,
}
mapping.update(parent_mapping)
return mapping
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"brightness_move_up": MediaPlayer.HOLD_VOLUME_UP,
"brightness_move_down": MediaPlayer.HOLD_VOLUME_DOWN,
"brightness_stop": MediaPlayer.RELEASE,
}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1002: "rotate_right_quick",
2002: MediaPlayer.CLICK_VOLUME_UP,
3002: MediaPlayer.CLICK_VOLUME_DOWN,
4002: "rotate_left_quick",
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"move_1_70": MediaPlayer.HOLD_VOLUME_DOWN,
"move_1_195": MediaPlayer.HOLD_VOLUME_DOWN,
"move_to_level_with_on_off_0_1": "rotate_left_quick",
"move_with_on_off_0_70": MediaPlayer.HOLD_VOLUME_UP,
"move_with_on_off_0_195": MediaPlayer.HOLD_VOLUME_UP,
"move_to_level_with_on_off_255_1": "rotate_right_quick",
"stop": MediaPlayer.RELEASE,
}
class E1744LightController(LightController):
# Different states reported from the controller:
# brightness_move_down, brightness_move_up, brightness_stop,
# toggle, brightness_step_up, brightness_step_down
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"brightness_move_down": Light.HOLD_BRIGHTNESS_DOWN,
"brightness_move_up": Light.HOLD_BRIGHTNESS_UP,
"brightness_stop": Light.RELEASE,
"toggle": Light.TOGGLE,
"brightness_step_up": Light.ON_FULL_BRIGHTNESS,
"brightness_step_down": Light.ON_MIN_BRIGHTNESS,
}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
3001: Light.HOLD_BRIGHTNESS_DOWN,
2001: Light.HOLD_BRIGHTNESS_UP,
2003: Light.RELEASE,
3003: Light.RELEASE,
1002: Light.TOGGLE,
1004: Light.ON_FULL_BRIGHTNESS,
1005: Light.ON_MIN_BRIGHTNESS,
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"move_1_195_0_0": Light.HOLD_BRIGHTNESS_DOWN,
"move_0_195_0_0": Light.HOLD_BRIGHTNESS_UP,
"stop": Light.RELEASE,
"toggle": Light.TOGGLE,
"step_0_1_0_0_0": Light.ON_FULL_BRIGHTNESS,
"step_1_1_0_0_0": Light.ON_MIN_BRIGHTNESS,
}
def default_delay(self) -> int:
return 500
class E1744Z2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"brightness_move_down": Z2MLight.HOLD_BRIGHTNESS_DOWN,
"brightness_move_up": Z2MLight.HOLD_BRIGHTNESS_UP,
"brightness_stop": Z2MLight.RELEASE,
"toggle": Z2MLight.TOGGLE,
"brightness_step_up": Z2MLight.ON_FULL_BRIGHTNESS,
"brightness_step_down": Z2MLight.ON_MIN_BRIGHTNESS,
}
class E1744MediaPlayerController(MediaPlayerController):
# Different states reported from the controller:
# brightness_move_down, brightness_move_up, brightness_stop,
# toggle, brightness_step_up, brightness_step_down
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"brightness_move_down": MediaPlayer.HOLD_VOLUME_DOWN,
"brightness_move_up": MediaPlayer.HOLD_VOLUME_UP,
"brightness_stop": MediaPlayer.RELEASE,
"toggle": MediaPlayer.PLAY_PAUSE,
"brightness_step_up": MediaPlayer.NEXT_TRACK,
"brightness_step_down": MediaPlayer.PREVIOUS_TRACK,
}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
2001: MediaPlayer.HOLD_VOLUME_UP,
3001: MediaPlayer.HOLD_VOLUME_DOWN,
2003: MediaPlayer.RELEASE,
3003: MediaPlayer.RELEASE,
1002: MediaPlayer.PLAY_PAUSE,
1004: MediaPlayer.NEXT_TRACK,
1005: MediaPlayer.PREVIOUS_TRACK,
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"move_1_195_0_0": MediaPlayer.HOLD_VOLUME_DOWN,
"move_0_195_0_0": MediaPlayer.HOLD_VOLUME_UP,
"stop": MediaPlayer.RELEASE,
"toggle": MediaPlayer.PLAY_PAUSE,
"step_0_1_0_0_0": MediaPlayer.NEXT_TRACK,
"step_1_1_0_0_0": MediaPlayer.PREVIOUS_TRACK,
}
def default_delay(self) -> int:
return 500
class E1766LightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {"open": Light.ON, "close": Light.OFF}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1002: Light.ON,
1003: Light.ON_FULL_BRIGHTNESS,
2002: Light.OFF,
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"up_open": Light.ON,
"down_close": Light.OFF,
}
class E1766Z2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {"open": Z2MLight.ON, "close": Z2MLight.OFF}
class E1766SwitchController(SwitchController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {"open": Switch.ON, "close": Switch.OFF}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {1002: Switch.ON, 2002: Switch.OFF}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {"up_open": Switch.ON, "down_close": Switch.OFF}
class E1766CoverController(CoverController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"open": Cover.TOGGLE_OPEN,
"close": Cover.TOGGLE_CLOSE,
"stop": Cover.STOP,
}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1002: Cover.TOGGLE_OPEN,
1003: Cover.STOP,
2002: Cover.TOGGLE_CLOSE,
2003: Cover.STOP,
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"up_open": Cover.TOGGLE_OPEN,
"down_close": Cover.TOGGLE_CLOSE,
"stop": Cover.STOP,
}
class E1812LightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Light.TOGGLE,
"brightness_move_up": Light.HOLD_BRIGHTNESS_TOGGLE,
"brightness_stop": Light.RELEASE,
}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1002: Light.TOGGLE,
1001: Light.HOLD_BRIGHTNESS_TOGGLE,
1003: Light.RELEASE,
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Light.TOGGLE,
"move_with_on_off": Light.HOLD_BRIGHTNESS_TOGGLE,
"stop": Light.RELEASE,
}
def get_zha_action(self, data: EventData) -> str:
command: str = data["command"]
return command
class E1812Z2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Z2MLight.TOGGLE,
"brightness_move_up": Z2MLight.HOLD_BRIGHTNESS_TOGGLE,
"brightness_stop": Z2MLight.RELEASE,
}
class E1812SwitchController(SwitchController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {"on": Switch.TOGGLE}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {1002: Switch.TOGGLE}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {"on": Light.TOGGLE}
def get_zha_action(self, data: EventData) -> str:
command: str = data["command"]
return command
class E2002LightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Light.ON,
"off": Light.OFF,
"arrow_left_click": Light.CLICK_COLOR_DOWN,
"arrow_right_click": Light.CLICK_COLOR_UP,
"brightness_move_up": Light.HOLD_BRIGHTNESS_UP,
"brightness_stop": Light.RELEASE,
"brightness_move_down": Light.HOLD_BRIGHTNESS_DOWN,
"arrow_left_hold": Light.HOLD_COLOR_DOWN,
"arrow_left_release": Light.RELEASE,
"arrow_right_hold": Light.HOLD_COLOR_UP,
"arrow_right_release": Light.RELEASE,
}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1002: Light.ON,
2002: Light.OFF,
3002: Light.CLICK_COLOR_DOWN,
4002: Light.CLICK_COLOR_UP,
1001: Light.HOLD_BRIGHTNESS_UP,
1003: Light.RELEASE,
2001: Light.HOLD_BRIGHTNESS_DOWN,
2003: Light.RELEASE,
3001: Light.HOLD_COLOR_DOWN,
3003: Light.RELEASE,
4001: Light.HOLD_COLOR_UP,
4003: Light.RELEASE,
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Light.ON,
"off": Light.OFF,
"press_257_13_0": Light.CLICK_COLOR_DOWN,
"press_256_13_0": Light.CLICK_COLOR_UP,
"move_with_on_off_0_83": Light.HOLD_BRIGHTNESS_UP,
"move_1_83_0_0": Light.HOLD_BRIGHTNESS_DOWN,
"hold_3329_0": Light.HOLD_COLOR_DOWN,
"hold_3328_0": Light.HOLD_COLOR_UP,
"stop": Light.RELEASE,
"stop_with_on_off": Light.RELEASE,
"release": Light.RELEASE,
}
class W2049LightController(E2002LightController):
async def initialize(self) -> None:
await super().initialize()
self.log(
"⚠️ `W2049LightController` is deprecated and will be removed. Use `E2002LightController` instead.",
level="WARNING",
ascii_encode=False,
)
class E2002Z2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Z2MLight.ON,
"off": Z2MLight.OFF,
"arrow_left_click": Z2MLight.CLICK_COLOR_TEMP_DOWN,
"arrow_right_click": Z2MLight.CLICK_COLOR_TEMP_UP,
"brightness_move_up": Z2MLight.HOLD_BRIGHTNESS_UP,
"brightness_stop": Z2MLight.RELEASE,
"brightness_move_down": Z2MLight.HOLD_BRIGHTNESS_DOWN,
"arrow_left_hold": Z2MLight.HOLD_COLOR_TEMP_DOWN,
"arrow_left_release": Z2MLight.RELEASE,
"arrow_right_hold": Z2MLight.HOLD_COLOR_TEMP_UP,
"arrow_right_release": Z2MLight.RELEASE,
}
class E2002MediaPlayerController(MediaPlayerController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": MediaPlayer.PLAY_PAUSE,
"off": MediaPlayer.CLICK_VOLUME_DOWN,
"arrow_left_click": MediaPlayer.PREVIOUS_TRACK,
"arrow_right_click": MediaPlayer.NEXT_TRACK,
"arrow_left_hold": MediaPlayer.PREVIOUS_SOURCE,
"arrow_left_release": MediaPlayer.RELEASE,
"arrow_right_hold": MediaPlayer.NEXT_SOURCE,
"arrow_right_release": MediaPlayer.RELEASE,
"brightness_move_up": MediaPlayer.HOLD_VOLUME_UP,
"brightness_move_down": MediaPlayer.HOLD_VOLUME_DOWN,
"brightness_stop": MediaPlayer.RELEASE,
}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1002: MediaPlayer.PLAY_PAUSE,
2002: MediaPlayer.CLICK_VOLUME_DOWN,
3002: MediaPlayer.PREVIOUS_TRACK,
4002: MediaPlayer.NEXT_TRACK,
1001: MediaPlayer.HOLD_VOLUME_UP,
1003: MediaPlayer.RELEASE,
2001: MediaPlayer.HOLD_VOLUME_DOWN,
2003: MediaPlayer.RELEASE,
3001: MediaPlayer.PREVIOUS_SOURCE,
3003: MediaPlayer.RELEASE,
4001: MediaPlayer.NEXT_SOURCE,
4003: MediaPlayer.RELEASE,
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": MediaPlayer.PLAY_PAUSE,
"off": MediaPlayer.CLICK_VOLUME_DOWN,
"press_257_13_0": MediaPlayer.PREVIOUS_TRACK,
"press_256_13_0": MediaPlayer.NEXT_TRACK,
"move_with_on_off_0_83": MediaPlayer.HOLD_VOLUME_UP,
"move_1_83_0_0": MediaPlayer.HOLD_VOLUME_DOWN,
"hold_3329_0": MediaPlayer.PREVIOUS_SOURCE,
"hold_3328_0": MediaPlayer.NEXT_SOURCE,
"stop": MediaPlayer.RELEASE,
"stop_with_on_off": MediaPlayer.RELEASE,
"release": MediaPlayer.RELEASE,
}
class W2049MediaPlayerController(E2002MediaPlayerController):
async def initialize(self) -> None:
await super().initialize()
self.log(
"⚠️ `W2049MediaPlayerController` is deprecated and will be removed. "
"Use `E2002MediaPlayerController` instead.",
level="WARNING",
ascii_encode=False,
)
class E2213LightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"1_long_press": Light.HOLD_BRIGHTNESS_UP,
"2_long_press": Light.HOLD_BRIGHTNESS_DOWN,
"1_short_release": Light.ON,
"2_short_release": Light.OFF,
"1_long_release": Light.RELEASE,
"2_long_release": Light.RELEASE,
"1_double_press": Light.HOLD_COLOR_UP,
"2_double_press": Light.HOLD_COLOR_DOWN,
}
class E2213Z2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"1_long_press": Z2MLight.HOLD_BRIGHTNESS_UP,
"2_long_press": Z2MLight.HOLD_BRIGHTNESS_DOWN,
"1_short_release": Z2MLight.ON,
"2_short_release": Z2MLight.OFF,
"1_long_release": Z2MLight.RELEASE,
"2_long_release": Z2MLight.RELEASE,
"1_double_press": Z2MLight.HOLD_COLOR_TEMP_UP,
"2_double_press": Z2MLight.HOLD_COLOR_TEMP_DOWN,
}
class E2123MediaPlayerController(MediaPlayerController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"toggle": MediaPlayer.PLAY_PAUSE, # click Play button
"play_pause": MediaPlayer.PLAY_PAUSE, # click Play button
"track_next": MediaPlayer.NEXT_TRACK, # click Next Track
"track_previous": MediaPlayer.PREVIOUS_TRACK, # click Previous Track
"volume_up": MediaPlayer.CLICK_VOLUME_UP, # click + (Volume up)
"volume_up_hold": MediaPlayer.CLICK_VOLUME_UP, # hold + (Volume up)
"volume_down": MediaPlayer.CLICK_VOLUME_DOWN, # click - (Volume down)
"volume_down_hold": MediaPlayer.CLICK_VOLUME_DOWN, # hold - (Volume down)
"dots_1_initial_press": MediaPlayer.PREVIOUS_SOURCE, # click . (Previous Source)
"dots_2_initial_press": MediaPlayer.NEXT_SOURCE, # click .. (Next Source)
}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1002: MediaPlayer.PLAY, # Play; Press/Release or Hold
2001: MediaPlayer.HOLD_VOLUME_UP, # +; Hold (every 0.2s)
2002: MediaPlayer.RELEASE, # +; Press/Release
3001: MediaPlayer.HOLD_VOLUME_DOWN, # +; Hold (every 0.2s)
3002: MediaPlayer.RELEASE, # -; Press/Release
4002: MediaPlayer.PREVIOUS_TRACK, # Previous; Press/Release or Hold
5002: MediaPlayer.NEXT_TRACK, # Next; Press/Release or Hold
6000: MediaPlayer.PREVIOUS_SOURCE, # .; Initial Press
7000: MediaPlayer.NEXT_SOURCE, # ..; Initial Press
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"toggle": MediaPlayer.PLAY_PAUSE, # click Play button
"play_pause": MediaPlayer.PLAY_PAUSE, # click Play button
"step_0_1_0_0_0": MediaPlayer.NEXT_TRACK, # click Next Track
"step_1_1_0_0_0": MediaPlayer.PREVIOUS_TRACK, # click Previous Track
"move_with_on_off_0_255": MediaPlayer.CLICK_VOLUME_UP, # click + (Volume up)
"move_0_255_0_0": MediaPlayer.HOLD_VOLUME_UP, # hold + (Volume up)
"move_with_on_off_1_255": MediaPlayer.CLICK_VOLUME_DOWN, # click - (Volume down)
"move_1_255_0_0": MediaPlayer.HOLD_VOLUME_DOWN, # hold - (Volume down)
"2_initial_press_0": MediaPlayer.PREVIOUS_SOURCE, # click . (Previous Source)
"3_initial_press_0": MediaPlayer.NEXT_SOURCE, # click .. (Next Source)
}
def get_zha_action(self, data: EventData) -> str:
command = data["command"]
args = data["args"]
if isinstance(args, dict):
args = args["args"]
args = list(map(str, args))
action = command
if not (command == "stop" or command == "release"):
if len(args) > 0:
action += "_" + "_".join(args)
endpoint = data["endpoint_id"]
# We only need to add the endpoint ID for the dot buttons, which use 2 and 3
if endpoint != 1:
return f"{data['endpoint_id']}_{action}"
else:
return action
@@ -0,0 +1,100 @@
from typing import Any
from cx_const import DefaultActionsMapping, Light, Z2MLight
from cx_core import LightController, Z2MLightController
from cx_core.integration import EventData
def get_zha_action_LegrandWallController(data: dict[str, Any]) -> str:
endpoint_id = data.get("endpoint_id", 1)
command: str = data["command"]
action = command
args = data.get("args", {})
args_mapping = {0: "up", 1: "down"}
if command == "move":
action = "_".join((action, args_mapping[args[0]]))
action = "_".join((str(endpoint_id), action))
return action
class Legrand600083LightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Light.ON,
"off": Light.OFF,
"brightness_move_up": Light.HOLD_BRIGHTNESS_UP,
"brightness_move_down": Light.HOLD_BRIGHTNESS_DOWN,
"brightness_stop": Light.RELEASE,
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"1_on": Light.ON,
"1_off": Light.OFF,
"1_move_up": Light.HOLD_BRIGHTNESS_UP,
"1_move_down": Light.HOLD_BRIGHTNESS_DOWN,
"1_stop": Light.RELEASE,
}
def get_zha_action(self, data: EventData) -> str:
return get_zha_action_LegrandWallController(data)
class Legrand600083Z2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Z2MLight.ON,
"off": Z2MLight.OFF,
"brightness_move_up": Z2MLight.HOLD_BRIGHTNESS_UP,
"brightness_move_down": Z2MLight.HOLD_BRIGHTNESS_DOWN,
"brightness_stop": Z2MLight.RELEASE,
}
class Legrand600088LightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on_left": Light.ON,
"off_left": Light.OFF,
"brightness_move_up_left": Light.HOLD_COLOR_UP,
"brightness_move_down_left": Light.HOLD_COLOR_DOWN,
"brightness_stop_left": Light.RELEASE,
"on_right": Light.ON_FULL_BRIGHTNESS,
"off_right": Light.ON_MIN_BRIGHTNESS,
"brightness_move_up_right": Light.HOLD_BRIGHTNESS_UP,
"brightness_move_down_right": Light.HOLD_BRIGHTNESS_DOWN,
"brightness_stop_right": Light.RELEASE,
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"1_on": Light.ON,
"1_off": Light.OFF,
"1_move_up": Light.HOLD_COLOR_UP,
"1_move_down": Light.HOLD_COLOR_DOWN,
"1_stop": Light.RELEASE,
"2_on": Light.ON_FULL_BRIGHTNESS,
"2_off": Light.ON_MIN_BRIGHTNESS,
"2_move_up": Light.HOLD_BRIGHTNESS_UP,
"2_move_down": Light.HOLD_BRIGHTNESS_DOWN,
"2_stop": Light.RELEASE,
}
def get_zha_action(self, data: EventData) -> str:
return get_zha_action_LegrandWallController(data)
class Legrand600088Z2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on_left": Z2MLight.ON,
"off_left": Z2MLight.OFF,
"brightness_move_up_left": Z2MLight.HOLD_COLOR_TEMP_UP,
"brightness_move_down_left": Z2MLight.HOLD_COLOR_TEMP_DOWN,
"brightness_stop_left": Z2MLight.RELEASE,
"on_right": Z2MLight.ON_FULL_BRIGHTNESS,
"off_right": Z2MLight.ON_MIN_BRIGHTNESS,
"brightness_move_up_right": Z2MLight.HOLD_BRIGHTNESS_UP,
"brightness_move_down_right": Z2MLight.HOLD_BRIGHTNESS_DOWN,
"brightness_stop_right": Z2MLight.RELEASE,
}
@@ -0,0 +1,38 @@
from cx_const import DefaultActionsMapping, Light, Z2MLight
from cx_core import LightController, Z2MLightController
class ZS23000278LightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Light.ON,
"off": Light.OFF,
"brightness_step_up": Light.CLICK_BRIGHTNESS_UP,
"brightness_step_down": Light.CLICK_BRIGHTNESS_DOWN,
"brightness_move_to_level": Light.BRIGHTNESS_FROM_CONTROLLER_LEVEL,
"brightness_move_up": Light.HOLD_BRIGHTNESS_UP,
"brightness_move_down": Light.HOLD_BRIGHTNESS_DOWN,
"brightness_stop": Light.RELEASE,
"color_temperature_move": Light.COLORTEMP_FROM_CONTROLLER,
"color_temperature_move_up": Light.CLICK_COLOR_TEMP_UP,
"color_temperature_move_down": Light.CLICK_COLOR_TEMP_DOWN,
"color_move": Light.XYCOLOR_FROM_CONTROLLER,
}
class ZS23000278Z2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Z2MLight.ON,
"off": Z2MLight.OFF,
"brightness_step_up": Z2MLight.CLICK_BRIGHTNESS_UP,
"brightness_step_down": Z2MLight.CLICK_BRIGHTNESS_DOWN,
"brightness_move_to_level": Z2MLight.BRIGHTNESS_FROM_CONTROLLER_LEVEL,
"brightness_move_up": Z2MLight.HOLD_BRIGHTNESS_UP,
"brightness_move_down": Z2MLight.HOLD_BRIGHTNESS_DOWN,
"brightness_stop": Z2MLight.RELEASE,
"color_temperature_move": Z2MLight.COLORTEMP_FROM_CONTROLLER,
"color_temperature_move_up": Z2MLight.CLICK_COLOR_TEMP_UP,
"color_temperature_move_down": Z2MLight.CLICK_COLOR_TEMP_DOWN,
"color_move": Z2MLight.XYCOLOR_FROM_CONTROLLER,
}
@@ -0,0 +1,47 @@
from cx_const import DefaultActionsMapping, Light, Z2MLight
from cx_core import LightController, Z2MLightController
class HG06323LightController(LightController):
# Different states reported from the controller:
# on, off, brightness_step_up, brightness_move_up,
# brightness_step_down, brightness_move_down, brightness_stop
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Light.ON,
"brightness_step_up": Light.CLICK_BRIGHTNESS_UP,
"brightness_move_up": Light.HOLD_BRIGHTNESS_UP,
"brightness_stop": Light.RELEASE,
"brightness_step_down": Light.CLICK_BRIGHTNESS_DOWN,
"brightness_move_down": Light.HOLD_BRIGHTNESS_DOWN,
"off": Light.OFF,
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Light.ON,
"step_0_51_10": Light.CLICK_BRIGHTNESS_UP,
"move_0_51": Light.HOLD_BRIGHTNESS_UP,
"stop": Light.RELEASE,
"step_1_51_10": Light.CLICK_BRIGHTNESS_DOWN,
"move_1_51": Light.HOLD_BRIGHTNESS_DOWN,
"off": Light.OFF,
}
class HG06323Z2MLightController(Z2MLightController):
# Different states reported from the controller:
# on, off, brightness_step_up, brightness_move_up,
# brightness_step_down, brightness_move_down, brightness_stop
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Z2MLight.ON,
"brightness_step_up": Z2MLight.CLICK_BRIGHTNESS_UP,
"brightness_move_up": Z2MLight.HOLD_BRIGHTNESS_UP,
"brightness_stop": Z2MLight.RELEASE,
"brightness_step_down": Z2MLight.CLICK_BRIGHTNESS_DOWN,
"brightness_move_down": Z2MLight.HOLD_BRIGHTNESS_DOWN,
"off": Z2MLight.OFF,
}
@@ -0,0 +1,167 @@
from cx_const import DefaultActionsMapping, Light, MediaPlayer, Z2MLight
from cx_core import LightController, MediaPlayerController
from cx_core.type.z2m_light_controller import Z2MLightController
class LZL4BWHL01LightController(LightController):
# Each button press fires an event but no separate
# hold event. Press of up or down generates a stop event
# when released.
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1002: Light.ON_FULL_BRIGHTNESS,
2001: Light.HOLD_BRIGHTNESS_UP,
2003: Light.RELEASE,
3001: Light.HOLD_BRIGHTNESS_DOWN,
3003: Light.RELEASE,
4002: Light.OFF,
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"move_to_level_with_on_off_254_4": Light.ON_FULL_BRIGHTNESS,
"step_with_on_off_0_30_6": Light.HOLD_BRIGHTNESS_UP,
"step_1_30_6": Light.HOLD_BRIGHTNESS_DOWN,
"move_to_level_with_on_off_0_4": Light.OFF,
"stop": Light.RELEASE,
}
class Z31BRLLightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"brightness_move_to_level": Light.BRIGHTNESS_FROM_CONTROLLER_LEVEL,
}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1002: Light.TOGGLE,
2002: Light.CLICK_BRIGHTNESS_UP,
3002: Light.CLICK_BRIGHTNESS_DOWN,
}
class Z31BRLZ2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"brightness_move_to_level": Z2MLight.BRIGHTNESS_FROM_CONTROLLER_LEVEL,
}
class LutronPJ22BLightController(LightController):
def get_state_actions_mapping(self) -> DefaultActionsMapping:
return {
"1": Light.ON_FULL_BRIGHTNESS,
"4": Light.OFF,
}
def get_lutron_caseta_actions_mapping(self) -> DefaultActionsMapping:
return {
"button_2_press": Light.ON,
"button_4_press": Light.OFF,
}
class LutronPJ22BMediaPlayerController(MediaPlayerController):
def get_state_actions_mapping(self) -> DefaultActionsMapping:
return {
"1": MediaPlayer.PLAY_PAUSE,
"4": MediaPlayer.NEXT_TRACK,
}
def get_lutron_caseta_actions_mapping(self) -> DefaultActionsMapping:
return {
"button_2_press": MediaPlayer.PLAY_PAUSE,
"button_4_press": MediaPlayer.NEXT_TRACK,
}
class LutronPJ22BRLLightController(LightController):
def get_state_actions_mapping(self) -> DefaultActionsMapping:
return {
"1": Light.ON_FULL_BRIGHTNESS,
"8": Light.HOLD_BRIGHTNESS_UP,
"16": Light.HOLD_BRIGHTNESS_DOWN,
"4": Light.OFF,
"0": Light.RELEASE,
}
class LutronPJ22BRLMediaPlayerController(MediaPlayerController):
def get_state_actions_mapping(self) -> DefaultActionsMapping:
return {
"1": MediaPlayer.PLAY_PAUSE,
"8": MediaPlayer.HOLD_VOLUME_UP,
"16": MediaPlayer.HOLD_VOLUME_DOWN,
"4": MediaPlayer.NEXT_TRACK,
"0": MediaPlayer.RELEASE,
}
class LutronPJ23BRLLightController(LightController):
def get_state_actions_mapping(self) -> DefaultActionsMapping:
return {
"1": Light.ON_FULL_BRIGHTNESS,
"8": Light.HOLD_BRIGHTNESS_UP,
"2": Light.SET_HALF_BRIGHTNESS,
"16": Light.HOLD_BRIGHTNESS_DOWN,
"4": Light.OFF,
"0": Light.RELEASE,
}
def get_lutron_caseta_actions_mapping(self) -> DefaultActionsMapping:
return {
"button_2_press": Light.ON_FULL_BRIGHTNESS,
"button_4_press": Light.OFF,
"button_3_press": Light.SET_HALF_BRIGHTNESS,
"button_5_press": Light.HOLD_BRIGHTNESS_UP,
"button_5_release": Light.RELEASE,
"button_6_press": Light.HOLD_BRIGHTNESS_DOWN,
"button_6_release": Light.RELEASE,
}
class LutronPJ23BRLMediaPlayerController(MediaPlayerController):
def get_state_actions_mapping(self) -> DefaultActionsMapping:
return {
"1": MediaPlayer.PLAY_PAUSE,
"8": MediaPlayer.HOLD_VOLUME_UP,
"2": MediaPlayer.NEXT_SOURCE,
"16": MediaPlayer.HOLD_VOLUME_DOWN,
"4": MediaPlayer.NEXT_TRACK,
"0": MediaPlayer.RELEASE,
}
def get_lutron_caseta_actions_mapping(self) -> DefaultActionsMapping:
return {
"button_2_press": MediaPlayer.PLAY_PAUSE,
"button_4_press": MediaPlayer.NEXT_TRACK,
"button_3_press": MediaPlayer.NEXT_SOURCE,
"button_5_press": MediaPlayer.HOLD_VOLUME_UP,
"button_5_release": MediaPlayer.RELEASE,
"button_6_press": MediaPlayer.HOLD_VOLUME_DOWN,
"button_6_release": MediaPlayer.RELEASE,
}
class LutronPJ24BLightController(LightController):
def get_state_actions_mapping(self) -> DefaultActionsMapping:
return {
"1": Light.ON_FULL_BRIGHTNESS,
"2": Light.HOLD_BRIGHTNESS_UP,
"4": Light.HOLD_BRIGHTNESS_DOWN,
"8": Light.OFF,
"0": Light.RELEASE,
}
class LutronPJ24BMediaPlayerController(MediaPlayerController):
def get_state_actions_mapping(self) -> DefaultActionsMapping:
return {
"1": MediaPlayer.PLAY_PAUSE,
"2": MediaPlayer.HOLD_VOLUME_UP,
"4": MediaPlayer.HOLD_VOLUME_DOWN,
"8": MediaPlayer.NEXT_TRACK,
"0": MediaPlayer.RELEASE,
}
@@ -0,0 +1,118 @@
from cx_const import DefaultActionsMapping, Light, Z2MLight
from cx_core import LightController, Z2MLightController
from cx_core.controller import Controller
from cx_core.integration import EventData
class MLI404011LightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Light.TOGGLE,
"off": Light.TOGGLE,
"brightness_down_click": Light.CLICK_BRIGHTNESS_DOWN,
"brightness_down_hold": Light.HOLD_BRIGHTNESS_DOWN,
"brightness_down_release": Light.RELEASE,
"brightness_up_click": Light.CLICK_BRIGHTNESS_UP,
"brightness_up_hold": Light.HOLD_BRIGHTNESS_UP,
"brightness_up_release": Light.RELEASE,
"color_wheel": Light.XYCOLOR_FROM_CONTROLLER, # Color ring press
"color_temp": Light.COLORTEMP_FROM_CONTROLLER, # warm or cold
"scene_1": None, # sunset button
"scene_2": None, # party button
"scene_3": None, # reading button
"scene_4": None, # fire button
"scene_5": None, # heart button
"scene_6": None, # night button
}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1002: Light.TOGGLE,
2001: Light.HOLD_BRIGHTNESS_UP,
2002: Light.CLICK_BRIGHTNESS_UP,
2003: Light.RELEASE,
3001: Light.HOLD_BRIGHTNESS_DOWN,
3002: Light.CLICK_BRIGHTNESS_DOWN,
3003: Light.RELEASE,
4002: Light.CLICK_COLOR_UP,
5002: Light.CLICK_COLOR_DOWN,
6002: Light.XYCOLOR_FROM_CONTROLLER, # Color ring press
7002: None, # reading button
8002: None, # sunset button
9002: None, # party button
10002: None, # night button
11002: None, # fire button
12002: None, # heart button
}
class MLI404011Z2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Z2MLight.TOGGLE,
"off": Z2MLight.TOGGLE,
"brightness_down_click": Z2MLight.CLICK_BRIGHTNESS_DOWN,
"brightness_down_hold": Z2MLight.HOLD_BRIGHTNESS_DOWN,
"brightness_down_release": Z2MLight.RELEASE,
"brightness_up_click": Z2MLight.CLICK_BRIGHTNESS_UP,
"brightness_up_hold": Z2MLight.HOLD_BRIGHTNESS_UP,
"brightness_up_release": Z2MLight.RELEASE,
"color_wheel": Z2MLight.XYCOLOR_FROM_CONTROLLER, # Color ring press
"color_temp": Z2MLight.COLORTEMP_FROM_CONTROLLER, # warm or cold
"scene_1": None, # sunset button
"scene_2": None, # party button
"scene_3": None, # reading button
"scene_4": None, # fire button
"scene_5": None, # heart button
"scene_6": None, # night button
}
class MLI404002Controller(Controller):
def get_zha_action(self, data: EventData) -> str:
command: str = data["command"]
if command not in ("move", "step"):
return command
args = data["args"]
direction_mapping = {0: "up", 1: "down"}
return f"{command}_{direction_mapping[args[0]]}"
class MLI404002LightController(MLI404002Controller, LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Light.TOGGLE,
"off": Light.TOGGLE,
"brightness_step_up": Light.CLICK_BRIGHTNESS_UP,
"brightness_step_down": Light.CLICK_BRIGHTNESS_DOWN,
"brightness_move_up": Light.HOLD_BRIGHTNESS_UP,
"brightness_move_down": Light.HOLD_BRIGHTNESS_DOWN,
"brightness_stop": Light.RELEASE,
"recall_1": Light.ON_FULL_BRIGHTNESS,
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Light.TOGGLE,
"off": Light.TOGGLE,
"move_up": Light.HOLD_BRIGHTNESS_UP,
"move_down": Light.HOLD_BRIGHTNESS_DOWN,
"stop": Light.RELEASE,
"step_up": Light.CLICK_BRIGHTNESS_UP,
"step_down": Light.CLICK_BRIGHTNESS_DOWN,
"recall": Light.ON_FULL_BRIGHTNESS,
}
class MLI404002Z2MLightController(MLI404002Controller, Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Z2MLight.TOGGLE,
"off": Z2MLight.TOGGLE,
"brightness_step_up": Z2MLight.CLICK_BRIGHTNESS_UP,
"brightness_step_down": Z2MLight.CLICK_BRIGHTNESS_DOWN,
"brightness_move_up": Z2MLight.HOLD_BRIGHTNESS_UP,
"brightness_move_down": Z2MLight.HOLD_BRIGHTNESS_DOWN,
"brightness_stop": Z2MLight.RELEASE,
"recall_1": Z2MLight.ON_FULL_BRIGHTNESS,
}
@@ -0,0 +1,54 @@
from cx_const import DefaultActionsMapping, Light, Z2MLight
from cx_core import LightController, Z2MLightController
class Namron4512773LightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on_l1": Light.ON,
"off_l1": Light.OFF,
"brightness_move_up_l1": Light.HOLD_BRIGHTNESS_UP,
"brightness_move_down_l1": Light.HOLD_BRIGHTNESS_DOWN,
"brightness_stop_l1": Light.RELEASE,
"on_l2": Light.ON,
"off_l2": Light.OFF,
"brightness_move_up_l2": Light.HOLD_BRIGHTNESS_UP,
"brightness_move_down_l2": Light.HOLD_BRIGHTNESS_DOWN,
"brightness_stop_l2": Light.RELEASE,
"on_l3": Light.ON,
"off_l3": Light.OFF,
"brightness_move_up_l3": Light.HOLD_BRIGHTNESS_UP,
"brightness_move_down_l3": Light.HOLD_BRIGHTNESS_DOWN,
"brightness_stop_l3": Light.RELEASE,
"on_l4": Light.ON,
"off_l4": Light.OFF,
"brightness_move_up_l4": Light.HOLD_BRIGHTNESS_UP,
"brightness_move_down_l4": Light.HOLD_BRIGHTNESS_DOWN,
"brightness_stop_l4": Light.RELEASE,
}
class Namron4512773Z2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on_l1": Z2MLight.ON,
"off_l1": Z2MLight.OFF,
"brightness_move_up_l1": Z2MLight.HOLD_BRIGHTNESS_UP,
"brightness_move_down_l1": Z2MLight.HOLD_BRIGHTNESS_DOWN,
"brightness_stop_l1": Z2MLight.RELEASE,
"on_l2": Z2MLight.ON,
"off_l2": Z2MLight.OFF,
"brightness_move_up_l2": Z2MLight.HOLD_BRIGHTNESS_UP,
"brightness_move_down_l2": Z2MLight.HOLD_BRIGHTNESS_DOWN,
"brightness_stop_l2": Z2MLight.RELEASE,
"on_l3": Z2MLight.ON,
"off_l3": Z2MLight.OFF,
"brightness_move_up_l3": Z2MLight.HOLD_BRIGHTNESS_UP,
"brightness_move_down_l3": Z2MLight.HOLD_BRIGHTNESS_DOWN,
"brightness_stop_l3": Z2MLight.RELEASE,
"on_l4": Z2MLight.ON,
"off_l4": Z2MLight.OFF,
"brightness_move_up_l4": Z2MLight.HOLD_BRIGHTNESS_UP,
"brightness_move_down_l4": Z2MLight.HOLD_BRIGHTNESS_DOWN,
"brightness_stop_l4": Z2MLight.RELEASE,
}
@@ -0,0 +1,38 @@
from cx_const import DefaultActionsMapping, Light
from cx_core import LightController
from cx_core.integration import EventData
class OsramAC025XX00NJLightController(LightController):
# This mapping works for: AC0251100NJ / AC0251400NJ / AC0251600NJ / AC0251700NJ
# (different models are just different colours)
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1002: Light.ON, # Click Arrow up
1001: Light.HOLD_BRIGHTNESS_UP, # Hold Arrow Up
1003: Light.RELEASE, # Release Arrow Up
2002: Light.OFF, # Click Arrow down
2001: Light.HOLD_BRIGHTNESS_DOWN, # Hold Arrow down
2003: Light.RELEASE, # Release Arrow down
3002: Light.SYNC, # Click Circle button
3001: Light.HOLD_COLOR_UP, # Hold Circle button
3003: Light.RELEASE, # Release Circle button
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"1_on": Light.ON,
"1_move_with_on_off": Light.HOLD_BRIGHTNESS_UP,
"1_stop": Light.RELEASE,
"3_move_to_level_with_on_off": None,
"3_move_to_color_temp": Light.SYNC,
"3_move_to_saturation": Light.HOLD_COLOR_UP,
"3_move_hue": Light.RELEASE,
"2_off": Light.OFF,
"2_move": Light.HOLD_BRIGHTNESS_DOWN,
"2_stop": Light.RELEASE,
}
def get_zha_action(self, data: EventData) -> str:
return f"{data['endpoint_id']}_{data['command']}"
@@ -0,0 +1,326 @@
from cx_const import DefaultActionsMapping, Light, Z2MLight
from cx_core import LightController, Z2MLightController
from cx_core.integration import EventData
class HueDimmerController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on_press_release": Light.ON,
"on_hold": Light.HOLD_COLOR_UP,
"on_hold_release": Light.RELEASE,
"up_press_release": Light.CLICK_BRIGHTNESS_UP,
"up_hold": Light.HOLD_BRIGHTNESS_UP,
"up_hold_release": Light.RELEASE,
"down_press_release": Light.CLICK_BRIGHTNESS_DOWN,
"down_hold": Light.HOLD_BRIGHTNESS_DOWN,
"down_hold_release": Light.RELEASE,
"off_press_release": Light.OFF,
"off_hold": Light.HOLD_COLOR_DOWN,
"off_hold_release": Light.RELEASE,
}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1002: Light.ON,
1001: Light.HOLD_COLOR_UP,
1003: Light.RELEASE,
2002: Light.CLICK_BRIGHTNESS_UP,
2001: Light.HOLD_BRIGHTNESS_UP,
2003: Light.RELEASE,
3002: Light.CLICK_BRIGHTNESS_DOWN,
3001: Light.HOLD_BRIGHTNESS_DOWN,
3003: Light.RELEASE,
4002: Light.OFF,
4001: Light.HOLD_COLOR_DOWN,
4003: Light.RELEASE,
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"off_long_release": Light.RELEASE,
"off_hold": Light.HOLD_COLOR_DOWN,
"off_short_release": Light.OFF,
"down_long_release": Light.RELEASE,
"down_hold": Light.HOLD_BRIGHTNESS_DOWN,
"down_short_release": Light.CLICK_BRIGHTNESS_DOWN,
"up_long_release": Light.RELEASE,
"up_hold": Light.HOLD_BRIGHTNESS_UP,
"up_short_release": Light.CLICK_BRIGHTNESS_UP,
"on_long_release": Light.RELEASE,
"on_hold": Light.HOLD_COLOR_UP,
"on_short_release": Light.ON,
}
def get_zha_action(self, data: EventData) -> str:
command: str = data["command"]
return command
class HueDimmerZ2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on_press_release": Z2MLight.ON,
"on_hold": Z2MLight.HOLD_COLOR_TEMP_UP,
"on_hold_release": Z2MLight.RELEASE,
"up_press_release": Z2MLight.CLICK_BRIGHTNESS_UP,
"up_hold": Z2MLight.HOLD_BRIGHTNESS_UP,
"up_hold_release": Z2MLight.RELEASE,
"down_press_release": Z2MLight.CLICK_BRIGHTNESS_DOWN,
"down_hold": Z2MLight.HOLD_BRIGHTNESS_DOWN,
"down_hold_release": Z2MLight.RELEASE,
"off_press_release": Z2MLight.OFF,
"off_hold": Z2MLight.HOLD_COLOR_TEMP_DOWN,
"off_hold_release": Z2MLight.RELEASE,
}
class Philips929002398602LightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on_press_release": Light.TOGGLE,
"on_hold": Light.TOGGLE,
"on_hold_release": Light.RELEASE,
"up_press_release": Light.CLICK_BRIGHTNESS_UP,
"up_hold": Light.HOLD_BRIGHTNESS_UP,
"up_hold_release": Light.RELEASE,
"down_press_release": Light.CLICK_BRIGHTNESS_DOWN,
"down_hold": Light.HOLD_BRIGHTNESS_DOWN,
"down_hold_release": Light.RELEASE,
"off_press_release": Light.CLICK_COLOR_UP,
"off_hold": Light.HOLD_COLOR_DOWN,
"off_hold_release": Light.RELEASE,
}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1002: Light.TOGGLE,
1001: Light.TOGGLE,
1003: Light.RELEASE,
2002: Light.CLICK_BRIGHTNESS_UP,
2001: Light.HOLD_BRIGHTNESS_UP,
2003: Light.RELEASE,
3002: Light.CLICK_BRIGHTNESS_DOWN,
3001: Light.HOLD_BRIGHTNESS_DOWN,
3003: Light.RELEASE,
4002: Light.CLICK_COLOR_UP,
4001: Light.HOLD_COLOR_DOWN,
4003: Light.RELEASE,
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"off_long_release": Light.RELEASE,
"off_hold": Light.HOLD_COLOR_DOWN,
"off_short_release": Light.CLICK_COLOR_UP,
"down_long_release": Light.RELEASE,
"down_hold": Light.HOLD_BRIGHTNESS_DOWN,
"down_short_release": Light.CLICK_BRIGHTNESS_DOWN,
"up_long_release": Light.RELEASE,
"up_hold": Light.HOLD_BRIGHTNESS_UP,
"up_short_release": Light.CLICK_BRIGHTNESS_UP,
"on_long_release": Light.RELEASE,
"on_hold": Light.TOGGLE,
"on_short_release": Light.TOGGLE,
}
def get_zha_action(self, data: EventData) -> str:
command: str = data["command"]
return command
class Philips929002398602Z2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on_press_release": Z2MLight.ON,
"on_hold": Z2MLight.HOLD_COLOR_TEMP_UP,
"on_hold_release": Z2MLight.RELEASE,
"up_press_release": Z2MLight.CLICK_BRIGHTNESS_UP,
"up_hold": Z2MLight.HOLD_BRIGHTNESS_UP,
"up_hold_release": Z2MLight.RELEASE,
"down_press_release": Z2MLight.CLICK_BRIGHTNESS_DOWN,
"down_hold": Z2MLight.HOLD_BRIGHTNESS_DOWN,
"down_hold_release": Z2MLight.RELEASE,
"off_press_release": Z2MLight.OFF,
"off_hold": Z2MLight.HOLD_COLOR_TEMP_DOWN,
"off_hold_release": Z2MLight.RELEASE,
}
class PTM215XLightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"press_1": Light.ON,
"release_1": Light.RELEASE,
"press_2": Light.OFF,
"release_2": Light.RELEASE,
"press_3": Light.ON_FULL_BRIGHTNESS,
"release_3": Light.RELEASE,
"press_4": Light.ON_MIN_BRIGHTNESS,
"release_4": Light.RELEASE,
"press_1_and_3": Light.ON_FULL_COLOR_TEMP,
"release_1_and_3": Light.RELEASE,
"press_2_and_4": Light.ON_MIN_COLOR_TEMP,
"release_2_and_4": Light.RELEASE,
"press_energy_bar": Light.SYNC,
}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1002: Light.ON, # button_1_release
1001: Light.SYNC, # button_1_hold
1000: None, # button_1_press
1003: None, # button_1_release_after_hold
2002: Light.OFF, # button_2_release
2001: Light.SYNC, # button_2_hold
2000: None, # button_2_press
2003: None, # button_2_release_after_hold
3002: Light.ON_FULL_BRIGHTNESS, # button_3_release
3001: Light.HOLD_BRIGHTNESS_UP, # button_3_hold
3000: None, # button_3_press
3003: Light.RELEASE, # button_3_release_after_hold
4002: Light.ON_MIN_BRIGHTNESS, # button_4_release
4001: Light.HOLD_BRIGHTNESS_DOWN, # button_4_hold
4000: None, # button_4_press
4003: Light.RELEASE, # button_4_release_after_hold
5002: Light.ON_FULL_COLOR_TEMP, # button_1_3_release
5001: Light.HOLD_COLOR_UP, # button_1_3_hold
5000: None, # button_1_3_press
5003: Light.RELEASE, # button_1_3_release_after_hold
6002: Light.ON_MIN_COLOR_TEMP, # button_2_4_release
6001: Light.HOLD_COLOR_DOWN, # button_2_4_hold
6000: None, # button_2_4_press
6003: Light.RELEASE, # button_2_4_release_after_hold
}
class HueSmartButtonLightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Light.TOGGLE,
"off": Light.TOGGLE,
"hold": Light.HOLD_BRIGHTNESS_TOGGLE,
"release": Light.RELEASE,
}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1000: None, # Initial press
1001: Light.HOLD_BRIGHTNESS_TOGGLE,
1002: Light.TOGGLE,
1003: Light.RELEASE,
}
class HueSmartButtonZ2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Z2MLight.TOGGLE,
"off": Z2MLight.TOGGLE,
"hold": Z2MLight.HOLD_BRIGHTNESS_TOGGLE,
"release": Z2MLight.RELEASE,
}
class Philips929003017102LightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
# "left_press": Light.TOGGLE,
"left_press_release": Light.TOGGLE,
"left_hold": Light.HOLD_BRIGHTNESS_TOGGLE,
"left_hold_release": Light.RELEASE,
# "right_press": Light.TOGGLE,
"right_press_release": Light.TOGGLE,
"right_hold": Light.HOLD_BRIGHTNESS_TOGGLE,
"right_hold_release": Light.RELEASE,
}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1000: None, # Initial press
1001: Light.HOLD_BRIGHTNESS_TOGGLE,
1002: Light.TOGGLE,
1003: Light.RELEASE,
2000: None, # Initial press
2001: Light.HOLD_BRIGHTNESS_TOGGLE,
2002: Light.TOGGLE,
2003: Light.RELEASE,
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
# "left_press": Light.TOGGLE,
"left_press_release": Light.TOGGLE,
"left_hold": Light.HOLD_BRIGHTNESS_TOGGLE,
"left_hold_release": Light.RELEASE,
# "right_press": Light.TOGGLE,
"right_short_release": Light.TOGGLE,
"right_hold": Light.HOLD_BRIGHTNESS_TOGGLE,
"right_long_release": Light.RELEASE,
}
def get_zha_action(self, data: EventData) -> str:
command: str = data["command"]
return command
class Philips929003017102Z2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
# "left_press": Z2MLight.TOGGLE,
"left_press_release": Z2MLight.TOGGLE,
"left_hold": Z2MLight.HOLD_BRIGHTNESS_TOGGLE,
"left_hold_release": Z2MLight.RELEASE,
# "right_press": Z2MLight.TOGGLE,
"right_press_release": Z2MLight.TOGGLE,
"right_hold": Z2MLight.HOLD_BRIGHTNESS_TOGGLE,
"right_hold_release": Z2MLight.RELEASE,
}
class PhilipsRDM002LightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"button_1_press_release": Light.OFF,
"button_1_hold": Light.HOLD_BRIGHTNESS_DOWN,
"button_1_hold_release": Light.RELEASE,
"button_2_press_release": Light.ON,
"button_2_hold": Light.HOLD_BRIGHTNESS_UP,
"button_2_hold_release": Light.RELEASE,
"button_3_press_release": Light.CLICK_COLOR_DOWN,
"button_3_hold": Light.HOLD_COLOR_DOWN,
"button_3_hold_release": Light.RELEASE,
"button_4_press_release": Light.CLICK_COLOR_UP,
"button_4_hold": Light.HOLD_COLOR_UP,
"button_4_hold_release": Light.RELEASE,
"dial_rotate_left_step": Light.CLICK_BRIGHTNESS_DOWN,
"dial_rotate_left_slow": Light.ON_MIN_COLOR_TEMP,
"dial_rotate_left_fast": Light.ON_MIN_BRIGHTNESS,
"dial_rotate_right_step": Light.CLICK_BRIGHTNESS_UP,
"dial_rotate_right_slow": Light.ON_FULL_COLOR_TEMP,
"dial_rotate_right_fast": Light.ON_FULL_BRIGHTNESS,
}
class PhilipsRDM002Z2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"button_1_press_release": Z2MLight.OFF,
"button_1_hold": Z2MLight.HOLD_BRIGHTNESS_DOWN,
"button_1_hold_release": Z2MLight.RELEASE,
"button_2_press_release": Z2MLight.ON,
"button_2_hold": Z2MLight.HOLD_BRIGHTNESS_UP,
"button_2_hold_release": Z2MLight.RELEASE,
"button_3_press_release": Z2MLight.CLICK_COLOR_TEMP_DOWN,
"button_3_hold": Z2MLight.HOLD_COLOR_TEMP_DOWN,
"button_3_hold_release": Z2MLight.RELEASE,
"button_4_press_release": Z2MLight.CLICK_COLOR_TEMP_UP,
"button_4_hold": Z2MLight.HOLD_COLOR_TEMP_UP,
"button_4_hold_release": Z2MLight.RELEASE,
"dial_rotate_left_step": Z2MLight.CLICK_BRIGHTNESS_DOWN,
"dial_rotate_left_slow": Z2MLight.ON_MIN_COLOR_TEMP,
"dial_rotate_left_fast": Z2MLight.ON_MIN_BRIGHTNESS,
"dial_rotate_right_step": Light.CLICK_BRIGHTNESS_UP,
"dial_rotate_right_slow": Z2MLight.ON_FULL_COLOR_TEMP,
"dial_rotate_right_fast": Z2MLight.ON_FULL_BRIGHTNESS,
}
@@ -0,0 +1,34 @@
from cx_const import DefaultActionsMapping, Light, Z2MLight
from cx_core import LightController, Z2MLightController
class Prolight5412748727388LightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Light.ON,
"off": Light.OFF,
"brightness_move_up": Light.HOLD_BRIGHTNESS_UP,
"brightness_move_down": Light.HOLD_BRIGHTNESS_DOWN,
"brightness_stop": Light.RELEASE,
"brightness_move_to_level": Light.BRIGHTNESS_FROM_CONTROLLER_LEVEL,
"color_temperature_move": Light.COLORTEMP_FROM_CONTROLLER,
"color_temperature_move_up": Light.CLICK_COLOR_TEMP_UP,
"color_temperature_move_down": Light.CLICK_COLOR_TEMP_DOWN,
"color_move": Light.XYCOLOR_FROM_CONTROLLER,
}
class Prolight5412748727388Z2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Z2MLight.ON,
"off": Z2MLight.OFF,
"brightness_move_up": Z2MLight.HOLD_BRIGHTNESS_UP,
"brightness_move_down": Z2MLight.HOLD_BRIGHTNESS_DOWN,
"brightness_stop": Z2MLight.RELEASE,
"brightness_move_to_level": Z2MLight.BRIGHTNESS_FROM_CONTROLLER_LEVEL,
"color_temperature_move": Z2MLight.COLORTEMP_FROM_CONTROLLER,
"color_temperature_move_up": Z2MLight.CLICK_COLOR_TEMP_UP,
"color_temperature_move_down": Z2MLight.CLICK_COLOR_TEMP_DOWN,
"color_move": Z2MLight.XYCOLOR_FROM_CONTROLLER,
}
@@ -0,0 +1,90 @@
from cx_const import DefaultActionsMapping, Light, Z2MLight
from cx_core import LightController, Z2MLightController
from cx_core.controller import action
from cx_core.integration import EventData
from cx_core.integration.zha import ZHAIntegration
class ZB5121LightController(LightController):
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Light.ON,
"off": Light.OFF,
"step_with_on_off_0_32_0": Light.CLICK_BRIGHTNESS_UP, # Click brightness up
"move_with_on_off_0_50": Light.HOLD_BRIGHTNESS_UP, # Hold brightness up
"step_with_on_off_1_32_0": Light.CLICK_BRIGHTNESS_DOWN, # Click brightness down
"move_with_on_off_1_50": Light.HOLD_BRIGHTNESS_DOWN, # Hold brightness down
"recall_0_1": None, # Click clapperboard
"stop": Light.RELEASE, # long release
}
class ZB5122LightController(LightController):
@action
async def colortemp_from_controller(self, extra: EventData) -> None:
if isinstance(self.integration, ZHAIntegration):
await self._on(color_temp=extra["args"][0])
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Light.ON, # Click light on
"off": Light.OFF, # Click light off
"hold_brightness_up": Light.HOLD_BRIGHTNESS_UP, # Hold light on
"hold_brightness_down": Light.HOLD_BRIGHTNESS_DOWN, # Hold light off
"stop": Light.RELEASE, # long release
"move_to_color": Light.CLICK_XY_COLOR_UP, # click RGB
"move_hue": Light.HOLD_XY_COLOR_UP, # hold RGB
"stop_move_hue": Light.RELEASE, # release RGB
"move_to_color_temp": Light.COLORTEMP_FROM_CONTROLLER, # click CW
"move_color_temp": Light.HOLD_COLOR_TEMP_TOGGLE, # hold CW
"stop_move_step": Light.RELEASE, # release CW
"recall_0_1": None, # Click clapperboard
}
def get_zha_action(self, data: EventData) -> str:
command: str = data["command"]
if command == "move_with_on_off":
return (
"hold_brightness_up" if data["args"][0] == 0 else "hold_brightness_down"
)
elif command == "move_hue":
return "stop_move_hue" if tuple(data["args"]) == (0, 0) else "move_hue"
return command
class ZB3009LightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Light.TOGGLE,
"off": Light.TOGGLE,
"brightness_move_up": Light.HOLD_BRIGHTNESS_UP,
"brightness_move_down": Light.HOLD_BRIGHTNESS_DOWN,
"brightness_stop": Light.RELEASE,
"color_temperature_move_down": Light.CLICK_COLOR_TEMP_DOWN,
"color_temperature_move_up": Light.CLICK_COLOR_TEMP_UP,
"color_temperature_move": Light.COLORTEMP_FROM_CONTROLLER,
"color_move": Light.XYCOLOR_FROM_CONTROLLER,
"hue_move": None, # Play/pause button
"recall_1": None, # Scene 1
"recall_3": None, # Scene 2
"recall_2": None, # Scene 3
}
class ZB3009Z2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Z2MLight.TOGGLE,
"off": Z2MLight.TOGGLE,
"brightness_move_up": Z2MLight.HOLD_BRIGHTNESS_UP,
"brightness_move_down": Z2MLight.HOLD_BRIGHTNESS_DOWN,
"brightness_stop": Z2MLight.RELEASE,
"color_temperature_move_down": Z2MLight.CLICK_COLOR_TEMP_DOWN,
"color_temperature_move_up": Z2MLight.CLICK_COLOR_TEMP_UP,
"color_temperature_move": Z2MLight.COLORTEMP_FROM_CONTROLLER,
"color_move": Z2MLight.XYCOLOR_FROM_CONTROLLER,
"hue_move": None, # Play/pause button
"recall_1": None, # Scene 1
"recall_3": None, # Scene 2
"recall_2": None, # Scene 3
}
@@ -0,0 +1,54 @@
from cx_const import DefaultActionsMapping, Light, Z2MLight
from cx_core import LightController, Z2MLightController
class ROB2000070LightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on_1": Light.ON,
"off_1": Light.OFF,
"brightness_move_up_1": Light.HOLD_BRIGHTNESS_UP,
"brightness_move_down_1": Light.HOLD_BRIGHTNESS_DOWN,
"brightness_stop_1": Light.RELEASE,
"on_2": Light.ON,
"off_2": Light.OFF,
"brightness_move_up_2": Light.HOLD_BRIGHTNESS_UP,
"brightness_move_down_2": Light.HOLD_BRIGHTNESS_DOWN,
"brightness_stop_2": Light.RELEASE,
"on_3": Light.ON,
"off_3": Light.OFF,
"brightness_move_up_3": Light.HOLD_BRIGHTNESS_UP,
"brightness_move_down_3": Light.HOLD_BRIGHTNESS_DOWN,
"brightness_stop_3": Light.RELEASE,
"on_4": Light.ON,
"off_4": Light.OFF,
"brightness_move_up_4": Light.HOLD_BRIGHTNESS_UP,
"brightness_move_down_4": Light.HOLD_BRIGHTNESS_DOWN,
"brightness_stop_4": Light.RELEASE,
}
class ROB2000070Z2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on_1": Z2MLight.ON,
"off_1": Z2MLight.OFF,
"brightness_move_up_1": Z2MLight.HOLD_BRIGHTNESS_UP,
"brightness_move_down_1": Z2MLight.HOLD_BRIGHTNESS_DOWN,
"brightness_stop_1": Z2MLight.RELEASE,
"on_2": Z2MLight.ON,
"off_2": Z2MLight.OFF,
"brightness_move_up_2": Z2MLight.HOLD_BRIGHTNESS_UP,
"brightness_move_down_2": Z2MLight.HOLD_BRIGHTNESS_DOWN,
"brightness_stop_2": Z2MLight.RELEASE,
"on_3": Z2MLight.ON,
"off_3": Z2MLight.OFF,
"brightness_move_up_3": Z2MLight.HOLD_BRIGHTNESS_UP,
"brightness_move_down_3": Z2MLight.HOLD_BRIGHTNESS_DOWN,
"brightness_stop_3": Z2MLight.RELEASE,
"on_4": Z2MLight.ON,
"off_4": Z2MLight.OFF,
"brightness_move_up_4": Z2MLight.HOLD_BRIGHTNESS_UP,
"brightness_move_down_4": Z2MLight.HOLD_BRIGHTNESS_DOWN,
"brightness_stop_4": Z2MLight.RELEASE,
}
@@ -0,0 +1,48 @@
from cx_const import DefaultActionsMapping, Light, Z2MLight
from cx_core import LightController, Z2MLightController
class E1EG7FLightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Light.ON,
"on_long": Light.CLICK_COLOR_UP,
"on_double": Light.ON_FULL_COLOR_TEMP,
"up": Light.CLICK_BRIGHTNESS_UP,
"up_long": Light.ON_FULL_BRIGHTNESS,
"down": Light.CLICK_BRIGHTNESS_DOWN,
"down_long": Light.ON_MIN_BRIGHTNESS,
"off": Light.OFF,
"off_long": Light.CLICK_COLOR_DOWN,
"off_double": Light.ON_MIN_COLOR_TEMP,
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Light.ON,
"on_long": Light.CLICK_COLOR_UP,
"on_double": Light.ON_FULL_COLOR_TEMP,
"step_0_1_0": Light.CLICK_BRIGHTNESS_UP,
"step_0_2_0": Light.ON_FULL_BRIGHTNESS,
"step_1_1_0": Light.CLICK_BRIGHTNESS_DOWN,
"step_1_2_0": Light.ON_MIN_BRIGHTNESS,
"off": Light.OFF,
"off_long": Light.CLICK_COLOR_DOWN,
"off_double": Light.ON_MIN_COLOR_TEMP,
}
class E1EG7FZ2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Z2MLight.ON,
"on_long": Z2MLight.CLICK_COLOR_TEMP_UP,
"on_double": Z2MLight.ON_FULL_COLOR_TEMP,
"up": Z2MLight.CLICK_BRIGHTNESS_UP,
"up_long": Z2MLight.ON_FULL_BRIGHTNESS,
"down": Z2MLight.CLICK_BRIGHTNESS_DOWN,
"down_long": Z2MLight.ON_MIN_BRIGHTNESS,
"off": Z2MLight.OFF,
"off_long": Z2MLight.CLICK_COLOR_TEMP_DOWN,
"off_double": Z2MLight.ON_MIN_COLOR_TEMP,
}
@@ -0,0 +1,57 @@
from cx_const import DefaultActionsMapping, Light
from cx_core import LightController
class ShellyI3LightController(LightController):
def get_shellyforhass_actions_mapping(self) -> DefaultActionsMapping:
return {
"single": Light.CLICK_BRIGHTNESS_UP,
"long": Light.CLICK_BRIGHTNESS_DOWN,
"double": Light.ON_FULL_BRIGHTNESS,
}
class ShellyPlusI4LightController(LightController):
def get_shelly_actions_mapping(self) -> DefaultActionsMapping:
return {
"single_push_1": Light.ON,
"long_push_1": Light.HOLD_COLOR_UP,
"btn_up_1": Light.RELEASE,
"double_push_1": Light.ON_FULL_COLOR_TEMP,
"single_push_2": Light.OFF,
"long_push_2": Light.HOLD_COLOR_DOWN,
"btn_up_2": Light.RELEASE,
"double_push_2": Light.ON_MIN_COLOR_TEMP,
"single_push_3": Light.CLICK_BRIGHTNESS_UP,
"long_push_3": Light.HOLD_BRIGHTNESS_UP,
"btn_up_3": Light.RELEASE,
"double_push_3": Light.ON_FULL_BRIGHTNESS,
"single_push_4": Light.CLICK_BRIGHTNESS_DOWN,
"long_push_4": Light.HOLD_BRIGHTNESS_DOWN,
"btn_up_4": Light.RELEASE,
"double_push_4": Light.ON_MIN_BRIGHTNESS,
}
class Shelly25LightController(LightController):
def get_shelly_actions_mapping(self) -> DefaultActionsMapping:
return {
"single_push_1": Light.ON,
"long_push_1": Light.HOLD_BRIGHTNESS_UP,
"btn_up_1": Light.RELEASE,
"double_push_1": Light.ON_FULL_BRIGHTNESS,
"single_push_2": Light.OFF,
"long_push_2": Light.HOLD_BRIGHTNESS_DOWN,
"btn_up_2": Light.RELEASE,
"double_push_2": Light.ON_MIN_BRIGHTNESS,
}
class ShellyDimmer2LightController(LightController):
def get_shelly_actions_mapping(self) -> DefaultActionsMapping:
return {
"single_1": Light.TOGGLE,
"single_2": None,
"long_1": Light.TOGGLE,
"long_2": None,
}
@@ -0,0 +1,25 @@
from cx_const import DefaultActionsMapping, Light
from cx_core import LightController
class SK5700002228949LightController(LightController):
# This mapping works for: 5700002228949, 5700002228963, 5745000433087
# The buttons are distributted like:
# 1 3
# 2 4
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1002: Light.ON,
1001: Light.HOLD_BRIGHTNESS_UP,
1003: Light.RELEASE,
3002: Light.OFF,
3001: Light.HOLD_BRIGHTNESS_DOWN,
3003: Light.RELEASE,
2002: Light.CLICK_COLOR_UP,
2001: Light.HOLD_COLOR_UP,
2003: Light.RELEASE,
4002: Light.CLICK_COLOR_DOWN,
4001: Light.HOLD_COLOR_DOWN,
4003: Light.RELEASE,
}
@@ -0,0 +1,58 @@
from cx_const import DefaultActionsMapping, Light, MediaPlayer
from cx_core import LightController, MediaPlayerController
class SmartThingsButtonLightController(LightController):
"""
This controller sends click, double click, and hold commands.
No release command is sent.
"""
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"single": Light.TOGGLE,
"double": Light.ON_FULL_BRIGHTNESS,
"hold": Light.SET_HALF_BRIGHTNESS,
}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1002: Light.TOGGLE,
1004: Light.ON_FULL_BRIGHTNESS,
1001: Light.SET_HALF_BRIGHTNESS,
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"button_single_1_0_0_0": Light.TOGGLE,
"button_double_2_0_0_0": Light.ON_FULL_BRIGHTNESS,
"button_hold_3_0_0_0": Light.SET_HALF_BRIGHTNESS,
}
class SmartThingsButtonMediaPlayerController(MediaPlayerController):
"""
This controller sends click, double click, and hold commands.
No release command is sent.
"""
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"single_click": MediaPlayer.PLAY_PAUSE,
"double_click": MediaPlayer.NEXT_TRACK,
"hold": MediaPlayer.PREVIOUS_TRACK,
}
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1002: MediaPlayer.PLAY_PAUSE,
1004: MediaPlayer.NEXT_TRACK,
1001: MediaPlayer.PREVIOUS_TRACK,
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"button_single_1_0_0_0": MediaPlayer.PLAY_PAUSE,
"button_double_2_0_0_0": MediaPlayer.NEXT_TRACK,
"button_hold_3_0_0_0": MediaPlayer.PREVIOUS_TRACK,
}
@@ -0,0 +1,23 @@
from cx_const import DefaultActionsMapping, Light
from cx_core import LightController
from cx_core.integration import EventData
class SNZB01LightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"single": Light.TOGGLE, # single click
"double": Light.ON_FULL_BRIGHTNESS, # double click
"long": Light.ON_MIN_BRIGHTNESS, # hold
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"toggle": Light.TOGGLE, # single click
"on": Light.ON_FULL_BRIGHTNESS, # double click
"off": Light.ON_MIN_BRIGHTNESS, # hold
}
def get_zha_action(self, data: EventData) -> str:
command: str = data["command"]
return command
@@ -0,0 +1,103 @@
from cx_const import Cover, DefaultActionsMapping, Light, Switch, Z2MLight
from cx_core import (
CoverController,
LightController,
SwitchController,
Z2MLightController,
)
class TasmotaButtonZ2MLightController(Z2MLightController):
def get_tasmota_actions_mapping(self) -> DefaultActionsMapping:
return {
"TOGGLE": Z2MLight.TOGGLE,
"SINGLE": Z2MLight.TOGGLE,
"DOUBLE": Z2MLight.ON_MIN_BRIGHTNESS,
"TRIPLE": Z2MLight.SET_HALF_BRIGHTNESS,
"QUAD": Z2MLight.ON_FULL_BRIGHTNESS,
"PENTA": None,
"HOLD": Z2MLight.HOLD_BRIGHTNESS_TOGGLE,
"CLEAR": Z2MLight.RELEASE,
}
class TasmotaSwitchZ2MLightController(Z2MLightController):
def get_tasmota_actions_mapping(self) -> DefaultActionsMapping:
return {
"TOGGLE": Z2MLight.TOGGLE,
"ON": Z2MLight.ON,
"OFF": Z2MLight.OFF,
"HOLD": Z2MLight.SET_HALF_BRIGHTNESS,
}
class TasmotaButtonLightController(LightController):
def get_tasmota_actions_mapping(self) -> DefaultActionsMapping:
return {
"TOGGLE": Light.TOGGLE,
"SINGLE": Light.TOGGLE,
"DOUBLE": Light.ON_MIN_BRIGHTNESS,
"TRIPLE": Light.SET_HALF_BRIGHTNESS,
"QUAD": Light.ON_FULL_BRIGHTNESS,
"PENTA": None,
"HOLD": Light.HOLD_BRIGHTNESS_TOGGLE,
"CLEAR": Light.RELEASE,
}
class TasmotaSwitchLightController(LightController):
def get_tasmota_actions_mapping(self) -> DefaultActionsMapping:
return {
"TOGGLE": Light.TOGGLE,
"ON": Light.ON,
"OFF": Light.OFF,
"HOLD": Light.ON_MIN_MAX_BRIGHTNESS,
}
class TasmotaButtonSwitchController(SwitchController):
def get_tasmota_actions_mapping(self) -> DefaultActionsMapping:
return {
"TOGGLE": Light.TOGGLE,
"SINGLE": Switch.TOGGLE,
"DOUBLE": Switch.ON,
"TRIPLE": Switch.OFF,
"QUAD": None,
"PENTA": None,
"HOLD": None,
"CLEAR": None,
}
class TasmotaSwitchSwitchController(SwitchController):
def get_tasmota_actions_mapping(self) -> DefaultActionsMapping:
return {
"TOGGLE": Switch.TOGGLE,
"ON": Switch.ON,
"OFF": Switch.OFF,
"HOLD": None,
}
class TasmotaButtonCoverController(CoverController):
def get_tasmota_actions_mapping(self) -> DefaultActionsMapping:
return {
"TOGGLE": Cover.TOGGLE_OPEN,
"SINGLE": Cover.TOGGLE_OPEN,
"DOUBLE": Cover.CLOSE,
"TRIPLE": None,
"QUAD": None,
"PENTA": None,
"HOLD": Cover.CLOSE,
"CLEAR": None,
}
class TasmotaSwitchCoverController(CoverController):
def get_tasmota_actions_mapping(self) -> DefaultActionsMapping:
return {
"TOGGLE": Cover.TOGGLE_OPEN,
"ON": Cover.OPEN,
"OFF": Cover.CLOSE,
"HOLD": Cover.TOGGLE_CLOSE,
}
@@ -0,0 +1,52 @@
from cx_const import DefaultActionsMapping, Light, MediaPlayer
from cx_core import LightController, MediaPlayerController
from cx_core.integration import EventData
class TerncyPP01LightController(LightController):
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"button_single": Light.TOGGLE,
"button_double": Light.ON_FULL_BRIGHTNESS,
"button_triple": Light.ON_MIN_BRIGHTNESS,
"button_quadruple": Light.SET_HALF_BRIGHTNESS,
"button_quintuple": Light.SET_HALF_COLOR_TEMP,
}
def get_zha_action(self, data: EventData) -> str:
command: str = data["command"]
return command
class TerncySD01LightController(LightController):
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"button_single": Light.TOGGLE,
"button_double": Light.ON_FULL_BRIGHTNESS,
"button_triple": Light.ON_MIN_BRIGHTNESS,
"button_quadruple": Light.SET_HALF_BRIGHTNESS,
"button_quintuple": Light.SET_HALF_COLOR_TEMP,
"rotate_left": Light.CLICK_BRIGHTNESS_DOWN,
"rotate_right": Light.CLICK_BRIGHTNESS_UP,
}
def get_zha_action(self, data: EventData) -> str:
command: str = data["command"]
return command
class TerncySD01MediaPlayerController(MediaPlayerController):
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"button_single": MediaPlayer.PLAY_PAUSE,
"button_double": MediaPlayer.MUTE,
"button_triple": MediaPlayer.NEXT_TRACK,
"button_quadruple": MediaPlayer.PREVIOUS_TRACK,
"button_quintuple": MediaPlayer.NEXT_SOURCE,
"rotate_left": MediaPlayer.CLICK_VOLUME_DOWN,
"rotate_right": MediaPlayer.CLICK_VOLUME_UP,
}
def get_zha_action(self, data: EventData) -> str:
command: str = data["command"]
return command
@@ -0,0 +1,39 @@
from cx_const import DefaultActionsMapping, Light, MediaPlayer, Z2MLight
from cx_core import LightController, MediaPlayerController, Z2MLightController
class ZYCT202LightController(LightController):
"""
This controller does not send hold action for on/off
"""
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Light.ON,
"up-press": Light.HOLD_BRIGHTNESS_UP,
"down-press": Light.HOLD_BRIGHTNESS_DOWN,
"off": Light.OFF,
"stop": Light.RELEASE,
}
class ZYCT202Z2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Z2MLight.ON,
"up-press": Z2MLight.HOLD_BRIGHTNESS_UP,
"down-press": Z2MLight.HOLD_BRIGHTNESS_DOWN,
"off": Z2MLight.OFF,
"stop": Z2MLight.RELEASE,
}
class ZYCT202MediaPlayerController(MediaPlayerController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": MediaPlayer.PLAY_PAUSE,
"up-press": MediaPlayer.HOLD_VOLUME_UP,
"down-press": MediaPlayer.HOLD_VOLUME_DOWN,
"off": MediaPlayer.PLAY_PAUSE,
"stop": MediaPlayer.RELEASE,
}
@@ -0,0 +1,179 @@
from cx_const import Cover, DefaultActionsMapping, Light, MediaPlayer, Z2MLight
from cx_core import (
CoverController,
LightController,
MediaPlayerController,
Z2MLightController,
)
from cx_core.integration import EventData
class TS0044LightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"1_single": Light.TOGGLE,
"1_double": Light.CLICK_BRIGHTNESS_UP,
"1_hold": Light.CLICK_BRIGHTNESS_DOWN,
"2_single": Light.TOGGLE,
"2_double": Light.CLICK_BRIGHTNESS_UP,
"2_hold": Light.CLICK_BRIGHTNESS_DOWN,
"3_single": Light.TOGGLE,
"3_double": Light.CLICK_BRIGHTNESS_UP,
"3_hold": Light.CLICK_BRIGHTNESS_DOWN,
"4_single": Light.TOGGLE,
"4_double": Light.CLICK_BRIGHTNESS_UP,
"4_hold": Light.CLICK_BRIGHTNESS_DOWN,
}
class TS0044FLightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Light.TOGGLE,
"off": Light.TOGGLE,
"brightness_step_up": Light.CLICK_BRIGHTNESS_UP,
"brightness_step_down": Light.CLICK_BRIGHTNESS_DOWN,
}
class TS0043LightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"1_single": Light.TOGGLE,
"1_double": Light.CLICK_BRIGHTNESS_UP,
"1_hold": Light.CLICK_BRIGHTNESS_DOWN,
"2_single": Light.TOGGLE,
"2_double": Light.CLICK_BRIGHTNESS_UP,
"2_hold": Light.CLICK_BRIGHTNESS_DOWN,
"3_single": Light.TOGGLE,
"3_double": Light.CLICK_BRIGHTNESS_UP,
"3_hold": Light.CLICK_BRIGHTNESS_DOWN,
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"1_remote_button_short_press": Light.TOGGLE,
"1_remote_button_double_press": Light.CLICK_BRIGHTNESS_UP,
"1_remote_button_long_press": Light.CLICK_BRIGHTNESS_DOWN,
"2_remote_button_short_press": Light.TOGGLE,
"2_remote_button_double_press": Light.CLICK_BRIGHTNESS_UP,
"2_remote_button_long_press": Light.CLICK_BRIGHTNESS_DOWN,
"3_remote_button_short_press": Light.TOGGLE,
"3_remote_button_double_press": Light.CLICK_BRIGHTNESS_UP,
"3_remote_button_long_press": Light.CLICK_BRIGHTNESS_DOWN,
}
def get_zha_action(self, data: EventData) -> str:
args: str = ""
# Command is {endpoint_id}_{command}
if len(data["args"]) > 0:
if isinstance(data["args"], list):
args = "_" + "_".join([str(d) for d in data["args"]])
else:
args = args + f"{data['args']}"
command: str = f"{data['endpoint_id']}_{data['command']}{args}"
return command
class TS0043CoverController(CoverController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"1_single": Cover.OPEN,
"2_single": Cover.STOP,
"3_single": Cover.CLOSE,
}
class TuYaERS10TZBVKAALightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
# Command mode
"brightness_step_up": Light.CLICK_BRIGHTNESS_UP,
"brightness_step_down": Light.CLICK_BRIGHTNESS_DOWN,
"toggle": Light.TOGGLE,
"hue_move": Light.HOLD_BRIGHTNESS_TOGGLE,
"hue_stop": Light.RELEASE,
"color_temperature_step_up": Light.CLICK_COLOR_UP,
"color_temperature_step_down": Light.CLICK_COLOR_DOWN,
# Event mode
"rotate_left": Light.CLICK_BRIGHTNESS_DOWN,
"rotate_right": Light.CLICK_BRIGHTNESS_UP,
"single": Light.TOGGLE,
"double": Light.ON_FULL_BRIGHTNESS,
"hold": Light.ON_MIN_BRIGHTNESS,
}
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"toggle": Light.TOGGLE,
"step_brightness": Light.BRIGHTNESS_FROM_CONTROLLER_STEP,
"step_color_temp": Light.COLORTEMP_FROM_CONTROLLER_STEP,
}
def get_zha_action(self, data: EventData) -> str:
command: str = data["command"]
if command == "step":
return "step_brightness"
return command
class TuYaERS10TZBVKAAZ2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
# Command mode
"brightness_step_up": Z2MLight.CLICK_BRIGHTNESS_UP,
"brightness_step_down": Z2MLight.CLICK_BRIGHTNESS_DOWN,
"toggle": Z2MLight.TOGGLE,
"hue_move": Z2MLight.HOLD_BRIGHTNESS_TOGGLE,
"hue_stop": Z2MLight.RELEASE,
"color_temperature_step_up": Z2MLight.CLICK_COLOR_TEMP_UP,
"color_temperature_step_down": Z2MLight.CLICK_COLOR_TEMP_DOWN,
# Event mode
"rotate_left": Z2MLight.CLICK_BRIGHTNESS_DOWN,
"rotate_right": Z2MLight.CLICK_BRIGHTNESS_UP,
"single": Z2MLight.TOGGLE,
"double": Z2MLight.ON_FULL_BRIGHTNESS,
"hold": Z2MLight.ON_MIN_BRIGHTNESS,
}
class TuYaERS10TZBVKAAMediaPlayerController(MediaPlayerController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
# Command mode
"brightness_step_up": MediaPlayer.CLICK_VOLUME_UP,
"brightness_step_down": MediaPlayer.CLICK_VOLUME_DOWN,
"toggle": MediaPlayer.PLAY_PAUSE,
"hue_move": MediaPlayer.HOLD_VOLUME_UP,
"hue_stop": Z2MLight.RELEASE,
"color_temperature_step_up": MediaPlayer.NEXT_TRACK,
"color_temperature_step_down": MediaPlayer.PREVIOUS_TRACK,
# Event mode
"rotate_left": MediaPlayer.CLICK_VOLUME_DOWN,
"rotate_right": MediaPlayer.CLICK_VOLUME_UP,
"single": MediaPlayer.PLAY_PAUSE,
"double": MediaPlayer.NEXT_TRACK,
"hold": MediaPlayer.PREVIOUS_TRACK,
}
class TS0042LightController(LightController):
def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"1_remote_button_short_press": Light.ON,
"1_remote_button_double_press": Light.CLICK_BRIGHTNESS_UP,
"1_remote_button_long_press": Light.ON_FULL_BRIGHTNESS,
"2_remote_button_short_press": Light.OFF,
"2_remote_button_double_press": Light.ON_MIN_BRIGHTNESS,
}
def get_zha_action(self, data: EventData) -> str:
args: str = ""
# Command is {endpoint_id}_{command}
if len(data["args"]) > 0:
if isinstance(data["args"], list):
args = "_" + "_".join([str(d) for d in data["args"]])
else:
args = args + f"{data['args']}"
command: str = f"{data['endpoint_id']}_{data['command']}{args}"
return command