-
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(device): add support for ZB-5122 RGB genie
related to #228
- Loading branch information
Showing
7 changed files
with
127 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: ZB-5122 (RGB Genie) | ||
device_support: | ||
- type: Light | ||
domain: light | ||
controller: ZB5122LightController | ||
delay: 350 | ||
mapping: | ||
- "Click light on → Turn on" | ||
- "Click light off → Turn off" | ||
- "Hold light on → Brighten up" | ||
- "Hold light off → Dim down" | ||
- "Click RGB → Change xy color (1 step)" | ||
- "Hold RGB → Change xy color (loop)" | ||
- "Click CW → Warm color" | ||
- "Hold CW → Change color temp (toggle mode)" | ||
|
||
integrations: | ||
- name: ZHA | ||
codename: zha | ||
actions: | ||
- '"on" → Click light on' | ||
- '"off" → Click light off' | ||
- "hold_brightness_up → Hold light on" | ||
- "hold_brightness_down → Hold light off" | ||
- "stop → Release light on or off" | ||
- "move_to_color → Click RGB" | ||
- "move_hue → Hold RGB" | ||
- "stop_move_hue → Release RGB" | ||
- "move_to_color_temp → Click CW" | ||
- "move_color_temp → Hold CW" | ||
- "stop_move_step → Release CW" | ||
- "recall_0_1 → Click clapperboard" | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
layout: controller | ||
title: ZB-5122 (RGB Genie) | ||
device: ZB-5122 | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
example_app: | ||
module: controllerx | ||
class: ZB5122LightController | ||
integration: zha | ||
controller: my_controller | ||
light: light.my_light | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
entity_state_attributes: | ||
supported_features: 191 | ||
entity_state: "off" | ||
fired_actions: ["move_to_color"] | ||
extra: | ||
args: !!python/tuple [255, 0, 150] | ||
expected_calls: | ||
- service: light/turn_on | ||
data: | ||
entity_id: light.my_light | ||
rgb_color: !!python/tuple [255, 0, 150] | ||
expected_calls_count: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import pytest | ||
from cx_core.integration import EventData | ||
from cx_devices.rgb_genie import ZB5122LightController | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"data, expected_action", | ||
[ | ||
({"command": "on"}, "on"), | ||
({"command": "off"}, "off"), | ||
({"command": "stop"}, "stop"), | ||
({"command": "move_to_color"}, "move_to_color"), | ||
({"command": "move_with_on_off", "args": [0, 50]}, "hold_brightness_up"), | ||
({"command": "move_with_on_off", "args": [1, 50]}, "hold_brightness_down"), | ||
({"command": "move_hue", "args": [0, 0]}, "stop_move_hue"), | ||
({"command": "move_hue", "args": [1, 2]}, "move_hue"), | ||
], | ||
) | ||
def test_zha_action_MFKZQ01LMLightController(data: EventData, expected_action: str): | ||
sut = ZB5122LightController() # type: ignore | ||
action = sut.get_zha_action(data) | ||
assert action == expected_action |