How should it be done with a flow on and off with the same button

Hi

Ive got a shelly i4 connected to a wallswitch .
And i want to use the shelly i4 switch 1 to control : If button is pressed turn on tv that is connected with a smartplug aswell .

But then i want to use it otherway around if i press it then it should turn it off ?
Any guide how to solve this ?

Hoi!
You can use some such kind of logic
WHEN button pressed
IF smartplug is ON
switch smartplug OFF
ELSE
switch smartplug ON
ENDIF

1 Like

The toggle card is available for that:

And when there is no Toggle Card for that device:

Between Turn Off and Turn On is an ---- Else ----
I have seen that missing in Shared Flows as Bug reported.

Visualized what @Cuprum wrote.