This article is a reference guide for all of the Neptune Apex programming commands. All of this information is publicly available, but is scattered amongst several Neptune documents and posts in the Neptune Community Forums. My goal is to consolidate all of this information into a single reference document.
Documentation Conventions
Before presenting the list of commands, here is an overview of the documentation conventions for parameters:
Input, Output, and Profile names are shown in bold italics.
Examples:
If Temp > 80 Then OFF
If Flow1 < 100 Then OFF
If pH > 6.80 Then ON
If Output Return_Pump = OFF Then OFF
If FeedA 000 Then Slow_Mode
Various parameters are listed in square brackets, separated by a slash: [ON/OFF/Profile_Name/%]
Examples:
If Time 08:00 To 10:00 Then [ON/OFF/Profile_Name/%] includes the following possible uses:
If Time 08:00 To 10:00 Then ON (turns the output ON)
If Time 08:00 To 10:00 Then OFF (turns the output OFF)
If Time 08:00 To 10:00 Then Morning_Mode (sets the output to use the Morning_Mode profile)
If Time 08:00 To 10:00 Then 25 (sets the output to 25%)
Note: Profiles can only be used on specific output types. For example, a Pump profile only works on 0-10v variable outputs, DOS profiles only work on DOS outputs, Radion profiles only work on Radion outputs, etc.
Note: Only certain types of outputs support percentages. For details, see this Neptune FAQ: https://forum.neptunesystems.com/showthread.php?20677-Using-percentages-in-programming
Operators are also listed in square brackets, separated by a slash: [>/<]
Examples:
If Input_name [>/<] ### Then [ON/OFF/Profile_Name/%] includes the following possible uses:
If Temp > 80.0 Then OFF
If Temp < 76.0 Then ON
### represents a numeric value, which may or may not include a decimal point.
Times are specified in hours, minutes, and seconds represented by H, M, and S respectively. Some commands use hours & minutes, some use minutes only, and others use minutes & seconds.
Examples:
If Time HH:MM To HH:MM Then [ON/OFF/Profile_Name/%]
OSC MMM:SS/MMM:SS/MMM:SS Then [ON/OFF/Profile_Name/%]
Defer MMM:SS Then [ON/OFF]
Apex Programming Command Reference
Set [ON/OFF/Profile_Name/%]
Set is used to unconditionally set an output state, and is commonly used as the first command in a program to set the default state prior to applying various conditions that would override that initial state.
For more details on the Set command, see: https://forum.neptunesystems.com/sh...d-This-Thread!&p=114462&viewfull=1#post114462
If Time HH:MM To HH:MM Then [ON/OFF/Profile_Name/%]
If Time is used to set an output state between a set of fixed times, inclusive of the start and end time.
Example:
Set OFF
If Time 10:00 to 10:01 Then ON
will turn on the output at 10:00 and turn it off at 10:02:
For more details of the If Time command, see my tutorial on Apex Timers: https://www.reef2reef.com/ams/neptune-apex-programming-tutorials-part-2-timers.689/
If DOW [SMTWTFS] Then [ON/OFF/Profile_Name]
The DOW command is used to set an output state based on the day of week. Each day is represented by a letter placeholder starting with Sunday and ending with Saturday. If a letter is listed, the command will evaluate True for that day. If a dash is substituted for a day, the command will evaluate False for that day.
Example:
If DOW SMT-TFS Then ON
This will turn the output ON each day of the week except for Wednesday, since Wednesday's placeholder is listed with a dash.
For more details of the DOW command, see my tutorial on Apex Timers: https://www.reef2reef.com/ams/neptune-apex-programming-tutorials-part-2-timers.689/
If Input_Name [>/<] ### Then [ON/OFF/Profile_Name/%]
This command is used to measure the reading of a probe, including temperature, pH, ORP, salinity, dissolved oxygen, flow sensor, PAR sensor, Trident alkalinity, Trident calcium, or Trident magnesium.
If Output Output_Name = [ON/OFF] Then [ON/OFF/Profile_Name/%]
This command is used to react to the current state of an output, whether physical or virtual.
If Output Output_Name Percent [>/=/<] ### Then [ON/OFF/Profile_Name/%]
This command is used to react to the current percentage or speed of an output, such as a COR pump, WAV, or VarSpd output. For details, see this Neptune FAQ: https://forum.neptunesystems.com/showthread.php?20677-Using-percentages-in-programming
If Switch_Name [OPEN/CLOSED] Then [ON/OFF/Profile_Name/%]
This command is used to react to either an optical sensor, leak sensor, or a switch connected to a Breakout Box port.
If [FeedA/FeedB/FeedC/FeedD] MMM Then [ON/OFF/Profile_Name/%]
This command sets an output state when a Feed Cycle is activated. The MMM delay extends the output state for a number of minutes beyond the set time of the selected Feed Cycle.
For more details on If Feed, see my tutorial on Apex Feed Cycles: https://www.reef2reef.com/ams/neptune-apex-programming-tutorials-part-7-feed-cycles.715/
If Temp [>/<] [RT+/RT-] [###] Then [ON/OFF/PROFILE/%]
This command is used to set an output state based on the regional temperature defined in the Apex seasonal tables.
For more details on regional temperatures, see page 65 of the Apex Comprehensive Reference Guide: https://www.neptunesystems.com/downloads/docs/Comprehensive_Reference_Manual.pdf
If Sun [+/-] [MMM] / [+/-] [MMM] Then [ON/OFF/Profile_Name/%]
This command is used to set an output state based on the sunrise or sunset cycles defined in the Apex seasonal tables. The first timer is relative to sunrise, and the second timer is relative to sunset. A positive number delays the action to after the event, and a negative number precedes the event.
For more details on If Sun, see page 66 of the Apex Comprehensive Reference Guide: https://www.neptunesystems.com/downloads/docs/Comprehensive_Reference_Manual.pdf
If Moon [+/-] [MMM] / [+/-] [MMM] Then [ON/OFF/Profile_Name/%]
This command is used to set an output state based on the moonrise or moonset cycles defined in the Apex seasonal tables. The first timer is relative to moonrise, and the second timer is relative to moonset. A positive number delays the action to after the event, and a negative number precedes the event.
For more details on If Moon, see page 67 of the Apex Comprehensive Reference Guide: https://www.neptunesystems.com/downloads/docs/Comprehensive_Reference_Manual.pdf
For an example of If Moon usage, see my tutorial on Apex Lunar Schedule and Lighting Profiles: https://www.reef2reef.com/ams/neptu...sion-lunar-schedule-and-lighting-profiles.717
If Output Output_Name [Amps/Watts] [>/<] ### Then [ON/OFF/Profile_Name/%]
This command is used to react to the Amps or Watts currently consumed by an EB832 output. This does not apply to the older EB4, EB6, EB8, or the DC24 accessory outputs of the EB832.
For more details about the Amps/Watts programming, see my tutorial on Apex Power Monitoring: https://www.reef2reef.com/ams/neptune-apex-programming-tutorials-part-4-power-monitoring.698/
If Power [Power Probe] [ON/OFF] [###] Then [ON/OFF/Profile_Name]
This command is used to set an output state based on the detection of a power failure. The [Power Probe] is either the Apex or the name of an attached Energy bar. Note that the If Power command does not support using percentages as documented in this Neptune FAQ: https://forum.neptunesystems.com/showthread.php?20677-Using-percentages-in-programming
For more details on If Power and instructions on how to integrate the Apex with a UPS backup battery, see my tutorial on Apex Power Monitoring: https://www.reef2reef.com/ams/neptune-apex-programming-tutorials-part-4-power-monitoring.698/
OSC MMM:SS/MMM:SS/MMM:SS Then [ON/OFF]
OSC is used to control an output on a repeating schedule. There are 3 timers:
OSC 000:00/005:00/005:00 Then ON
This would turn on the output at midnight for 5 minutes, then turn it off for 5 minutes, and repeat indefinitely:
For details and examples of the OSC command, see my tutorial on Apex Timers: https://www.reef2reef.com/ams/neptune-apex-programming-tutorials-part-2-timers.689/
Defer MMM:SS Then [ON/OFF]
Defer delays switching an output from ON to OFF, or from OFF to ON. This command applies to the output after all the conditions have been evaluated. Only one Defer ON and one Defer OFF command can be used on an output. When the output changes from ON to OFF, only the Defer OFF timer is applied. When the output changes from OFF to ON, only the Defer ON timer is applied.
Example:
Set OFF
If Time 10:00 to 10:01 Then ON
Defer 001:00 Then ON
This will cause it to wait until 10:01 to turn on, then turn off at 10:02. effectively giving you a 1 minute timer:
For details and more examples of Defer, see my tutorial on Apex Timers: https://www.reef2reef.com/ams/neptune-apex-programming-tutorials-part-2-timers.689/
Min Time MMM:SS Then [ON/OFF]
Min Time forces an output to remain ON or OFF for a minimum amount of time regardless of the conditions evaluated in the programming. If the output is ON, only the Min Time Then ON timer is applied. If the output is OFF, only the Min Time Then OFF timer is applied.
For more details and examples of Min Time, see my tutorial on Apex Timers: https://www.reef2reef.com/ams/neptune-apex-programming-tutorials-part-2-timers.689/
When [ON/OFF] > MMM:SS Then [ON/OFF]
When is used to switch an output’s tile from AUTO to OFF or ON if a condition is met. This is the only command in the Apex programming language that can physically move an output tile's slider position on the dashboard, and once moved, manual intervention is required to set it back to AUTO before the programming will be resumed.
For more details and examples of When, see https://forum.neptunesystems.com/showthread.php?18393-Using-the-%91When%92-statement
Also see my tutorial on Apex Timers: https://www.reef2reef.com/ams/neptune-apex-programming-tutorials-part-2-timers.689/
If Error Output_Name Then [ON/OFF]
The If Error command will evaluate True if the When timer described above is exceeded. For details about If Error, see https://forum.neptunesystems.com/showthread.php?18393-Using-the-%91When%92-statement
If Error Apex Then [ON/OFF]
The If Error Apex command will evaluate True if a module is disconnected from the Apex. This feature was first introduced in AOS 5.06_5C21 and is only available on the Apex 2016 and Apex-EL. It is particularly useful to add to your EmailAlm programming to send an alert if a module is missing, but may also be used in programming on any output. For details about If Error Apex, see https://forum.neptunesystems.com/showthread.php?31358-AOS-5-06_5C21-has-been-released!
Fallback [ON/OFF/Profile_Name/%]
Fallback is used to set the output state in an AquaBus module when that module loses communications with the Apex.
For more details on Fallback, see https://forum.neptunesystems.com/showthread.php?8510-All-About-FALLBACK
Documentation Conventions
Before presenting the list of commands, here is an overview of the documentation conventions for parameters:
Input, Output, and Profile names are shown in bold italics.
Examples:
If Temp > 80 Then OFF
If Flow1 < 100 Then OFF
If pH > 6.80 Then ON
If Output Return_Pump = OFF Then OFF
If FeedA 000 Then Slow_Mode
Various parameters are listed in square brackets, separated by a slash: [ON/OFF/Profile_Name/%]
Examples:
If Time 08:00 To 10:00 Then [ON/OFF/Profile_Name/%] includes the following possible uses:
If Time 08:00 To 10:00 Then ON (turns the output ON)
If Time 08:00 To 10:00 Then OFF (turns the output OFF)
If Time 08:00 To 10:00 Then Morning_Mode (sets the output to use the Morning_Mode profile)
If Time 08:00 To 10:00 Then 25 (sets the output to 25%)
Note: Profiles can only be used on specific output types. For example, a Pump profile only works on 0-10v variable outputs, DOS profiles only work on DOS outputs, Radion profiles only work on Radion outputs, etc.
Note: Only certain types of outputs support percentages. For details, see this Neptune FAQ: https://forum.neptunesystems.com/showthread.php?20677-Using-percentages-in-programming
Operators are also listed in square brackets, separated by a slash: [>/<]
Examples:
If Input_name [>/<] ### Then [ON/OFF/Profile_Name/%] includes the following possible uses:
If Temp > 80.0 Then OFF
If Temp < 76.0 Then ON
### represents a numeric value, which may or may not include a decimal point.
Times are specified in hours, minutes, and seconds represented by H, M, and S respectively. Some commands use hours & minutes, some use minutes only, and others use minutes & seconds.
Examples:
If Time HH:MM To HH:MM Then [ON/OFF/Profile_Name/%]
OSC MMM:SS/MMM:SS/MMM:SS Then [ON/OFF/Profile_Name/%]
Defer MMM:SS Then [ON/OFF]
Apex Programming Command Reference
Set [ON/OFF/Profile_Name/%]
Set is used to unconditionally set an output state, and is commonly used as the first command in a program to set the default state prior to applying various conditions that would override that initial state.
For more details on the Set command, see: https://forum.neptunesystems.com/sh...d-This-Thread!&p=114462&viewfull=1#post114462
If Time HH:MM To HH:MM Then [ON/OFF/Profile_Name/%]
If Time is used to set an output state between a set of fixed times, inclusive of the start and end time.
Example:
Set OFF
If Time 10:00 to 10:01 Then ON
will turn on the output at 10:00 and turn it off at 10:02:
For more details of the If Time command, see my tutorial on Apex Timers: https://www.reef2reef.com/ams/neptune-apex-programming-tutorials-part-2-timers.689/
If DOW [SMTWTFS] Then [ON/OFF/Profile_Name]
The DOW command is used to set an output state based on the day of week. Each day is represented by a letter placeholder starting with Sunday and ending with Saturday. If a letter is listed, the command will evaluate True for that day. If a dash is substituted for a day, the command will evaluate False for that day.
Example:
If DOW SMT-TFS Then ON
This will turn the output ON each day of the week except for Wednesday, since Wednesday's placeholder is listed with a dash.
For more details of the DOW command, see my tutorial on Apex Timers: https://www.reef2reef.com/ams/neptune-apex-programming-tutorials-part-2-timers.689/
If Input_Name [>/<] ### Then [ON/OFF/Profile_Name/%]
This command is used to measure the reading of a probe, including temperature, pH, ORP, salinity, dissolved oxygen, flow sensor, PAR sensor, Trident alkalinity, Trident calcium, or Trident magnesium.
If Output Output_Name = [ON/OFF] Then [ON/OFF/Profile_Name/%]
This command is used to react to the current state of an output, whether physical or virtual.
If Output Output_Name Percent [>/=/<] ### Then [ON/OFF/Profile_Name/%]
This command is used to react to the current percentage or speed of an output, such as a COR pump, WAV, or VarSpd output. For details, see this Neptune FAQ: https://forum.neptunesystems.com/showthread.php?20677-Using-percentages-in-programming
If Switch_Name [OPEN/CLOSED] Then [ON/OFF/Profile_Name/%]
This command is used to react to either an optical sensor, leak sensor, or a switch connected to a Breakout Box port.
If [FeedA/FeedB/FeedC/FeedD] MMM Then [ON/OFF/Profile_Name/%]
This command sets an output state when a Feed Cycle is activated. The MMM delay extends the output state for a number of minutes beyond the set time of the selected Feed Cycle.
For more details on If Feed, see my tutorial on Apex Feed Cycles: https://www.reef2reef.com/ams/neptune-apex-programming-tutorials-part-7-feed-cycles.715/
If Temp [>/<] [RT+/RT-] [###] Then [ON/OFF/PROFILE/%]
This command is used to set an output state based on the regional temperature defined in the Apex seasonal tables.
For more details on regional temperatures, see page 65 of the Apex Comprehensive Reference Guide: https://www.neptunesystems.com/downloads/docs/Comprehensive_Reference_Manual.pdf
If Sun [+/-] [MMM] / [+/-] [MMM] Then [ON/OFF/Profile_Name/%]
This command is used to set an output state based on the sunrise or sunset cycles defined in the Apex seasonal tables. The first timer is relative to sunrise, and the second timer is relative to sunset. A positive number delays the action to after the event, and a negative number precedes the event.
For more details on If Sun, see page 66 of the Apex Comprehensive Reference Guide: https://www.neptunesystems.com/downloads/docs/Comprehensive_Reference_Manual.pdf
If Moon [+/-] [MMM] / [+/-] [MMM] Then [ON/OFF/Profile_Name/%]
This command is used to set an output state based on the moonrise or moonset cycles defined in the Apex seasonal tables. The first timer is relative to moonrise, and the second timer is relative to moonset. A positive number delays the action to after the event, and a negative number precedes the event.
For more details on If Moon, see page 67 of the Apex Comprehensive Reference Guide: https://www.neptunesystems.com/downloads/docs/Comprehensive_Reference_Manual.pdf
For an example of If Moon usage, see my tutorial on Apex Lunar Schedule and Lighting Profiles: https://www.reef2reef.com/ams/neptu...sion-lunar-schedule-and-lighting-profiles.717
If Output Output_Name [Amps/Watts] [>/<] ### Then [ON/OFF/Profile_Name/%]
This command is used to react to the Amps or Watts currently consumed by an EB832 output. This does not apply to the older EB4, EB6, EB8, or the DC24 accessory outputs of the EB832.
For more details about the Amps/Watts programming, see my tutorial on Apex Power Monitoring: https://www.reef2reef.com/ams/neptune-apex-programming-tutorials-part-4-power-monitoring.698/
If Power [Power Probe] [ON/OFF] [###] Then [ON/OFF/Profile_Name]
This command is used to set an output state based on the detection of a power failure. The [Power Probe] is either the Apex or the name of an attached Energy bar. Note that the If Power command does not support using percentages as documented in this Neptune FAQ: https://forum.neptunesystems.com/showthread.php?20677-Using-percentages-in-programming
For more details on If Power and instructions on how to integrate the Apex with a UPS backup battery, see my tutorial on Apex Power Monitoring: https://www.reef2reef.com/ams/neptune-apex-programming-tutorials-part-4-power-monitoring.698/
OSC MMM:SS/MMM:SS/MMM:SS Then [ON/OFF]
OSC is used to control an output on a repeating schedule. There are 3 timers:
- Initial delay in minutes and seconds
- minutes and seconds of actual run time
- minutes and seconds of trailing delay
OSC 000:00/005:00/005:00 Then ON
This would turn on the output at midnight for 5 minutes, then turn it off for 5 minutes, and repeat indefinitely:
For details and examples of the OSC command, see my tutorial on Apex Timers: https://www.reef2reef.com/ams/neptune-apex-programming-tutorials-part-2-timers.689/
Defer MMM:SS Then [ON/OFF]
Defer delays switching an output from ON to OFF, or from OFF to ON. This command applies to the output after all the conditions have been evaluated. Only one Defer ON and one Defer OFF command can be used on an output. When the output changes from ON to OFF, only the Defer OFF timer is applied. When the output changes from OFF to ON, only the Defer ON timer is applied.
Example:
Set OFF
If Time 10:00 to 10:01 Then ON
Defer 001:00 Then ON
This will cause it to wait until 10:01 to turn on, then turn off at 10:02. effectively giving you a 1 minute timer:
For details and more examples of Defer, see my tutorial on Apex Timers: https://www.reef2reef.com/ams/neptune-apex-programming-tutorials-part-2-timers.689/
Min Time MMM:SS Then [ON/OFF]
Min Time forces an output to remain ON or OFF for a minimum amount of time regardless of the conditions evaluated in the programming. If the output is ON, only the Min Time Then ON timer is applied. If the output is OFF, only the Min Time Then OFF timer is applied.
For more details and examples of Min Time, see my tutorial on Apex Timers: https://www.reef2reef.com/ams/neptune-apex-programming-tutorials-part-2-timers.689/
When [ON/OFF] > MMM:SS Then [ON/OFF]
When is used to switch an output’s tile from AUTO to OFF or ON if a condition is met. This is the only command in the Apex programming language that can physically move an output tile's slider position on the dashboard, and once moved, manual intervention is required to set it back to AUTO before the programming will be resumed.
For more details and examples of When, see https://forum.neptunesystems.com/showthread.php?18393-Using-the-%91When%92-statement
Also see my tutorial on Apex Timers: https://www.reef2reef.com/ams/neptune-apex-programming-tutorials-part-2-timers.689/
If Error Output_Name Then [ON/OFF]
The If Error command will evaluate True if the When timer described above is exceeded. For details about If Error, see https://forum.neptunesystems.com/showthread.php?18393-Using-the-%91When%92-statement
If Error Apex Then [ON/OFF]
The If Error Apex command will evaluate True if a module is disconnected from the Apex. This feature was first introduced in AOS 5.06_5C21 and is only available on the Apex 2016 and Apex-EL. It is particularly useful to add to your EmailAlm programming to send an alert if a module is missing, but may also be used in programming on any output. For details about If Error Apex, see https://forum.neptunesystems.com/showthread.php?31358-AOS-5-06_5C21-has-been-released!
Fallback [ON/OFF/Profile_Name/%]
Fallback is used to set the output state in an AquaBus module when that module loses communications with the Apex.
For more details on Fallback, see https://forum.neptunesystems.com/showthread.php?8510-All-About-FALLBACK