I'm using a pair of momentary switches to trigger my water change program. The water change program is all set, no issues there. But I'm struggling getting my head around how to be program for the switches.
Because my water change system is limited by buckets, I want to take care not to trigger the program if a button is pressed inadvertently. Thus the use of 2 buttons, and using a defer statement to make sure the buttons are pressed and held for 5 seconds. My problem is how to test that both buttons are pressed (closed). Will the following work, or is the a better/cleaner way to do it?
Code:
Fallback OFF
Set OFF
If Swx3_1 CLOSED Then ON
If Swx3_2 CLOSED Then ON
If Swx3_1 OPEN Then OFF
If Swx3_2 OPEN Then OFF
Defer 000:05 Then ON
Min Time 015:00 Then ON
My thinking is that the first pair of IFs will test the state of the buttons and trigger an ON if either are pressed. The second set will test the buttons and will revert the status to OFF of either are NOT pressed/held. The defer will make sure the buttons are held for 5 seconds, and the min time statement will keep the state of the outlet ON for a minimum of 15 minutes, as needed by my water change program.
Will that work? Thanks all.
Bookmarks