Use a rotating device to control different entities

Hi

Recently I had to restart from scratch my whole HA setup as I moved from ZHA to Z2M.
One of the things I am struggling with is one of my devices - a zigbee rotatable button - that has the ability to :
-single click
-double click
-rotate left
-rotate right

the way i had it set up before was
-single click: toggle device on/off.
-double click: select device
-rotate right: inc brightness on that device
-rotate left: dec brightness on that device.

the devices were a list of 3
-lights.attic_main
-lights.attic_eaves
-lights.attic_den

I have completely forgotten how I set this up - do I use a helper with the dropdown, to cycle through this list? But then how does the device know which one is ‘selected’?

I cant get my head around this -any ideas would be much appreciated.

Automation

Single/double click and rotate left/right are triggers

Assign each trigger an ID

Use if/then actions

Actions are

If trigger ID single then toggle device on/off.
If trigger ID double then select device
If trigger ID right then inc brightness
If trigger ID left then dec brightness on that device.

You will need a method to determine deleted device.l Helper and list could work

Before going and editing your automation, double check what actions are exposed by your remote. They may have changed…

Go into Z2M, find your remote in the device list, select it and choose the Exposes tab. You can then perform the actions you would use and confirm the action name. These actions will match the trigger in the automation editor.

Thanks.

I’m not worried about the things that z2m exposes as it does a fantastic job that I’m happy with.

The question is: how to set the automation to do it’s thing (Inc dec brightness) when the entity keeps changing with the single click drop-down helper

Hi

I have found a solution, in case anyone else is looking for one.

Use rotation to inc/dec brightness
Step 1.
Use the GUI to make a helper called ‘led_lights’ - the entity will be called ‘input_select.led_lights’.

Step 2.
Use the GUI to make an automation.
-Use the trigger on the device
-Select add acion - light - turn on - brightness step 5-10 (or whatever you want)
-Then in the ‘then do’ bit click on the three dots and EDIT IN YAML

action: light.turn_on
metadata: {}
data:
  brightness_step_pct: 5
target:
  entity_id: "{{ states('input_select.led_lights') }}"

That sorted that bit out, duplicate it and select a different trigger (eg rotate left compared to rotate right) and edit the yaml bit in the ‘then do’ bit to say

action: light.turn_on
metadata: {}
data:
  brightness_step_pct: -5
target:
  entity_id: "{{ states('input_select.led_lights') }}"

The next bit is to get the press of a button to actually cycle through these entities - this just doesnt work using the GUI and you need to put the yaml in.

again do the make automation, set your trigger.
in the ‘then do’ bit select 'add action ’ - select - next.

but you have to again edit the yaml as this puts the action to ‘select.select_next’ and that just doesnt work.

action: input_select.select_next
target:
  entity_id: input_select.led_lights
data:
  cycle: true

this made this work perfectly for me.

now - i can click the rotatable button to change the selected light and then rotate to inc/dec brightness.
i set a double tap to turn off the lights as well.