Are pistons single instances or do they run concurrently?


#1

1) Give a description of the problem
I am trying to write a piston that will turn on lights and level for 3 different scenarios. The light comes on at the correct time but do not seem to turn off.

Question which may be related to my problem:

  1. Are pistons single instances? In that, if in my example, the sensor turns active and the piston begins to run will another instance of the piston run if the sensor turns active again. I am wondering if the first lot of wait commands could still be waiting when the motion sensor is hit again? I hope this makes sense. If this is the case, can anyone suggest how to reset the piston each time motion is detected?

2) What is the expected behavior?
The landing light will turn on for x amount of minutes, then dim for x amount of minutes, then off. The level it turns on at and dims at is dependent on the time frame

3) What is happening/not happening?
The landing light does not turn off.

4) Post a Green Snapshot of the pistonimage

5) Attach any logs (From ST IDE and by turning logging level to Full)
No logs from last night (when it was first ran)

thanks!


#2

Your piston is constructed inaccurately.
As it stands at present the actions start to take place when the motion sensor changes to active. That makes the first “if” become true (if the lux Level is also true) So then your following actions start to evaluate. But after a few seconds or so the motion is “no longer changing to active!” causing your main first “If” to now become false thus making all other actions cease


#3

Click on all 3 with’s and enable TCP to never
This won’t fix it completely but I’ll will stop it from cancelling the tasks when the first If is no longer true.


#4

This should answer your first question. You can enable it so that multiple instances of your piston are executing. But it is not enabled by default.

https://wiki.webcore.co/Task_Scheduling_Policy

As to why your piston is not acting properly is probably to most common thing answered on this forum. @Baz2473 kinda skimmed it. Check out this article which explains it a little more

https://wiki.webcore.co/Task_Cancellation_Policy

If after reading that you can’t figure it out then go ahead and click below

CLICK ME

You need to change the TCP of all the with actions to never cancel. Accomplish this by selecting each with and click the cog for advanced options. You will see TCP.


#5

Far better explanation. I think I’m gonna have to start referencing the wiki for my answers to people in future!


#6

Thanks everyone. Much appreciated


#7

Saves from explaining the same thing again and again


#8

Very true! I think every time I’ve explained it the explanation I’ve given has got shorter!? :thinking: