Toggle/next Sonos playlist from a button


I would like to crete a Flow in some how to change to “next” radiostation/favorit when i press a button.
Now when i press a button i start a Favorit radiostation in Sonos.

I Would like to be able to press the same button again to go to next radiostation. and when it press again it skips to next radio channel.

Have anyone tried this or have a idea how to do it?

Best Regards Jonas

Use a variable.
When Button Is pressed
And variable < X
Then Variable+1

When Button is pressed
And varaible = x
Then variable = 1

Then some flows
When variable is changed
And variable = 1
Then favorite 1
And so on

I made 7 flows, for seven days. Every day another station. That way i don’t change often to another station. When i come out of bed on monday station x, on thuesday station y etc. Also a remotec 8 button switch. When i push button 3 on monday station x, on thuesday station y, etc. Also when I come home on monday, station x, on thuesday station y etc.

For all these actions I only use 7 flows for the different stations and i start those with the THEN part, start a flow. That way I can easaly change the stations.

That looks awsome and is what i am looking for!
How do you create varaible < X and then +1

Can you explane a bit more or take some screenshots?

Thanks! best Regards Jonas

I use the better logic app.

This is the way I do it, also have a remotec 8 button switch. Pushing button 4 starts a radiostation depending on the day of the week