Skip to content

Instantly share code, notes, and snippets.

@AllardKatan
Last active January 24, 2024 01:22
Show Gist options
  • Save AllardKatan/1f358fe587c1fe2315b2ea22478e600c to your computer and use it in GitHub Desktop.
Save AllardKatan/1f358fe587c1fe2315b2ea22478e600c to your computer and use it in GitHub Desktop.
Innr RC250 remote ZHA all buttons automation for Home Assistant. Example with light on off brightness color temp
alias: test innr
description: >-
Automation for assigning ZHA events of INNR remote RC250 to actions. Variables
to use: remote_IEEE: an address, to be sniffed from the event log.
automation_type: cyclic or increase_decrease. Step sizes are by default 10% for brightness and 500 K for color temperature.
trigger:
- platform: event
event_type: zha_event
event_data:
device_IEEE: <insert here device IEE>
command: "on"
id: "on"
alias: on press on/off
- platform: event
event_type: zha_event
event_data:
device_IEEE: <insert here device IEE>
command: "off"
id: "off"
alias: off press on/off
- platform: event
event_type: zha_event
event_data:
device_IEEE: <insert here device IEE>
command: step
params:
step_mode: 0
id: up
alias: up press
- platform: event
event_type: zha_event
event_data:
device_IEEE: <insert here device IEE>
command: step
params:
step_mode: 1
id: down
alias: down press
- alias: left or right press
platform: event
event_type: zha_event
event_data:
device_IEEE: <insert here device IEE>
command: move_to_color_temp
id: leftright
condition: []
action:
- choose:
- conditions:
- condition: trigger
id:
- "on"
- "off"
sequence:
- service: light.toggle
target:
entity_id:
- <insert here light entity ID(s)>
data: {}
- conditions:
- condition: trigger
id:
- up
sequence:
- service: light.turn_on
metadata: {}
data:
brightness_step_pct: 10
target:
entity_id: <insert here light entity ID(s)>
- conditions:
- condition: trigger
id:
- down
sequence:
- service: light.turn_on
metadata: {}
data:
brightness_step_pct: -10
target:
entity_id: <insert here light entity ID(s)>
- conditions:
- condition: and
conditions:
- condition: not
conditions:
- condition: state
entity_id: <insert here helper entity id>
state: unavailable
- condition: state
entity_id: <insert here helper entity id>
state: unknown
alias: helper is available
- condition: trigger
id:
- leftright
sequence:
- if:
- condition: template
value_template: "{{automation_type == 'increase_decrease'}}"
- condition: template
value_template: "{{number_step_leftright != 0 }}"
then:
- alias: Increase on right press, decrease otherwise
if:
- alias: Increased nr means right press
condition: or
conditions:
- alias: to > from, not from 200 to 588
condition: and
conditions:
- condition: template
value_template: >-
{{states('<insert here helper entity id>')|int
< trigger.event.data.params.color_temp_mireds|int
}}
- condition: not
conditions:
- condition: and
conditions:
- condition: template
value_template: >-
{{states('<insert here helper entity id>')|int
== 200 }}
- condition: template
value_template: >-
{{trigger.event.data.params.color_temp_mireds|int
== 588}}
- alias: from 588 to 200
condition: and
conditions:
- condition: template
value_template: >-
{{states('<insert here helper entity id>')|int
== 588 }}
- condition: template
value_template: >-
{{ trigger.event.data.params.color_temp_mireds|int
== 200 }}
then:
- service: light.turn_on
metadata: {}
data:
color_temp_kelvin: >-
{{[((state_attr('<insert here light entity ID(s)>','color_temp_kelvin')
or 2202)+500), 6553]|min }}
target:
entity_id: <insert here light entity ID(s)>
alias: Increase color temp
else:
- service: light.turn_on
metadata: {}
data:
color_temp_kelvin: >-
{{[((state_attr('<insert here light entity ID(s)>','color_temp_kelvin')
or 6553) - 500), 2202]|max }}
target:
entity_id: <insert here light entity ID(s)>
alias: Decrease color temp
- service: input_number.set_value
metadata: {}
data:
value: "{{trigger.event.data.params.color_temp_mireds|int}}"
target:
entity_id: <insert here helper entity id>
else:
- choose:
- conditions:
- condition: template
value_template: >-
{{trigger.event.data.params.color_temp_mireds|int ==
200}}
alias: nr is 200
sequence:
- service: scene.turn_on
metadata: {}
target:
entity_id: <insert here scene>
- conditions:
- alias: nr is 285
condition: template
value_template: >-
{{trigger.event.data.params.color_temp_mireds|int ==
285}}
sequence:
- service: scene.turn_on
metadata: {}
target:
entity_id: <insert here scene>
- conditions:
- alias: nr is 370
condition: template
value_template: >-
{{trigger.event.data.params.color_temp_mireds|int ==
370}}
sequence:
- service: scene.turn_on
metadata: {}
target:
entity_id: <insert here scene>
- conditions:
- alias: nr is 454
condition: template
value_template: >-
{{trigger.event.data.params.color_temp_mireds|int ==
454}}
sequence:
- service: scene.turn_on
metadata: {}
target:
entity_id: <insert here scene>
- conditions:
- alias: nr is 588
condition: template
value_template: >-
{{trigger.event.data.params.color_temp_mireds|int ==
588}}
sequence:
- service: scene.turn_on
metadata: {}
target:
entity_id: <insert here scene>
mode: queued
max: 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment