Piston fires twice


The attached piston is suppose to go off at sunset. Yesterday sunset was at 8:43. The piston fired at 8:43 but it also went off at 8:44



Probably the piston last ran a day previously and when it scheduled the next run it used that day’s sunset time. When it ran yesterday it will have run a bit earlier than sunset and then scheduled today’s run using yesterday’s time. However that time hadn’t happened yet yesterday so it fired again.

WebCoRE pistons update sunset times when they start up but only if it has been more than eight hours since the last update. So the standard trick is to make sure the piston runs before sunset each day as that will update the schedule. Running early in the morning is popular. It also helps with DST changes.


Thanks guys
So orangebucket If I run it either 1 min to sunset or 1 min after sunset that should take care of it


Likely not. The change of sunrise and sunset varies thru the year. You would do better to add the if statement and let he piston run around 3:00 AM to set times correctly for later in the day runs.


No, it will likely be the same problem a minute earlier. Use the ‘if time happens daily at …’ approach that @E_Sch suggests. It probably sounds odd but we all do it, and as I’ve mentioned it’ll also avoid issues with daylight savings changes.


I dont want the piston going off at 3 am. It plays a wav file on a computer connected to speakers all over the house. Last night I did try the offset 30 seconds after sunset and the piston only ran once. Ive changed it to 5 seconds before sunset and Ill see what happens


To clarify, the suggestion is to run the piston using a blank block.

Just add a separate IF time happens daily at 3am block with no actions underneath. The piston will run at 3am, the rest of the code will not run since it is restricted to only running at sunset. By running the piston at 3am, it will re-subscribe to sunset which should be updated at that point.


Ok that makes sence