-
Notifications
You must be signed in to change notification settings - Fork 883
Add Candeo LC20 smart LED controllers, RD1/RD1P rotary dimmers #4234
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
Open
candeodevelopment
wants to merge
11
commits into
zigpy:dev
Choose a base branch
from
candeodevelopment:dev
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
a75c643
Add support for Candeo LC20 smart LED controllers and RD1 / RD1P rota…
candeodevelopment 42821ab
Apply pre-commit auto fixes
pre-commit-ci[bot] ec80a8c
Update __init__.py
candeodevelopment c379336
Merge branch 'zigpy:dev' into dev
candeodevelopment 6eab9c7
Update __init__.py
candeodevelopment 455650d
Merge branch 'dev' of https://github.com/candeodevelopment/zha-device…
candeodevelopment 4079326
Apply pre-commit auto fixes
pre-commit-ci[bot] a101378
Update __init__.py
candeodevelopment d4faed3
Update rotary_dimmer_switches.py
candeodevelopment 74e4134
Replace hard coded trigger type and trigger sub type with consts
candeodevelopment d400eab
Apply pre-commit auto fixes
pre-commit-ci[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,103 @@ | ||
"""Candeo rotary dimmer switches.""" | ||
|
||
from zigpy.quirks.v2 import QuirkBuilder | ||
from zigpy.zcl import ClusterType | ||
from zigpy.zcl.clusters.general import Identify, Ota | ||
|
||
from zhaquirks.candeo import ( | ||
CANDEO, | ||
COMMAND_CONTINUED_ROTATING, | ||
COMMAND_DOUBLE_PRESS, | ||
COMMAND_HOLD, | ||
COMMAND_PRESS, | ||
COMMAND_RELEASE, | ||
COMMAND_STARTED_ROTATING, | ||
COMMAND_STOPPED_ROTATING, | ||
CandeoLevelControlRemoteCluster, | ||
CandeoOnOffRemoteCluster, | ||
) | ||
from zhaquirks.const import CLUSTER_ID, COMMAND, ENDPOINT_ID, PARAMS | ||
|
||
remote_quirk = ( | ||
QuirkBuilder() | ||
.replaces(CandeoOnOffRemoteCluster, endpoint_id=2, cluster_type=ClusterType.Client) | ||
.replaces( | ||
CandeoLevelControlRemoteCluster, endpoint_id=2, cluster_type=ClusterType.Client | ||
) | ||
.device_automation_triggers( | ||
{ | ||
("Pressed", "Rotary knob"): { | ||
COMMAND: COMMAND_PRESS, | ||
CLUSTER_ID: 6, | ||
ENDPOINT_ID: 2, | ||
}, | ||
("Double pressed", "Rotary knob"): { | ||
COMMAND: COMMAND_DOUBLE_PRESS, | ||
CLUSTER_ID: 6, | ||
ENDPOINT_ID: 2, | ||
}, | ||
("Held", "Rotary knob"): { | ||
COMMAND: COMMAND_HOLD, | ||
CLUSTER_ID: 6, | ||
ENDPOINT_ID: 2, | ||
}, | ||
("Released", "Rotary knob"): { | ||
COMMAND: COMMAND_RELEASE, | ||
CLUSTER_ID: 6, | ||
ENDPOINT_ID: 2, | ||
}, | ||
("Started rotating left", "Rotary knob"): { | ||
COMMAND: COMMAND_STARTED_ROTATING, | ||
CLUSTER_ID: 8, | ||
ENDPOINT_ID: 2, | ||
PARAMS: {"direction": 1}, | ||
}, | ||
("Rotating left", "Rotary knob"): { | ||
COMMAND: COMMAND_CONTINUED_ROTATING, | ||
CLUSTER_ID: 8, | ||
ENDPOINT_ID: 2, | ||
PARAMS: {"direction": 1}, | ||
}, | ||
("Started rotating right", "Rotary knob"): { | ||
COMMAND: COMMAND_STARTED_ROTATING, | ||
CLUSTER_ID: 8, | ||
ENDPOINT_ID: 2, | ||
PARAMS: {"direction": 0}, | ||
}, | ||
("Rotating right", "Rotary knob"): { | ||
COMMAND: COMMAND_CONTINUED_ROTATING, | ||
CLUSTER_ID: 8, | ||
ENDPOINT_ID: 2, | ||
PARAMS: {"direction": 0}, | ||
}, | ||
("Stopped rotating", "Rotary knob"): { | ||
COMMAND: COMMAND_STOPPED_ROTATING, | ||
CLUSTER_ID: 8, | ||
ENDPOINT_ID: 2, | ||
}, | ||
} | ||
) | ||
) | ||
|
||
( | ||
QuirkBuilder(CANDEO, "C-ZB-RD1") | ||
.applies_to(CANDEO, "C-ZB-RD1P-DIM") | ||
.removes(Ota.cluster_id) | ||
.add_to_registry() | ||
) | ||
|
||
( | ||
remote_quirk.clone() | ||
.applies_to(CANDEO, "C-ZB-RD1P-REM") | ||
.removes(Identify.cluster_id, endpoint_id=1) | ||
.removes(Identify.cluster_id, endpoint_id=2) | ||
.removes(Ota.cluster_id) | ||
.add_to_registry() | ||
) | ||
|
||
( | ||
remote_quirk.clone() | ||
.applies_to(CANDEO, "C-ZB-RD1P-DPM") | ||
.removes(Ota.cluster_id) | ||
.add_to_registry() | ||
) |
This file contains hidden or 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,37 @@ | ||
"""Candeo smart led controllers.""" | ||
|
||
from zigpy.quirks.v2 import QuirkBuilder | ||
from zigpy.zcl.clusters.lighting import Color | ||
|
||
from zhaquirks.candeo import ( | ||
CANDEO, | ||
CandeoCCTColorCluster, | ||
CandeoRGBCCTColorCluster, | ||
CandeoRGBColorCluster, | ||
) | ||
|
||
( | ||
QuirkBuilder(CANDEO, "C-ZB-LC20-Dim") | ||
.applies_to(CANDEO, "C-ZB-LC20-DIM") | ||
.removes(Color.cluster_id, endpoint_id=11) | ||
.add_to_registry() | ||
) | ||
|
||
( | ||
QuirkBuilder(CANDEO, "C-ZB-LC20-CCT") | ||
.replaces(CandeoCCTColorCluster, endpoint_id=11) | ||
.add_to_registry() | ||
) | ||
|
||
( | ||
QuirkBuilder(CANDEO, "C-ZB-LC20-RGB") | ||
.replaces(CandeoRGBColorCluster, endpoint_id=11) | ||
.add_to_registry() | ||
) | ||
|
||
( | ||
QuirkBuilder(CANDEO, "C-ZB-LC20-RGBCCT") | ||
.applies_to(CANDEO, "C-ZB-LC20-RGBW") | ||
.replaces(CandeoRGBCCTColorCluster, endpoint_id=11) | ||
.add_to_registry() | ||
) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll come back to you on this, but I believe we should not have English strings in here. Instead, we should use translation keys (with the translations in ZHA).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @TheJulianJES - is this feedback confirmed?
Waiting for your feedback so we can do what's required (if anything). - Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to other device triggers, use something like that here (e.g. see const.py and other quirks). We'll then use that string as the translation key in HA's ZHA integration with a translation there.
So, we'll need to add the trigger strings to HA's ZHA integration here:
https://github.com/home-assistant/core/blob/00955b8e6af26d5a73386a2773a69486e50154dd/homeassistant/components/zha/strings.json#L269-L294
I should be able to do that in the ZHA bump if you provide me with the translations we want to go with.