Only trigger piston when called via POST request


I’ve got a piston, however I only want it to trigger from a direct curl request from my RPi.

How can I go making the below piston so it only triggers from a curl request? The logic should be that it always executes when called, however if it isn’t between 21:30 and 09:00 then it won’t turn the lights and wait 2 minutes to turn the plugs off


Hi there @ghesp
Since you told the piston only to PASS your IF block (Your condition), if it’s between 21:30 and 9 it won’t do anything other then that.
If you want it work every time, you need to get rid of that IF.

For the switch 4, you need to change your TCP settings to NEVER CANCEL TASKS.

here is how to do that.

if I understood you correctly…


The easiest way (don’t laugh) is to add an IF at the very bottom like this:

IF $hour24 changes to 25

Yes, that is an empty block, that can never be true… but “changes to” acts like a trigger (removing your lightning bolt)… The icing on the cake is system variables (such as $hour24) will not work as a trigger.

Essentially, as long as your code has only conditions, it forces this up top:


I’m not really following this at all.

Basically, I just want this piston below to run ONLY when it is called using the API piston request


something like this won’t be executed unless you call the URL from outside…



Your piston dss52 will run when called, but it will ALSO run at your IF time.

To prevent that, you can add this small block to the bottom of that piston.

IF $hour24 changes to 25

Essentially, your goal will work when you save the piston, and see this up top:


Your current piston will be scheduled to fire at the beginning and end of the ‘time between’ period, as well as by external URL, test button or execution from another piston. If you want to stop the scheduling happening, edit the ‘time between’ statement, go into the settings for it, and set the ‘Subscription Method’ to ‘Never subscribe’. Despite the wording, it also turns off the scheduling.

If you want belt and braces, $currentEventAttribute is set to ‘execute’ and $currentEventValue to the remote IP address when the external URL is used, so you can check those.


You can send a json in the POST Request Body.
{ “sender” : “me” }

And then access them from the piston using the $args variable.

If $args.sender == “me” 
and <between times>
    // do stuff 

That way the piston will only run when it sees that “sender” is “me” But only when it is within that time range.