Hi
I’m trying to create an automation that will dim my light from 1-254 and loop that while a device is in state ‘on’ and break the loop as soon as the device turns to ‘off’. Does anyone know if this is possible and how to do it?
Here is some pseudo code showing what I wanner do:
i = light.brightness
way = up
while ( state( button, 'on' ) ):
if ( i == 254 ):
way = down
if ( i == 1 ):
way = up
if ( way == up ):
i++
if ( way == down):
i--
light.brightness = i