Neptune Apex Programming Tutorials, Part 6: Alarms

SuncrestReef

Valuable Member
View Badges
Joined
Jan 18, 2018
Messages
1,427
Reaction score
3,543
Location
Oregon
Seawitch submitted a new Article:

Neptune Apex Programming Tutorials, Part 6: Alarms

This article is Part 6 of a series. Feel free to go back and read Part 1, Part 2, Part 3, Part 4, or Part 5.

This article and several future ones by the same author were originally part of several presentations made to a local aquarium club on programming your Neptune Apex Controller. The article is reprinted with permission from the author.

Because this topic will be of great interest to some readers but no interest to others who have not automated their systems, R2R will run these programming articles every Friday until we come to the end of the series.

Photos, images, and diagrams included in this article below are all courtesy of the author, @SuncrestReef ©2019, All Rights Reserved.

~~~~~~~~~~~~~~~~~~~

For inspiration, here's a spectacular Cyphastrea macro photo from the author's reef tank.
Cyphastrea (1).jpg


Alarms

The Apex provides a useful--though limited--way to notify you when something is wrong with your system. A variety of built-in alarms as well as a programmable alarm output can be configured to selectively draw your attention to problems. There are several sources of alarms:
  • Inputs — Probes, switches, and power meters can all be configured to alarm based on state or measured value.
  • EmailAlm output — Custom programming can be used to alarm based on typical output commands
  • When command — The When countdown timer generates an error condition alarm and sets the output slider to the OFF position.
  • Module errors — Certain Apex modules have built in safeguards that generate alarms when a problem is encountered.
Note: If you have an older Apex with the Display module, it provides audible alarms through a small speaker. These alarm outputs named SndAlm_I6 and SndWrn_I7 serve no purpose if you don’t have the display module, even though they are still listed as outputs on every Apex unit, including current models.

When the Apex has an active alarm condition, it can send a notification via email, SMS text message, or directly to the Fusion App on a smartphone or tablet. In addition, all alarms are added to the Apex Alarm Log that can be reviewed later:

image7-1.png


Setting up alarm notifications:

1. In Fusion, click the down arrow next to your username at the upper right, then click Settings.

image7-2.png

2. Click Notifications on the left.

image7-3.png

3. To add a recipient, click the plus sign icon at the upper right.

4. Select the method of notification. If you want SMS text messages, choose your wireless carrier from the list.

image7-4.png

5. Enter the email address or phone number.

6. After adding a new entry, you will receive a verification code at that address or phone number.

image7-5.png

Note: If you are adding someone else and don't have access to their email or phone, you can click Cancel on this screen. Later when they can tell you the verification code, you can go back to the list of recipients and enter the verification code. Just click the gear icon next to their address and click
Verify:

image7-6.png

You can have multiple destinations for alarms. I send them to both email and my iPhone for redundancy. I also add my tank sitter to the list before I’m going out of town, and then remove her from the list when I return.

Configuring alarms

There are a few different ways to configure alarms. The simplest method for probes or certain Inputs is to use the built-in alarm feature on its configuration page. This is available for:
  • Temperature probes
  • Conductivity (salinity) probes
  • pH probes
  • ORP probes
  • Flow sensors
  • EB832 ammeter and watt meter inputs
  • PAR sensor
  • Trident measurements
You can either us the Basic alarm settings, where it will trigger an alarm if above or below your specified values:

image7-7.png


or use Advanced alarm settings which gives you more flexibility:

image7-8.png

Any Inputs with alarms configured will display a checkmark under the Alarm column in the list of Inputs:

image7-9.png


Alarm Programming

For items that don’t have built in alarm settings on the configuration page, you must add lines of program code to the EmailAlm output. The command used for this is typically a simple If command. Any line of code that evaluates as True will trigger the alarm. Here are some examples:

Float switch:

If FW_HI CLOSED Then ON

Virtual output:

If Output Alert_2Part = ON Then ON

When command error:

If Error ATK_PMUP Then ON

Module error:

If Error Trident_16_3 Then ON

The EmailAlm output itself behaves exactly like any other outlet and follows the same logic that I’ve covered in earlier tutorial topics. The commands are processed from top to bottom, and the last line that evaluates to True sets the state of the output. If anything sets it to On, then the alarm will be triggered and notifications will be sent. Once that condition is no longer True, and if no other command turns the outlet On, then the output is turned Off and the alarm is cleared. A notification is also sent when the alarm turns Off.

With this in mind, you should always start your program with an initial Set OFF command, and then follow it with lines that could potentially turn it On.

One of the major limitations with alarm programming is that only the last line that turns the output On is the line of text you’ll receive in the notification. In other words, if there are 3 different lines of code that all evaluate True and turn the output On, only the last one will be displayed in your notification email or text message. For this reason it’s recommended to sequence your alarm programming so the least important things are at the top, and the most critical things are at the end. For example, if your EmailAlm output program is checking for high temperature and also checking if the skimmer-cup, float switch is on:

Set OFF
If Temp > 99 Then ON
If SkimmerFull = CLOSED Then ON


and if both of these conditions are true, the only notification you will get is about the skimmer. If you got that message while you’re at a movie theater, you probably wouldn’t rush right home and instead you'd stay to see the movie credits and any blooper scenes. But you wouldn’t realize that the water temperature is killing everything in your tank.

It would be better to change the sequence to:

Set OFF
If SkimmerFull = CLOSED Then ON
If Temp > 99 Then ON


Now when you receive the alarm about the Temp > 99, you’ll run out of the theater and head right home. After dumping frozen water bottles into your tank, you’ll also eventually notice that your skimmer is full even though you didn't get a notification about it.

Just think through your priorities when sequencing your alarm programming.

Once you have your EmailAlm output programmed, but sure to leave its tile on the dashboard in the AUTO position. If you ever slide it to OFF, you will not receive any alarms you programmed, If you slide it to ON, it will just send you a notification right away regardless of your programming. It’s best to just always leave it set to AUTO.

Nuisance Notifications

Once an alarm is triggered, the email and text notifications will be sent to you every hour until the alarm condition is cleared. For trivial things, such as the skimmer cup full example above, this can be very annoying. The best way to avoid excess notifications is to use a virtual output with its own programming including a timer, and then use that virtual output’s state in your alarm programming. This was discussed in my previous tutorial on virtual outputs, but I’ll present it again here.

When my 2-part dosing containers are low, the optical sensors inside will report OPEN. I use a virtual output to monitor this condition to turn the virtual output On, then use a When timer of 10 minutes to turn the virtual output to manual OFF. It also ignores the optical sensor at night when I’m sleeping with an If Time command:

Set OFF
If ALK_LO OPEN Then ON
If CAL_LO OPEN Then ON
If Time 23:00 To 07:00 Then OFF
Defer 001:00 Then ON
When On > 010:00 Then OFF


Then in my alarm programming, I just check the status of the virtual output:

If Output Alert_2Part = ON Then ON

Now I don’t need to worry about low 2-part waking me up at 3 a.m., and during the day if it’s low it will only send me one notification instead of nagging every hour.

I use several virtual outputs exclusively for alarm programming. Here’s my current EmailAlm output programming:

Set OFF
If Output Alert_2Part = ON Then ON
If Output Alert_FW_HI = ON Then ON
If Output Alert_FW_LO = ON Then ON
If Output Alert_SkmFul = ON Then ON
If Output Alert_FUG_Hi = ON Then ON
If Error Trident_16_3 Then ON
If Error ATK_PMUP Then ON
If Output vATO_Off = ON Then ON
If Output Alert_SmpFlo = ON Then ON
If Output vSmp_Hi = ON Then ON
If Output vSMP_Lo = ON Then ON
If Output Alert_Power = ON Then ON
If Output Alert_Leak = ON Then ON


Again, I want to emphasize the importance of placing the least important alarm conditions at the top of the list, and the most critical towards the bottom.

Be sure to configure your alarms. It’s one of the most important reasons for using a controller. The sooner you know there’s a problem, the sooner you can work on fixing it.

Stay tuned for our next tutorial on Feed Cycles.

~~~~~~~~~~

We encourage all our readers to join the Reef2Reef forum. It’s easy to register, free, and reefkeeping is much easier and more fun in a community of fellow aquarists. We pride ourselves on a warm and family-friendly forum where everyone is welcome. You will also find lots of contests and giveaways with our sponsors.

~~~~~~~~~~~

Author Profile: @SuncrestReef

John Halsey is a reefing hobbyist who keeps a Red Sea Reefer XL 425 in his living room. He is new to reefing with just over one year of experience, but has been successful in keeping a healthy mixed reef by following best practices learned here on R2R as well as actively participating in his local aquarist club--PNWMAS--in Portland, Oregon. John retired from his 30-year career in IT support, and put that technical expertise to good use by automating much of his aquarium equipment with an extensive Neptune Apex system.

~~~~~~~~~~~
 
OP
SuncrestReef

SuncrestReef

Valuable Member
View Badges
Joined
Jan 18, 2018
Messages
1,427
Reaction score
3,543
Location
Oregon
Good stuff. Quite timely. Trying to figure out how to get Apex fusion to email me everyday at the same time just to verify it has power and internet connectivity.
If you really want a daily email, you could set up a virtual output with If Time command to turn it on at a particular time each day, then reference that output in your alarm coding. It would end up sending an ON and a follow OFF notification and there’s no way around the OFF notification.
 

ca1ore

Valuable Member
View Badges
Joined
Oct 28, 2014
Messages
8,213
Reaction score
10,847
Location
Stamford, CT
I have a clarification as I am about to use the When command for the first time. It is my understanding that when executed, the When command simply puts the outlet into an off condition; it does not move the slider to OFF from AUTO. So, as example, a line of code in my ATO outlet that says 'When ON > 001:00 Then OFF' means that the pump will operate for a maximum of one minute before turning off, but the outlet will stay in AUTO mode so that the next time any other If conditions are met (like a float switch) the outlet will still trigger?
 
OP
SuncrestReef

SuncrestReef

Valuable Member
View Badges
Joined
Jan 18, 2018
Messages
1,427
Reaction score
3,543
Location
Oregon
I have a clarification as I am about to use the When command for the first time. It is my understanding that when executed, the When command simply puts the outlet into an off condition; it does not move the slider to OFF from AUTO. So, as example, a line of code in my ATO outlet that says 'When ON > 001:00 Then OFF' means that the pump will operate for a maximum of one minute before turning off, but the outlet will stay in AUTO mode so that the next time any other If conditions are met (like a float switch) the outlet will still trigger?
The When command actually moves the slider from AUTO to the OFF position, and after that your program code will no longer run until you manually move the slider back to AUTO. This is the only command that can manipulate the slider position. Neptune added the When command to act as a safeguard, and it forces you to investigate what is causing the output to run longer than expected. It's typically used for ATO pumps so you don't accidentally overfill your tank with fresh water, killing your livestock and flooding your house.
 

Will you be participating in Secret Santa 2019?

  • Yep! Count me in! (Be sure to register in the thread)

    Votes: 150 59.1%
  • Not this year

    Votes: 86 33.9%
  • I hope to, but I'm not located in the USA (Please be sure to PM Santa Claus about this issue)

    Votes: 18 7.1%

Online statistics

Members online
1,547
Guests online
3,979
Total visitors
5,526
Pieces of the Ocean
GHL Advanced Technology
Top