Counter in ALTUI via workflow?

Hello!

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.

Grateful for any input! :slight_smile:

[quote=“P-a, post:1, topic:195520”]Hello!

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.

Grateful for any input! :-)[/quote]

should not be too hard, there are examples of counter here http://forum.micasaverde.com/index.php/topic,37746.0.html

Hi fellow automaters,

I am lost on how to achieve this :-(.

Anyone who has done a similiar workflow that I could copy?

Would be most grateful.

BR

[quote=“P-a, post:3, topic:195520”]Hi fellow automaters,

I am lost on how to achieve this :-(.

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