diff --git a/ledstring.yml b/ledstring.yml index a1c9156..4368d60 100644 --- a/ledstring.yml +++ b/ledstring.yml @@ -31,18 +31,26 @@ binary_sensor: mode: INPUT_PULLUP inverted: True name: "Button" + on_click: - then: - - 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(); - } - } + - min_length: 400ms + max_length: 3000ms + then: + - light.turn_off: ledstring + - then: + - lambda: | + std::vector effects = id(ledstring).get_effects(); + std::string current = id(ledstring).get_effect_name(); + std::string next = effects[0]->get_name(); + for(int i=0; iget_name().compare(current) == 0) { + next = effects[(i+1) % effects.size()]->get_name(); + } + } + auto call = id(ledstring).turn_on(); + call.set_brightness(0.8); + call.set_effect(next); + call.perform(); light: - platform: neopixelbus