Files
home-assistant-config/appdaemon/apps/controllerx/cx_devices/legrand.py
T
fkrebs 5f01411780 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.
2026-05-02 14:24:53 +02:00

101 lines
3.7 KiB
Python

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,
}