Apex Coding Assistance Needed Please

jphilip813

Well-Known Member
View Badges
Joined
Sep 8, 2019
Messages
887
Reaction score
571
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
 

SuncrestReef

That Apex guy
View Badges
Joined
Jan 18, 2018
Messages
4,214
Reaction score
9,216
Location
Oregon
Rating - 0%
0   0   0
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.
 
OP
OP
jphilip813

jphilip813

Well-Known Member
View Badges
Joined
Sep 8, 2019
Messages
887
Reaction score
571
Location
In The 915
Rating - 0%
0   0   0
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.
 
OP
OP
jphilip813

jphilip813

Well-Known Member
View Badges
Joined
Sep 8, 2019
Messages
887
Reaction score
571
Location
In The 915
Rating - 0%
0   0   0
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...
 

Rock solid aquascape: Does the weight of the rocks in your aquascape matter?

  • The weight of the rocks is a key factor.

    Votes: 10 8.3%
  • The weight of the rocks is one of many factors.

    Votes: 43 35.5%
  • The weight of the rocks is a minor factor.

    Votes: 37 30.6%
  • The weight of the rocks is not a factor.

    Votes: 30 24.8%
  • Other.

    Votes: 1 0.8%
Back
Top