Your IF statements in lines 31 and 45 can be combined. Line 31 checks the if the switch is off, so all you need to do is put your actions for off in the THEN section, and put your actions of on in the ELSE section.
Line 50 doesnât need a loop. You selected a âtriggerâ by saying "IF switch changes to off. That means your piston will trigger (execute) every time your switch reports a change in its switch state. However, because this statement was nested inside an âexecute once at this timeâ event, even though the piston would run it would never reach this piece of code.
Your sequential IF statements that check the state of your variables can be combined some, too. Hereâs a sample with some of those changes worked in.
One thing I noticed is you only set your variables to FALSE if they are BOTH TRUE. If this is accidental, you should be able to clean it up easily in this piston. If thatâs the way you intended it to be, this piston is written with that functionality retained.
Lastly, I avoid waits whenever I can. That 2 hour wait, combined with your âexecute this piston daily at 18:00â actually ensures the only thing this piston will do is push a message to you daily at 18:00. Two hours later when the piston wakes up, it will no longer be 18:00 so the rest of the piston inside that loop will not be executed.
Iâve tried to write this the way I think you want the time triggers to work for you. If Iâve missed something, just try explaining what you want this piston to do and weâll modify it until itâs working for you.