#Using a helper to cycle colors in an automation

1 messages · Page 1 of 1 (latest)

wanton hill
#

Is it possible to cycle a list of colours using a button press on a remote as the trigger?
I have a Philips hue Remote, and am using the Philips hue Hub. What I am trying to write is an automation (then convert to a blueprint) that will program the remote buttons:
Power single click : Toggle light status on/off
Bright single click: turn up the brightness
Dim single click: turn down the brightness
Power long press: tun off all lights (incase some are on, other off forces everything into the same state)
hue single click: rotate through a list of colors one step per click.

So far I have everything working except the last step. I have looked at a lot of blueprints/automations trying to figure out how this is done. With a limited knowledge of HA YAML I have got myself totally confused. Is there a way to do this? Does anyone have an example of something like this?

Greg

undone laurel
#

In your automation or script you can define an array of colors, e.g. here in RGB

sequence:
  - variables:
      colors:
        - - 250
          - 1
          - 1
        - - 176
          - 24
          - 226
        - - 242
          - 238
          - 60
#

Then you can have a helper counter that increments on button press

#

and on change in that counter, you can set a light to the array element you've selected

#
        - action: light.turn_on
          metadata: {}
          data:
            rgb_color: "{{ colors[states('counter.xyz')|int] }}"