|
|
|
@ -33,22 +33,16 @@ binary_sensor:
@@ -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<LightEffect *> effects = id(ledstring).get_effects(); |
|
|
|
|
for(int i=0; i<effects.size(); i++) { |
|
|
|
|
if(effects[i]->get_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 |
|
|
|
@ -72,6 +66,10 @@ light:
@@ -72,6 +66,10 @@ light:
|
|
|
|
|
name: rainbow |
|
|
|
|
speed: 10 |
|
|
|
|
width: 50 |
|
|
|
|
- addressable_rainbow: |
|
|
|
|
name: slowrainbow |
|
|
|
|
speed: 1 |
|
|
|
|
width: 70 |
|
|
|
|
- addressable_flicker: |
|
|
|
|
name: flicker |
|
|
|
|
update_interval: 50ms |
|
|
|
|