Created
October 31, 2021 15:05
-
-
Save PaulAntonDeen/4089539eb42f7bcf11a945630c38fec4 to your computer and use it in GitHub Desktop.
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
blueprint: | |
name: ZHA - Ecodim, 4 Channel remote | |
description: 'Control any light using the Ecodim remote on ZHA' | |
domain: automation | |
input: | |
remote: | |
name: Remote controller | |
description: Remote to use | |
selector: | |
device: | |
integration: zha | |
manufacturer: EcoDim | |
model: ED-10014 | |
light_1: | |
name: Light row 1 | |
description: The lights that will be controlled with row 1 | |
selector: | |
target: | |
entity: | |
domain: light | |
light_2: | |
name: Light row 2 | |
description: The lights that will be controlled with row 2 | |
selector: | |
target: | |
entity: | |
domain: light | |
light_3: | |
name: Light row 3 | |
description: The lights that will be controlled with row 3 | |
selector: | |
target: | |
entity: | |
domain: light | |
light_4: | |
name: Light row 4 | |
description: The lights that will be controlled with row 4 | |
selector: | |
target: | |
entity: | |
domain: light | |
step_size: | |
name: Step Size | |
description: The % step each dimming step takes | |
default: 10 | |
selector: | |
number: | |
min: 5 | |
max: 25 | |
unit_of_measurement: '%' | |
step_delay: | |
name: Step Delay | |
description: The time between dimming steps (ms) | |
default: 1000 | |
selector: | |
number: | |
min: 100 | |
max: 2000 | |
unit_of_measurement: 'milliseconds' | |
source_url: https://gist.github.com/ronaldt80/85b9119a8f36bfca19a7011a12a9d2da | |
mode: restart | |
max_exceeded: silent | |
trigger: | |
- platform: event | |
event_type: zha_event | |
event_data: | |
device_id: !input 'remote' | |
action: | |
- variables: | |
command: '{{ trigger.event.data.command }}' | |
cluster_id: '{{ trigger.event.data.cluster_id }}' | |
endpoint_id: '{{ trigger.event.data.endpoint_id }}' | |
args: '{{ trigger.event.data.args }}' | |
step_size: !input 'step_size' | |
- choose: | |
- conditions: | |
- "{{ command == 'on' }}" | |
- "{{ cluster_id == 6 }}" | |
- "{{ endpoint_id == 1 }}" | |
sequence: | |
- service: light.turn_on | |
target: !input 'light_1' | |
data: | |
transition: 1 | |
- conditions: | |
- "{{ command == 'off' }}" | |
- "{{ cluster_id == 6 }}" | |
- "{{ endpoint_id == 1 }}" | |
sequence: | |
- service: light.turn_off | |
target: !input 'light_1' | |
data: | |
transition: 1 | |
- conditions: | |
- "{{ command == 'move_with_on_off' }}" | |
- "{{ cluster_id == 8 }}" | |
- "{{ endpoint_id == 1 }}" | |
- "{{ args == [0, 50]}}" | |
sequence: | |
repeat: | |
while: | |
- condition: template | |
value_template: "{{ repeat.index < (100 / step_size)|int }}" | |
sequence: | |
- service: light.turn_on | |
target: !input 'light_1' | |
data: | |
transition: 1 | |
brightness_step_pct: !input 'step_size' | |
- delay: | |
milliseconds: !input 'step_delay' | |
- conditions: | |
- "{{ command == 'move_with_on_off' }}" | |
- "{{ cluster_id == 8 }}" | |
- "{{ endpoint_id == 1 }}" | |
- "{{args == [1, 50]}}" | |
sequence: | |
repeat: | |
while: | |
- condition: template | |
value_template: "{{ repeat.index < (100 / step_size)|int }}" | |
sequence: | |
- service: light.turn_on | |
target: !input 'light_1' | |
data: | |
transition: 1 | |
brightness_step_pct: "{{ step_size * -1 }}" | |
- delay: | |
milliseconds: !input 'step_delay' | |
- conditions: | |
- "{{ command == 'stop' }}" | |
- "{{ cluster_id == 8 }}" | |
- "{{ endpoint_id == 1 }}" | |
sequence: | |
- service: light.turn_on | |
target: !input 'light_1' | |
- conditions: | |
- "{{ command == 'on' }}" | |
- "{{ cluster_id == 6 }}" | |
- "{{ endpoint_id == 2 }}" | |
sequence: | |
- service: light.turn_on | |
target: !input 'light_2' | |
data: | |
transition: 1 | |
- conditions: | |
- "{{ command == 'off' }}" | |
- "{{ cluster_id == 6 }}" | |
- "{{ endpoint_id == 2 }}" | |
sequence: | |
- service: light.turn_off | |
target: !input 'light_2' | |
data: | |
transition: 1 | |
- conditions: | |
- "{{ command == 'move_with_on_off' }}" | |
- "{{ cluster_id == 8 }}" | |
- "{{ endpoint_id == 2 }}" | |
- "{{ args == [0, 50]}}" | |
sequence: | |
repeat: | |
while: | |
- condition: template | |
value_template: "{{ repeat.index < (100 / step_size)|int }}" | |
sequence: | |
- service: light.turn_on | |
target: !input 'light_2' | |
data: | |
transition: 1 | |
brightness_step_pct: !input 'step_size' | |
- delay: | |
milliseconds: !input 'step_delay' | |
- conditions: | |
- "{{ command == 'move_with_on_off' }}" | |
- "{{ cluster_id == 8 }}" | |
- "{{ endpoint_id == 2 }}" | |
- "{{args == [1, 50]}}" | |
sequence: | |
repeat: | |
while: | |
- condition: template | |
value_template: "{{ repeat.index < (100 / step_size)|int }}" | |
sequence: | |
- service: light.turn_on | |
target: !input 'light_2' | |
data: | |
transition: 1 | |
brightness_step_pct: "{{ step_size * -1 }}" | |
- delay: | |
milliseconds: !input 'step_delay' | |
- conditions: | |
- "{{ command == 'stop' }}" | |
- "{{ cluster_id == 8 }}" | |
- "{{ endpoint_id == 2 }}" | |
sequence: | |
- service: light.turn_on | |
target: !input 'light_2' | |
- conditions: | |
- "{{ command == 'on' }}" | |
- "{{ cluster_id == 6 }}" | |
- "{{ endpoint_id == 3 }}" | |
sequence: | |
- service: light.turn_on | |
target: !input 'light_3' | |
data: | |
transition: 1 | |
- conditions: | |
- "{{ command == 'off' }}" | |
- "{{ cluster_id == 6 }}" | |
- "{{ endpoint_id == 3 }}" | |
sequence: | |
- service: light.turn_off | |
target: !input 'light_3' | |
data: | |
transition: 1 | |
- conditions: | |
- "{{ command == 'move_with_on_off' }}" | |
- "{{ cluster_id == 8 }}" | |
- "{{ endpoint_id == 3 }}" | |
- "{{ args == [0, 50]}}" | |
sequence: | |
repeat: | |
while: | |
- condition: template | |
value_template: "{{ repeat.index < (100 / step_size)|int }}" | |
sequence: | |
- service: light.turn_on | |
target: !input 'light_3' | |
data: | |
transition: 1 | |
brightness_step_pct: !input 'step_size' | |
- delay: | |
milliseconds: !input 'step_delay' | |
- conditions: | |
- "{{ command == 'move_with_on_off' }}" | |
- "{{ cluster_id == 8 }}" | |
- "{{ endpoint_id == 3 }}" | |
- "{{args == [1, 50]}}" | |
sequence: | |
repeat: | |
while: | |
- condition: template | |
value_template: "{{ repeat.index < (100 / step_size)|int }}" | |
sequence: | |
- service: light.turn_on | |
target: !input 'light_3' | |
data: | |
transition: 1 | |
brightness_step_pct: "{{ step_size * -1 }}" | |
- delay: | |
milliseconds: !input 'step_delay' | |
- conditions: | |
- "{{ command == 'stop' }}" | |
- "{{ cluster_id == 8 }}" | |
- "{{ endpoint_id == 3 }}" | |
sequence: | |
- service: light.turn_on | |
target: !input 'light_3' | |
- conditions: | |
- "{{ command == 'on' }}" | |
- "{{ cluster_id == 6 }}" | |
- "{{ endpoint_id == 4 }}" | |
sequence: | |
- service: light.turn_on | |
target: !input 'light_4' | |
data: | |
transition: 1 | |
- conditions: | |
- "{{ command == 'off' }}" | |
- "{{ cluster_id == 6 }}" | |
- "{{ endpoint_id == 4 }}" | |
sequence: | |
- service: light.turn_off | |
target: !input 'light_4' | |
data: | |
transition: 1 | |
- conditions: | |
- "{{ command == 'move_with_on_off' }}" | |
- "{{ cluster_id == 8 }}" | |
- "{{ endpoint_id == 4 }}" | |
- "{{ args == [0, 50]}}" | |
sequence: | |
repeat: | |
while: | |
- condition: template | |
value_template: "{{ repeat.index < (100 / step_size)|int }}" | |
sequence: | |
- service: light.turn_on | |
target: !input 'light_4' | |
data: | |
transition: 1 | |
brightness_step_pct: !input 'step_size' | |
- delay: | |
milliseconds: !input 'step_delay' | |
- conditions: | |
- "{{ command == 'move_with_on_off' }}" | |
- "{{ cluster_id == 8 }}" | |
- "{{ endpoint_id == 4 }}" | |
- "{{args == [1, 50]}}" | |
sequence: | |
repeat: | |
while: | |
- condition: template | |
value_template: "{{ repeat.index < (100 / step_size)|int }}" | |
sequence: | |
- service: light.turn_on | |
target: !input 'light_4' | |
data: | |
transition: 1 | |
brightness_step_pct: "{{ step_size * -1 }}" | |
- delay: | |
milliseconds: !input 'step_delay' | |
- conditions: | |
- "{{ command == 'stop' }}" | |
- "{{ cluster_id == 8 }}" | |
- "{{ endpoint_id == 4 }}" | |
sequence: | |
- service: light.turn_on | |
target: !input 'light_4' |
I just did some changes to your script locally to work with a very similar device (I think it is the same) from Sunricher.
I am having some issues with it dimming though. Any ideas? p.s. the Transition: 1 change works for all bulbs,
It picks up the same event for the dim up and down.
"command": "move_with_on_off",
"args": [
0,
50
ZG2833K8_EU05 from Sunricher
@Bolti81 I also had this issue, I think it's due to some change in how HA serializes the args and now it doesn't match anymore.
Change all the
- "{{args == [0, 50]}}"
lines to:
- '{{ args == ''[<MoveMode.Up: 0>, 50]'' }}'
and change all the
- "{{args == [1, 50]}}"
lines to:
- '{{ args == ''[<MoveMode.Down: 1>, 50]'' }}'
I don't love it, it would probably be better to pass args literally so that it doesn't get stringified, but this works for now while I improve the script.
Hello Paul, is it possible to change the code from ZHA to Z2M?
Probably, but you will have to do it yourself.
Op wo 24 mei 2023 16:26 schreef antonov124 ***@***.***>:
… ***@***.**** commented on this gist.
------------------------------
Hello Paul, is it possible to change the code from ZHA to Z2M?
—
Reply to this email directly, view it on GitHub
<https://gist.github.com/PaulAntonDeen/4089539eb42f7bcf11a945630c38fec4#gistcomment-4578303>
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGFGZAPBX4NCG5YKBGOTRETXHYLCHBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFQKSXMYLMOVS2I5DSOVS2I3TBNVS3W5DIOJSWCZC7OBQXE5DJMNUXAYLOORPWCY3UNF3GS5DZVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVEYTCMRXGIYTCNZUU52HE2LHM5SXFJTDOJSWC5DF>
.
You are receiving this email because you authored the thread.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great, glad you solved it!