I’ve been trying to get a IKEA square remote which is connected through the ZHA integration and my Conbee 2 to dim/brighten a light group by holding in either the 0 or 1 button. I got a script on from a guy that I’ve modified a bit to my needs but its not working so good i think. The individual lights in the group iit dims/brigthens does not follow each other in their brightness level. Heres my automation which calls a script:
- id: ikea_remote_dim_function
alias: IKEA Remotes Dæmpnings automatik
mode: restart
trigger:
- event_type: zha_event
platform: event
action:
- service: script.zha_ikea_square_dim_exec
data_template:
dim_step: 30
light: >-
{% set device_light_list = {
'00:0d:6f:ff:fe:d0:a1:20': 'light.spisekokken_group'
} %}
{{ device_light_list[trigger.event.data.device_ieee] }}"
args: '{{ trigger.event.data.args }}'
command: '{{ trigger.event.data.command }}'
And heres the script(s) called:
zha_ikea_square_dim_exec:
sequence:
- service_template: >-
{%- if 'move' in command %}
script.zha_remote_long_press_dim
{%- endif %}
data_template:
light: "{{ light }}"
dim_step: >-
{% if command == 'move' %}
{{ 0 - dim_step }}
{% else %}
{{ dim_step }}
{% endif %}
zha_remote_long_press_dim:
sequence:
- repeat:
while: []
sequence:
- service: light.turn_on
data_template:
entity_id: "{{ light }}"
brightness: >-
{% set ds = dim_step | int %}
{%- if ds < 0 %}
{{ [ state_attr(light, 'brightness') + ds, 1 ] | max }}
{%- else %}
{{ [ state_attr(light, 'brightness') + ds, 254 ] | min }}
{%- endif %}
transition: 0.1
- delay:
milliseconds: 400
It actually does “work” just not good enough for the WAF (Wife approval factor).
Anyone have some other way of making a IKEA Square remote dim/brighten a light group on long press ?