Hi,
what code should use to perform different light output with one button?
For instance: have binary sensor on PIN12 and monochrome light. When first time press button want to turn light to 100%, second to 50%, third to turn off, four to 100% and run in cycle that.
Also when hold button want to dim light.
Here is part of code:
- platform: gpio
pin:
number: GPIO12
mode:
input: true
pullup: true
name: "Wall switch hallway"
id: wallswitch
on_release:
then:
- light.toggle:
id: string_lights
on_press:
- while:
condition:
binary_sensor.is_on: wallswitch
then:
- light.dim_relative:
id: string_lights
relative_brightness: 5%
transition_length: 0.1s
- delay: 0.1s