diff --git a/ledstring.yml b/ledstring.yml index eb13155..a1c9156 100644 --- a/ledstring.yml +++ b/ledstring.yml @@ -33,22 +33,16 @@ binary_sensor: name: "Button" on_click: then: - - switch.toggle: - id: ledstring_switch - -switch: - - platform: template - optimistic: True - id: ledstring_switch - name: "LED String Switch" - turn_on_action: - - light.turn_on: - id: ledstring - brightness: 70% - effect: rainbow - turn_off_action: - - light.turn_off: - id: ledstring + - lambda: | + std::string current = id(ledstring).get_effect_name(); + std::vector effects = id(ledstring).get_effects(); + for(int i=0; iget_name().compare(current) == 0) { + auto call = id(ledstring).turn_on(); + call.set_effect(effects[(i+1) % effects.size()]->get_name()); + call.perform(); + } + } light: - platform: neopixelbus