I am struggeling to create a counter in workflow and was wondering if anyone could help me out?
What I would like to achieve is a counter that starts on value 0, then when I switch a Virtual switch on, value 1 should be assigned to the counter. Next action on the Virtual switch would result the counter to go to 2. Each value (1,2) should then activate different scenes. When the counter reach 3 (as an example) it would reset to 0.
In this way, I would be able to use the FLIC button, single click, to Toggle playlists or light settings.
I am struggeling to create a counter in workflow and was wondering if anyone could help me out?
What I would like to achieve is a counter that starts on value 0, then when I switch a Virtual switch on, value 1 should be assigned to the counter. Next action on the Virtual switch would result the counter to go to 2. Each value (1,2) should then activate different scenes. When the counter reach 3 (as an example) it would reset to 0.
In this way, I would be able to use the FLIC button, single click, to Toggle playlists or light settings.
Anyone who has done a similiar workflow that I could copy?
Would be most grateful.
BR[/quote]
you may try a workflow like that:
STATE: Start
=>timer 0s => Wait
STATE: Wait
=>trigger mode: vswitch turned on , expression : ( (ctr or 0)== 0 ) => STATE for Action 1
=>trigger mode: vswitch turned on , expression ( (ctr or 0)== 1 ) => STATE for Action 2
=>trigger mode: vswitch turned on , expression ( (ctr or 0)== 2 ) => STATE for Action 3
STATE: Action 1
onEnter do the action or scene you want
Lua: ctr = ( (ctr or 0) +1 ) % 3
=>timer 0s=>Wait
STATE: Action 2
onEnter do the action or scene you want
Lua: ctr = ( (ctr or 0) +1 ) % 3
=>timer 0s=>Wait
STATE: Action 3
onEnter do the action or scene you want
Lua: ctr = ( (ctr or 0) +1 ) % 3
=>timer 0s=>Wait
Best Home Automation shopping experience. Shop at Ezlo!