Apex Coding Assistance Needed Please

  • Thread starter Thread starter jphilip813
  • Start date Start date
  • Tagged users Tagged users None

jphilip813

Well-Known Member
View Badges
Joined
Sep 8, 2019
Messages
964
Reaction score
549
Location
In The 915
What state or country do you live in
Texas
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...
 

TOP 10 Trending Threads

WHAT’S USUALLY THE FIRST CLUE THAT SOMETHING IS OFF IN YOUR REEF?

  • A fish’s behavior or appetite changes

    Votes: 6 10.9%
  • A coral looks different or stops opening normally

    Votes: 38 69.1%
  • Water clarity or surface appearance changes

    Votes: 7 12.7%
  • Equipment sounds or flow seem different

    Votes: 7 12.7%
  • A test result catches my attention

    Votes: 13 23.6%
  • Algae or other growth starts changing

    Votes: 12 21.8%
  • I usually notice when the problem is already obvious

    Votes: 3 5.5%
  • It depends on what’s going on

    Votes: 9 16.4%
  • Other (Post in the comments)

    Votes: 1 1.8%
Back
Top
Home
Post thread…
Market
What's new