Another check my code thread...

Shock130

New member
First time doing an ATO by myself (with the help of the UNOFFICIAL user guide of course)

Switch 1 is my lower switch (the main switch)
Switch 2 is emergency

______________________________________
ATO PUMP
-----------
Set OFF
Fallback OFF
If Outlet ATO_ON = ON Then ON
If Outlet ATO_ON = OFF Then OFF
If Switch2 OPEN Then OFF
______________________________________
Virtual ATO Switch
---------------------
Set OFF
Fallback OFF
If Switch2 OPEN Then OFF
Defer 020:00 Then ON
If Switch1 CLOSED Then ON
If Switch1 OPEN Then OFF
Min Time 020:00 Then OFF
______________________________________


Does that look right?

This way when ATO_ON virtual switch turns on, it has to wait 20 mins before it actually comes on (Defer), to ensure the water level actually is low...

When the water level reaches it limit, it has to wait 20 mins before turning back on.

If Switch 2 is OPEN it will turn off the ATO (and i have another virtual switch to email me).

Any other pointers would be great!

Thanks!
 
You don't need Fallback with virtual outlets. In both outlets, Set OFF is redundant. It won't hurt, but is unnecessary. The switch2 condition in the pump outlet is redundant since it is in the virtual outlet. You have a problem with the priority of switch2. If switch2 is mounted higher than switch1, then you need to have the code for switch2 come after switch1. Remember, the Apex executes top to bottom, so later code has higher priority.

Todd
 
Ok thank you I will make those changes... I knew it executed top to bottom, so i figured putting the switch2 command before switch1, would make it so if switch2 is open, then it doesnt matter what state switch 1 is in. So you say the last code has highest priority? meaning the apex reads through all the codes, and the last code will be what it responds to?
 
Yes, the last true statement will set the state of the outlet. There are two exceptions to the order rule, Defer and Min Time are executed last regardless of position. Although, I always put them last for convenience. So in your example, if switch1 were to fail or a snail decides to camp out on the float such that it reads CLOSED it would keep the outlet ON regardless of switch2.

Todd
 
Awesome, thank you very much, Hopefully with my design, a snail will never be able to find its way onto the float, seeing how its hung from the stand, not touching any sides of the glass.
 
Back
Top