Programming Adaptive Reef 6 Way Apex Switch Toggle Box

Reef4home

New Member
View Badges
Joined
Dec 1, 2020
Messages
9
Reaction score
34
Location
New York
Rating - 0%
0   0   0
Hello All:
I'm trying to program my Apex so that my new Adaptive Reef Switch Toggle Box (https://www.adaptivereef.com/controller-accessories) will trigger a feedmode by pressing a doorbell button, which automatically turns off after a set period of time, but which can also be turned off manually (before the set period of time expires) by pressing a different doorbell button. I know how to program one doorbell button to trigger a feedmode and then turn off after a set period of time--by creating a virtual outlet and using a Defer command. But I can't figure out how to have one doorbell serve that function work and have another doorbell button turn off the feedmode before the set time expires. Any suggestions or ideas would be much appreciated! Thanks.
 

SuncrestReef

That Apex guy
View Badges
Joined
Jan 18, 2018
Messages
4,214
Reaction score
9,216
Location
Oregon
Rating - 0%
0   0   0
This gets tricky because there's no way to cancel a Defer timer or a Min Time timer. However, if the only requirement is to be able to cancel a currently active feeding (using a virtual feed timer, not an official Feed Cycle since they cannot be initiated through programming), and you aren't concerned with being able to immediately restart the feeding, then using two virtual outputs (one to start, one to stop) and sequencing the program on your vFeed program:

[Start_Feed] -- virtual output
Set OFF
If Sw1 CLOSED Then ON
Min Time 005:00 Then ON

[Stop_Feed] -- virtual output
Set OFF
If Sw2 CLOSED Then ON
Min Time 005:00 Then ON

[vFeed] -- virtual output simulating a Feed cycle
Set OFF
If Output Start_Feed = ON Then ON
If Output Stop_Feed = ON Then OFF

Pressing Sw1 will start the feeding, and the Start_Feed's Min Time will cause it to remain on for 5 minutes. However, if you press Sw2 at any time while Start_Feed is still on, then the Stop_Feed output will remain on for 5 minutes, overriding the Start_Feed since this line of code is last. The only drawback to this approach is that you'll need to wait the full 5 minutes after pressing Sw2 before Sw1 will function again, even if there were only 10 seconds left in the 5 minute Min Time on Start_Feed.

I hope this makes sense.

For more on simulating Apex Feed Cycles, see my tutorial here:
 
OP
OP
R

Reef4home

New Member
View Badges
Joined
Dec 1, 2020
Messages
9
Reaction score
34
Location
New York
Rating - 0%
0   0   0
Dear SuncrestReef (That Apex Guy),
Thanks so much for your extremely quick and clever reply. Your program makes perfect sense--the key is knowing that the last line of code will override any previous inconsistent line, which I didn't know. Could I solve the problem of being able to re-enter feedmode after canceling it by using one of the covered toggle switch buttons for Sw2, instead of a second doorbell button, to cancel feedmode by editing [Stop_Feed] to eliminate the Min Time command? That is:

[Stop_Feed] -- virtual output
Set OFF
If Sw2 CLOSED Then ON

That way, [Start_Feed] is overridden unless and until Sw2 is flipped back off (by hand). If Sw2 is flipped back off before [Start_Feed] Min Time expires, [Start_Feed] should turn back on instantly. Does this work?
P.S. Thanks for the link to your tutorial. I will definitely watch it, and the others you've posted as well!
 

SuncrestReef

That Apex guy
View Badges
Joined
Jan 18, 2018
Messages
4,214
Reaction score
9,216
Location
Oregon
Rating - 0%
0   0   0
Dear SuncrestReef (That Apex Guy),
Thanks so much for your extremely quick and clever reply. Your program makes perfect sense--the key is knowing that the last line of code will override any previous inconsistent line, which I didn't know. Could I solve the problem of being able to re-enter feedmode after canceling it by using one of the covered toggle switch buttons for Sw2, instead of a second doorbell button, to cancel feedmode by editing [Stop_Feed] to eliminate the Min Time command? That is:

[Stop_Feed] -- virtual output
Set OFF
If Sw2 CLOSED Then ON

That way, [Start_Feed] is overridden unless and until Sw2 is flipped back off (by hand). If Sw2 is flipped back off before [Start_Feed] Min Time expires, [Start_Feed] should turn back on instantly. Does this work?
P.S. Thanks for the link to your tutorial. I will definitely watch it, and the others you've posted as well!
You could solve the whole issue if you use one of the Toggle buttons instead of momentary push buttons. Flip the toggle to the on position to start the feeding, use a virtual output as a timer to see if it's been on for more than 5 minutes, but you could flip the toggle off at any time before 5 minutes:

[Stop_Feed]
Set OFF
If Toggle CLOSED Then ON
Defer 005:00 Then ON

[vFeed]
Set OFF
If Toggle CLOSED Then ON
If Output Stop_Feed = ON Then OFF

So if you toggle it on and walk away, the virtual output's 5 minute Defer will cause it to turn off vFeed at 5 minutes even if the toggle is still on. You'd just need to toggle it off before toggling it on again the next time you feed. But if you toggle it off before 5 minutes, the vFeed will turn off due to the initial Set OFF command being the only True condition in the program at that point.
 
OP
OP
R

Reef4home

New Member
View Badges
Joined
Dec 1, 2020
Messages
9
Reaction score
34
Location
New York
Rating - 0%
0   0   0
That makes perfect sense. I'm very grateful for your solution and I'll use it. Just for my education (if you don't mind), would my toggle switch solution for your push button program have worked?
 

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.8%
  • The weight of the rocks is a minor factor.

    Votes: 36 30.0%
  • The weight of the rocks is not a factor.

    Votes: 30 25.0%
  • Other.

    Votes: 1 0.8%
Back
Top