Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Z2M for Legrand controllers #224

Merged
merged 5 commits into from
Jan 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions apps/controllerx/cx_devices/legrand.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ def get_zha_action_LegrandWallController(data: dict) -> str:


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,
Expand All @@ -29,6 +38,20 @@ def get_zha_action(self, data: EventData) -> str:


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,
Expand Down
24 changes: 16 additions & 8 deletions docs/_data/controllers/LEGRAND-600083.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,24 @@ device_support:
controller: Legrand600083LightController
delay: 350
mapping:
- press top button → Turn on
- press bottom button → Turn off
- hold top button → Brighten up
- hold bottom button → Dim down
- press bottom button → Turn on
- press top button → Turn off
- hold bottom button → Brighten up
- hold top button → Dim down
integrations:
- name: Zigbee2MQTT
codename: z2m
actions:
- "on" → press bottom button
- "off" → press top button
- brightness_move_up → hold bottom button
- brightness_move_down → hold top button
- brightness_stop → release any button
- name: ZHA
codename: zha
actions:
- 1_on → press top button
- 1_off → press bottom button
- 1_move_up → hold top button
- 1_move_down → hold bottom button
- 1_on → press bottom button
- 1_off → press top button
- 1_move_up → hold bottom button
- 1_move_down → hold top button
- 1_stop → release any button
45 changes: 29 additions & 16 deletions docs/_data/controllers/LEGRAND-600088.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,38 @@ device_support:
controller: Legrand600088LightController
delay: 350
mapping:
- press left top button → Turn on
- press left bottom button → Turn off
- hold left top button → Change color or color temperature up
- hold left bottom button → Change color or color temperature down
- press right top button → Full brightness
- press right bottom button → Minimum brightness
- hold right top button → Brighten up
- hold right bottom button → Dim down
- press bottom left button → Turn on
- press top left button → Turn off
- hold bottom left button → Change color or color temperature up
- hold top left button → Change color or color temperature down
- press bottom right button → Full brightness
- press top right button → Minimum brightness
- hold bottom right button → Brighten up
- hold top right button → Dim down
integrations:
- name: Zigbee2MQTT
codename: z2m
actions:
- on_left → press bottom left button
- off_left → press top left button
- brightness_move_up_left → hold bottom left button
- brightness_move_down_left → hold top left button
- brightness_stop_left → release any left button
- on_right → press bottom right button
- off_right → press top right button
- brightness_move_up_right → hold bottom right button
- brightness_move_down_right → hold top right button
- brightness_stop_right → release any right button
- name: ZHA
codename: zha
actions:
- 1_on → press left top button
- 1_off → press left bottom button
- 1_move_up → hold left top button
- 1_move_down → hold left bottom button
- 1_on → press bottom left button
- 1_off → press top left button
- 1_move_up → hold bottom left button
- 1_move_down → hold top left button
- 1_stop → release any left button
- 2_on → press right top button
- 2_off → press right bottom button
- 2_move_up → hold right top button
- 2_move_down → hold right bottom button
- 2_on → press bottom right button
- 2_off → press top right button
- 2_move_up → hold bottom right button
- 2_move_down → hold top right button
- 2_stop → release any right button