Add a template option for effect_list

I’m using a Pixelblaze with a mqtt bridge. You can write new effects for a led strip on-the-fly and so the list of effects can change. In the status payload, the json message includes an array of the effect names.

Can we get a templating option for effect_list to make use of this list?

2 years no reply. Pixelblaze community seems small ,-).

I do this …

service: light.turn_on
data_template:
  effect: '{{ states.light.weihnachtsbaum.attributes.effect_list | reject("==", "SEQUENCER") | list | random }}'

Is this helpful?

Haha thanks for digging this up!

With your code, is it pulling the effects from your yaml file?

I’m using Python code to send the status of the pb and in that json there is a list of the effects. I would like to be able to update the list of effects in HA using that json output. So if I ever add/delete an effect, HA will update the list.

I use this …
GitHub - vutang50/homeassistant-pixelblaze: This is a custom component to allow control of Pixelblaze devices in Home Assistant.

Doing so you connect to pixelblaze with entering IP adress in the config process. After installing this integration you have an entitiy. This entity has an attribute which holds the patterns on the device. The above code extracts the list of effects states.*.attributes.effect_list and remve the first entry … which is “SEQUENCER” for me always and thenrandomly select one, each time this service is called.

This is my full automation which does everything.

- alias: "Weihnachstbaum Mega Automatisierung"
  id: ffcd3f5d-04e6-4e24-b788-372431122081
  trigger:
    - platform: time
      at:
        - &time_start "06:30:00"
        - &time_end "22:00:00"

    - platform: state
      entity_id:
        - switch.anwesend

    - platform: homeassistant
      event: start

    - platform: event
      event_type: automation_reload

    - platform: time_pattern
      hours: "/2"
      minutes: 0
      id: "shift_effect"

  variables:
    anchors:
      - &target
        target:
          entity_id: light.weihnachtsbaum

      - &turn_off
        <<: *target
        alias: "Turn off christmas tree"
        service: light.turn_off

      - &turn_on
        <<: *target
        alias: "Turn on christmas tree"
        service: light.turn_on
        data:
          brightness: 128
          effect: "Twinkly Stars"

      - &change_sequence
        <<: *target
        alias: "Turn on christmas tree with random effect"
        service: light.turn_on
        data_template:
          brightness: 128
          effect: '{{ states.light.weihnachtsbaum.attributes.effect_list | reject("==", "SEQUENCER") | list | random }}'

  action:
    - choose:
        - conditions:
            - alias: "When house is in vacation mode"
              condition: state
              entity_id: switch.anwesend
              state: "off"
          sequence:
            - *turn_off

        - conditions:
            - alias: "Regular change of effect"
              condition: trigger
              id: "shift_effect"
            - alias: "When evening/night"
              condition: time
              after: *time_start
              before: *time_end
          sequence:
            - *change_sequence

        - conditions:
            - alias: "When evening/night"
              condition: time
              after: *time_start
              before: *time_end
          sequence:
            - *turn_on

      default:
        - *turn_off

Ah yes, I’m remembering now. The problem for me was I run HA on a remote server so the plugins that work with local devices don’t work. That’s why I ended up writing a Python script to control PB over MQTT. But that didn’t allow me to update the effects list within HA.