Apex Coding Assistance Needed Please

jphilip813

Well-Known Member
View Badges
Joined
Sep 8, 2019
Messages
910
Reaction score
581
Location
In The 915
Rating - 0%
0   0   0
Hello all,

I want my ATO to come on and run from 0700-2300 daily and if possible M-W. I have it attached to a nano tank in my room and it wakes me up every time the pump turns on... Here is my code I have inputted in it, but it is not working. What am I doing wrong? @SuncrestReef your help is needed:cool:

Fallback OFF
Set OFF
If Time 23:15 to 07:00 Then OFF
If ATO-LO OPEN Then ON
If ATO-HI CLOSED Then OFF
Defer 001:00 Then ON
 
The problem is that the Apex evaluates each line of code from the top to bottom, and the last line that's True is what will control the output. So in your code, the time restriction you have listed is above the ATO-LO condition, so it's ignored and the ATO-LO sensor will turn it on regardless of what time it is.

Change your code to this:

Fallback OFF
Set OFF
If ATO-LO OPEN Then ON
If ATO-HI CLOSED Then OFF
If Time 23:15 to 07:00 Then OFF
If DOW S---TFS Then OFF

Defer 001:00 Then ON

This will only allow the ATO to turn on if the water is below the ATO-LO sensor, but only if the time is not between 23:15 - 7:00, and not on Thursday through Sunday.
 
The problem is that the Apex evaluates each line of code from the top to bottom, and the last line that's True is what will control the output. So in your code, the time restriction you have listed is above the ATO-LO condition, so it's ignored and the ATO-LO sensor will turn it on regardless of what time it is.

Change your code to this:

Fallback OFF
Set OFF
If ATO-LO OPEN Then ON
If ATO-HI CLOSED Then OFF
If Time 23:15 to 07:00 Then OFF
If DOW S---TFS Then OFF

Defer 001:00 Then ON

This will only allow the ATO to turn on if the water is below the ATO-LO sensor, but only if the time is not between 23:15 - 7:00, and not on Thursday through Sunday.
 
Hi @Sun, thanks for reviewing the code for me as well as cleaning it up. I had the thought, similar to what you mentioned about how the code is read via Apex. Similar to the last one you helped me with. I tried it lastnight....I will check the output logs to see if the ATO turned on during those hours. Thanks again...
 

IF YOU HAD TO TAKE A REEFING EXAM, WOULD YOU PASS?

  • Yes!

    Votes: 32 45.7%
  • Not yet, but I have one that I want to buy in mind!

    Votes: 9 12.9%
  • No.

    Votes: 26 37.1%
  • Other (please explain).

    Votes: 3 4.3%

New Posts

Back
Top