Switching the effects of LED strip through a script

Guys tell me how to pull out the current effect from the LED strip.

The device has several effects, I would like to switch them in a circle… I tried it like this, but didn’t get the proper effect in the template editor:

      entity_id: >-
         {%- if is_state_attr('light.kitchen_addressable_ledstrip_cornice','effect','rainbow') -%}
         script.kitchen_cornice_flicker
         {%- elif is_state_attr('light.kitchen_addressable_ledstrip_cornice','effect','flicker') -%}
         script.kitchen_cornice_rainbow
         {% endif %}

There are about 7 effects in total… this is was my idea. Is this real? Can someone help?

Yesterday I was not attentive, everything is quite simple, I did not correctly indicate the name of the effect. It looks like this:

- alias: kitchen_ikea_switch_left_button_long_toggle_cornice_effects
  initial_state: true
  trigger: 
  - platform: event
    event_type: deconz_event
    event_data:
      id: kitchen_ikea_switch
      event: 4001
  condition:
   - condition: state
     entity_id: light.kitchen_addressable_ledstrip_cornice
     state: 'on'
  action:
  - service: script.turn_on
    data_template:
      entity_id: >-
         {%- if is_state_attr('light.kitchen_addressable_ledstrip_cornice','effect','None') -%}
         script.kitchen_cornice_random
         {%- elif is_state_attr('light.kitchen_addressable_ledstrip_cornice','effect','Random') -%}
         script.kitchen_cornice_slow_random
         {%- elif is_state_attr('light.kitchen_addressable_ledstrip_cornice','effect','My Slow Random Effect') -%}
         script.kitchen_cornice_fast_random
         {%- elif is_state_attr('light.kitchen_addressable_ledstrip_cornice','effect','My Fast Random Effect') -%}
         script.kitchen_cornice_strobe
         {%- elif is_state_attr('light.kitchen_addressable_ledstrip_cornice','effect','Strobe') -%}
         script.kitchen_cornice_flicker
         {%- elif is_state_attr('light.kitchen_addressable_ledstrip_cornice','effect','Flicker') -%}
         script.kitchen_cornice_rainbow
         {%- elif is_state_attr('light.kitchen_addressable_ledstrip_cornice','effect','Rainbow') -%}
         script.kitchen_cornice_color_wipe
         {%- elif is_state_attr('light.kitchen_addressable_ledstrip_cornice','effect','Color Wipe') -%}
         script.kitchen_cornice_scan
         {%- elif is_state_attr('light.kitchen_addressable_ledstrip_cornice','effect','Scan') -%}
         script.kitchen_cornice_twinkle
         {%- elif is_state_attr('light.kitchen_addressable_ledstrip_cornice','effect','Twinkle') -%}
         script.kitchen_cornice_random_twinkle
         {%- elif is_state_attr('light.kitchen_addressable_ledstrip_cornice','effect','Random Twinkle') -%}
         script.kitchen_cornice_fireworks
         {%- else -%}
         script.kitchen_cornice_none
         {% endif %}

And my second automation for toggle random color:

- alias: kitchen_ikea_switch_right_button_long_toggle_cornice_random_color
  initial_state: true
  trigger: 
  - platform: event
    event_type: deconz_event
    event_data:
      id: kitchen_ikea_switch
      event: 5001
  condition:
   - condition: state
     entity_id: light.kitchen_addressable_ledstrip_cornice
     state: 'on'
  action:
     - service: light.turn_on
       entity_id: light.kitchen_addressable_ledstrip_cornice
       data_template:
          rgb_color: ['{{ (range(0, 255)|random) }}','{{ (range(0, 255)|random) }}','{{ (range(0, 255)|random) }}']

Word up! :slight_smile: :+1: :sunglasses:

Also for first automation I created is simple scripts like this:

## Cornice turn on Fireworks effect
kitchen_cornice_fireworks:
    sequence:
    - service: light.turn_on
      data:
        entity_id: light.kitchen_addressable_ledstrip_cornice
        effect: Fireworks

Awesome. Thank You very much!