Piston to turn off 4 lights if any are on, but turn 2 on if they are ALL off


#1

1) Give a description of the problem
Piston continues to loop indefinitely when I only want it to run once.

I’m guessing this is a simple fix but can’t for the life of me figure it out.

2) What is the expected behaviour?
If any of the lights are on, turn all of them off. But, if all of them are off, turn 2 of them on.

3) What is happening/not happening?
The piston seems to work correctly, except it loops continually forever.

**4) Post a Green Snapshot of the piston![image|45x37]


#2

You are changing the states of your triggers within your piston. That will cause a never ending cycle of multiple executions with variable results. Can you simplify your trigger and not change the state of that trigger within your piston?


#3

Not sure what you mean. I’m designing a piston so I can run it as shortcut from my ShieldTV to do the following with a single piston:
a) If any of the 4 lights are on near the TV --> turn them all off and stop the piston.
b) If all the lights are off --> turn on 2 of the lights.

I presume I’m missing something, but I’m not able to visualize how the trigger could be anything different as it has to include the status of the lights.


#4

Could you trigger on the TV turning on or something like that…

IF TV turns ON  <----- Trigger
THEN
  IF Any of lights are on
    THEN turn lights off
    ELSE turn on two lights
  END IF
END IF

#5

I want the piston to manually triggered, as my wife/kids watch TV all the time and don’t care about the lights being on. For that reason, I can’t link the trigger to turning the TV on.

The obvious workaround here is to set up 2 separate but simple pistons:

  1. Lights on
  2. Lights off

I was hoping there’s a simple way to achieve my results with a single piston. Because I’m running my piston as “app shortcut” on my Android TV.


#6

How?


#7

I use an app called “HTTP Shortcuts” to manually execute the external URL for the piston. I’ve been doing it this way for years for other pistons (such as toggling the lights in my bedroom).

So in this instance, any user watching TV who wants to turn off the lights (if they are on), they click on the App shortcut to run the piston. They would then watch a show/movie. When finish, could click on the app shortcut again to run the piston and now turn on the lights (as they were off during show).


#8

I see. You are executing with a piston URL. Then edit your trigger and change it from “Automatic” to “Never subscribe”. That way, the piston can only be triggered by your URL call and it should work as you originally intended.


#9

Perfect! Thank you. That did the trick.

I was messing around with the TCP/TEP and figured it was some setting like that.

I appreciate the help. I would have spent far too long trying to figure it out, and admittedly, would never have looked at the subscription methods.


#10

Excellent. Glad it is working for you!

Webcore%20Green%20Check%20II