Skip to content

Supported Functions

Built-In Functions~

Average (Last, Multiple)~

This function acquires the last measurement of those that are selected, averages them, then stores the resulting value as the selected measurement and unit.

OptionTypeDescription
Period (Seconds)Decimal - Default Value: 60The duration between measurements or actions
Start Offset (Seconds)Integer - Default Value: 10The duration to wait before the first operation
Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use
MeasurementMeasurement to replace "x" in the equation

Average (Past, Single)~

This function acquires the past measurements (within Max Age) for the selected measurement, averages them, then stores the resulting value as the selected measurement and unit. Note: There is a bug in InfluxDB 1.8.10 that prevents the mean() function from working properly. Therefore, if you are using Influxdb v1.x, the median() function will be used. InfluxDB 2.x is unaffected and uses mean(). To get the true mean, upgrade to InfluxDB 2.x.

OptionTypeDescription
Period (Seconds)Decimal - Default Value: 60The duration between measurements or actions
Start Offset (Seconds)Integer - Default Value: 10The duration to wait before the first operation
MeasurementSelect Measurement (Input, Function)Measurement to replace "x" in the equation
Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use

Backup to Remote Host (rsync)~

This function will use rsync to back up assets on this system to a remote system. Your remote system needs to have an SSH server running and rsync installed. This system will need rsync installed and be able to access your remote system via SSH keyfile (login without a password). You can do this by creating an SSH key on this system running Mycodo with "ssh-keygen" (leave the password field empty), then run "ssh-copy-id -i ~/.ssh/id_rsa.pub pi@REMOTE_HOST_IP" to transfer your public SSH key to your remote system (changing pi and REMOTE_HOST_IP to the appropriate user and host of your remote system). You can test if this worked by trying to connect to your remote system with "ssh pi@REMOTE_HOST_IP" and you should log in without being asked for a password. Be careful not to set the Period too low, which could cause the function to begin running before the previous operation(s) complete. Therefore, it is recommended to set a relatively long Period (greater than 10 minutes). The default Period is 15 days. Note that the Period will reset if the system or the Mycodo daemon restarts and the Function will run, generating new settings and measurement archives that will be synced. There are two common ways to use this Function: 1) A short period (1 hour), only have Backup Camera Directories enabled, and use the Backup Settings Now and Backup Measurements Now buttons manually to perform a backup, and 2) A long period (15 days), only have Backup Settings and Backup Measurements enabled. You can even create two of these Functions with one set up to perform long-Period settings and measurement backups and the other set up to perform short-Period camera backups.

OptionTypeDescription
Period (Seconds)Decimal - Default Value: 1296000The duration between measurements or actions
Start Offset (Seconds)Integer - Default Value: 300The duration to wait before the first operation
Local UserText - Default Value: piThe user on this system that will run rsync
Remote UserText - Default Value: piThe user to log in to the remote host
Remote HostText - Default Value: 192.168.0.50The IP or host address to send the backup to
Remote Backup PathText - Default Value: /home/pi/backup_mycodoThe path to backup to on the remote host
Rsync Timeout (Seconds)Integer - Default Value: 3600How long to allow rsync to complete
Local Backup PathTextA local path to backup (leave blank to disable)
Backup Settings Export FileBoolean - Default Value: TrueCreate and backup exported settings file
Remove Local Settings BackupsBooleanRemove local settings backups after successful transfer to remote host
Backup MeasurementsBoolean - Default Value: TrueBackup all influxdb measurements
Remove Local Measurements BackupsBooleanRemove local measurements backups after successful transfer to remote host
Backup Camera DirectoriesBoolean - Default Value: TrueBackup all camera directories
Remove Local Camera ImagesBooleanRemove local camera images after successful transfer to remote host
SSH PortInteger - Default Value: 22Specify a nonstandard SSH port
Commands
Backup of settings are only created if the Mycodo version or database versions change. This is due to this Function running periodically- if it created a new backup every Period, there would soon be many identical backups. Therefore, if you want to induce the backup of settings, measurements, or camera directories and sync them to your remote system, use the buttons below.
Backup Settings NowButton
Backup Measurements NowButton
Backup Camera Directories NowButton

Bang-Bang Hysteretic (On/Off) (Raise/Lower)~

A simple bang-bang control for controlling one output from one input. Select an input, an output, enter a setpoint and a hysteresis, and select a direction. The output will turn on when the input is below (lower = setpoint - hysteresis) and turn off when the input is above (higher = setpoint + hysteresis). This is the behavior when Raise is selected, such as when heating. Lower direction has the opposite behavior - it will try to turn the output on in order to drive the input lower.

OptionTypeDescription
MeasurementSelect Measurement (Input, Function)Select a measurement the selected output will affect
Measurement: Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use
OutputSelect Device, Measurement, and Channel (Output)Select an output to control that will affect the measurement
SetpointDecimal - Default Value: 50The desired setpoint
HysteresisDecimal - Default Value: 1The amount above and below the setpoint that defines the control band
DirectionSelect(Options: [Raise | Lower] (Default in bold)Raise means the measurement will increase when the control is on (heating). Lower means the measurement will decrease when the output is on (cooling)
Period (Seconds)Decimal - Default Value: 5The duration between measurements or actions

Bang-Bang Hysteretic (On/Off) (Raise/Lower/Both)~

A simple bang-bang control for controlling one or two outputs from one input. Select an input, a raise and/or lower output, enter a setpoint and a hysteresis, and select a direction. The output will turn on when the input is below (lower = setpoint - hysteresis) and turn off when the input is above (higher = setpoint + hysteresis). This is the behavior when Raise is selected, such as when heating. Lower direction has the opposite behavior - it will try to turn the output on in order to drive the input lower. The Both option will raise and lower. Note: This output will only work with On/Off Outputs.

OptionTypeDescription
MeasurementSelect Measurement (Input, Function)Select a measurement the selected output will affect
Measurement: Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use
Output (Raise)Select Device, Measurement, and Channel (Output)Select an output to control that will raise the measurement
Output (Lower)Select Device, Measurement, and Channel (Output)Select an output to control that will lower the measurement
SetpointDecimal - Default Value: 50The desired setpoint
HysteresisDecimal - Default Value: 1The amount above and below the setpoint that defines the control band
DirectionSelect(Options: [Raise | Lower | Both] (Default in bold)Raise means the measurement will increase when the control is on (heating). Lower means the measurement will decrease when the output is on (cooling)
Period (Seconds)Decimal - Default Value: 5The duration between measurements or actions

Bang-Bang Hysteretic (PWM) (Raise/Lower/Both)~

A simple bang-bang control for controlling one PWM output from one input. Select an input, a PWM output, enter a setpoint and a hysteresis, and select a direction. The output will turn on when the input is below below (lower = setpoint - hysteresis) and turn off when the input is above (higher = setpoint + hysteresis). This is the behavior when Raise is selected, such as when heating. Lower direction has the opposite behavior - it will try to turn the output on in order to drive the input lower. The Both option will raise and lower. Note: This output will only work with PWM Outputs.

OptionTypeDescription
MeasurementSelect Measurement (Input, Function)Select a measurement the selected output will affect
Measurement: Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use
OutputSelect Device, Measurement, and Channel (Output)Select an output to control that will affect the measurement
SetpointDecimal - Default Value: 50The desired setpoint
HysteresisDecimal - Default Value: 1The amount above and below the setpoint that defines the control band
DirectionSelect(Options: [Raise | Lower | Both] (Default in bold)Raise means the measurement will increase when the control is on (heating). Lower means the measurement will decrease when the output is on (cooling)
Period (Seconds)Decimal - Default Value: 5The duration between measurements or actions
Duty Cycle (increase)Decimal - Default Value: 90The duty cycle to increase the measurement
Duty Cycle (maintain)Decimal - Default Value: 55The duty cycle to maintain the measurement
Duty Cycle (decrease)Decimal - Default Value: 20The duty cycle to decrease the measurement
Duty Cycle (shutdown)DecimalThe duty cycle to set when the function shuts down

Camera: libcamera: Image/Video~

NOTE: THIS IS CURRENTLY EXPERIMENTAL - USE AT YOUR OWN RISK UNTIL THIS NOTICE IS REMOVED. Capture images and videos from a camera using libcamera-still and libcamera-vid. The Function must be activated in order to capture still and timelapse images and use the Camera Widget.

OptionTypeDescription
Status Period (seconds)Integer - Default Value: 60The duration (seconds) to update the Function status on the UI
Image options.
Custom Image PathTextSet a non-default path for still images to be saved
Custom Timelapse PathTextSet a non-default path for timelapse images to be saved
Image ExtensionSelect(Options: [JPG | PNG | BMP | RGB | YUV420] (Default in bold)The file type/format to save images
Image: Resolution: WidthInteger - Default Value: 720The width of still images
Image: Resolution: HeightInteger - Default Value: 480The height of still images
BrightnessDecimalThe brightness of still images (-1 to 1)
Image: ContrastDecimal - Default Value: 1.0The contrast of still images. Larger values produce images with more contrast.
SaturationDecimal - Default Value: 1.0The saturation of still images. Larger values produce more saturated colours; 0.0 produces a greyscale image.
SharpnessDecimalThe sharpness of still images. Larger values produce more saturated colours; 0.0 produces a greyscale image.
Shutter Speed (Microseconds)IntegerThe shutter speed, in microseconds. 0 disables and returns to auto exposure.
GainDecimal - Default Value: 1.0The gain of still images.
White Balance: AutoSelect(Options: [Auto | Incandescent | Tungsten | Fluorescent | Indoor | Daylight | Cloudy | Custom] (Default in bold)The white balance of images
White Balance: Red GainDecimalThe red gain of white balance for still images (disabled Auto White Balance if red and blue are not set to 0)
White Balance: Blue GainDecimalThe red gain of white balance for still images (disabled Auto White Balance if red and blue are not set to 0)
Flip HorizontallyBooleanFlip the image horizontally.
Flip VerticallyBooleanFlip the image vertically.
Rotate (Degrees)IntegerRotate the image.
Custom libcamera-still OptionsTextPass custom options to the libcamera-still command.
Video options.
Custom Video PathTextSet a non-default path for videos to be saved
Video ExtensionSelect(Options: [H264 -> MP4 (with ffmpeg) | H264 | MJPEG | YUV420] (Default in bold)The file type/format to save videos
Video: Resolution: WidthInteger - Default Value: 720The width of videos
Video: Resolution: HeightInteger - Default Value: 480The height of videos
Custom libcamera-vid OptionsTextPass custom options to the libcamera-vid command.
Commands
Capture ImageButton
To capture a video, enter the duration and press Capture Video.
Video Duration (Seconds)Integer - Default Value: 5How long to record the video
Capture VideoButton
To start a timelapse, enter the duration and period and press Start Timelapse.
Timelapse Duration (Seconds)Integer - Default Value: 2592000How long the timelapse will run
Timelapse Period (Seconds)Integer - Default Value: 600How often to take a timelapse photo
Start TimelapseButton
To stop an active timelapse, press Stop Timelapse.
Stop TimelapseButton
To pause or resume an active timelapse, press Pause Timelapse or Resume Timelapse.
Pause TimelapseButton
Resume TimelapseButton

Difference~

This function acquires 2 measurements, calculates the difference, and stores the resulting value as the selected measurement and unit.

OptionTypeDescription
Period (Seconds)Decimal - Default Value: 60The duration between measurements or actions
Measurement: ASelect Measurement (Input, Function)
Measurement A: Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use
Measurement: BSelect Measurement (Input, Function)
Measurement B: Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use
Reverse OrderBooleanReverse the order in the calculation
Absolute DifferenceBooleanReturn the absolute value of the difference

Display: Generic LCD 16x2 (I2C)~

This Function outputs to a generic 16x2 LCD display via I2C. Since this display can show 2 lines at a time, channels are added in sets of 2 when Number of Line Sets is modified. Every Period, the LCD will refresh and display the next set of lines. Therefore, the first 2 lines that are displayed are channels 0 and 1, then 2 and 3, and so on. After all channels have been displayed, it will cycle back to the beginning.

OptionTypeDescription
Period (Seconds)Decimal - Default Value: 10The duration between measurements or actions
I2C AddressText - Default Value: 0x20
I2C BusInteger - Default Value: 1
Number of Line SetsInteger - Default Value: 1How many sets of lines to cycle on the LCD
Channel Options
Line Display TypeSelectWhat to display on the line
MeasurementSelect Measurement (Input, Function, Output, PID)Measurement to display on the line
Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use
Measurement LabelTextSet to overwrite the default measurement label
Measurement DecimalInteger - Default Value: 1The number of digits after the decimal
TextText - Default Value: TextText to display
Display UnitBoolean - Default Value: TrueDisplay the measurement unit (if available)
Commands
Backlight OnButton
Backlight OffButton
Backlight Flashing OnButton
Backlight Flashing OffButton

Display: Generic LCD 20x4 (I2C)~

This Function outputs to a generic 20x4 LCD display via I2C. Since this display can show 4 lines at a time, channels are added in sets of 4 when Number of Line Sets is modified. Every Period, the LCD will refresh and display the next set of lines. Therefore, the first 4 lines that are displayed are channels 0, 1, 2, and 3, then 4, 5, 6, and 7, and so on. After all channels have been displayed, it will cycle back to the beginning.

OptionTypeDescription
Period (Seconds)Decimal - Default Value: 10The duration between measurements or actions
I2C AddressText - Default Value: 0x20
I2C BusInteger - Default Value: 1
Number of Line SetsInteger - Default Value: 1How many sets of lines to cycle on the LCD
Channel Options
Line Display TypeSelectWhat to display on the line
MeasurementSelect Measurement (Input, Function, Output, PID)Measurement to display on the line
Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use
Measurement LabelTextSet to overwrite the default measurement label
Measurement DecimalInteger - Default Value: 1The number of digits after the decimal
TextText - Default Value: TextText to display
Display UnitBoolean - Default Value: TrueDisplay the measurement unit (if available)
Commands
Backlight OnButton
Backlight OffButton

Display: Grove LCD 16x2 (I2C)~

This Function outputs to the Grove 16x2 LCD display via I2C. Since this display can show 2 lines at a time, channels are added in sets of 2 when Number of Line Sets is modified. Every Period, the LCD will refresh and display the next set of lines. Therefore, the first 2 lines that are displayed are channels 0 and 1, then 2 and 3, and so on. After all channels have been displayed, it will cycle back to the beginning.

OptionTypeDescription
Period (Seconds)Decimal - Default Value: 10The duration between measurements or actions
I2C AddressText - Default Value: 0x3e
I2C BusInteger - Default Value: 1
Backlight I2C AddressText - Default Value: 0x62I2C address to control the backlight
Number of Line SetsInteger - Default Value: 1How many sets of lines to cycle on the LCD
Backlight Red (0 - 255)Integer - Default Value: 255Set the red color value of the backlight on startup.
Backlight Green (0 - 255)Integer - Default Value: 255Set the green color value of the backlight on startup.
Backlight Blue (0 - 255)Integer - Default Value: 255Set the blue color value of the backlight on startup.
Channel Options
Line Display TypeSelectWhat to display on the line
MeasurementSelect Measurement (Input, Function, Output, PID)Measurement to display on the line
Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use
Measurement LabelTextSet to overwrite the default measurement label
Measurement DecimalInteger - Default Value: 1The number of digits after the decimal
TextText - Default Value: TextText to display
Display UnitBoolean - Default Value: TrueDisplay the measurement unit (if available)
Commands
Backlight OnButton
Backlight OffButton
Color (RGB)Text - Default Value: 255,0,0Color as R,G,B values (e.g. "255,0,0" without quotes)
Set Backlight ColorButton

Display: SSD1306 OLED 128x32 [2 Lines] (I2C)~

This Function outputs to a 128x32 SSD1306 OLED display via I2C. This display Function will show 2 lines at a time, so channels are added in sets of 2 when Number of Line Sets is modified. Every Period, the LCD will refresh and display the next set of lines. Therefore, the first set of lines that are displayed are channels 0 - 1, then 2 - 3, and so on. After all channels have been displayed, it will cycle back to the beginning.

OptionTypeDescription
Period (Seconds)Decimal - Default Value: 10The duration between measurements or actions
I2C AddressText - Default Value: 0x3c
I2C BusInteger - Default Value: 1
Number of Line SetsInteger - Default Value: 1How many sets of lines to cycle on the LCD
Reset PinInteger - Default Value: 17The pin (BCM numbering) connected to RST of the display
Characters Per LineInteger - Default Value: 17The maximum number of characters to display per line
Use Non-Default FontBooleanDon't use the default font. Enable to specify the path to a font to use.
Non-Default Font PathText - Default Value: /usr/share/fonts/truetype/dejavu//DejaVuSans.ttfThe path to the non-default font to use
Font Size (pt)Integer - Default Value: 12The size of the font, in points
Channel Options
Line Display TypeSelectWhat to display on the line
MeasurementSelect Measurement (Input, Function, Output, PID)Measurement to display on the line
Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use
Measurement LabelTextSet to overwrite the default measurement label
Measurement DecimalInteger - Default Value: 1The number of digits after the decimal
TextText - Default Value: TextText to display
Display UnitBoolean - Default Value: TrueDisplay the measurement unit (if available)

Display: SSD1306 OLED 128x32 [2 Lines] (SPI)~

This Function outputs to a 128x32 SSD1306 OLED display via SPI. This display Function will show 2 lines at a time, so channels are added in sets of 2 when Number of Line Sets is modified. Every Period, the LCD will refresh and display the next set of lines. Therefore, the first set of lines that are displayed are channels 0 - 1, then 2 - 3, and so on. After all channels have been displayed, it will cycle back to the beginning.

OptionTypeDescription
Period (Seconds)Decimal - Default Value: 10The duration between measurements or actions
Number of Line SetsInteger - Default Value: 1How many sets of lines to cycle on the LCD
SPI DeviceIntegerThe SPI device
SPI BusIntegerThe SPI bus
DC PinInteger - Default Value: 16The pin (BCM numbering) connected to DC of the display
Reset PinInteger - Default Value: 19The pin (BCM numbering) connected to RST of the display
CS PinInteger - Default Value: 17The pin (BCM numbering) connected to CS of the display
Characters Per LineInteger - Default Value: 17The maximum number of characters to display per line
Use Non-Default FontBooleanDon't use the default font. Enable to specify the path to a font to use.
Non-Default Font PathText - Default Value: /usr/share/fonts/truetype/dejavu//DejaVuSans.ttfThe path to the non-default font to use
Font Size (pt)Integer - Default Value: 12The size of the font, in points
Channel Options
Line Display TypeSelectWhat to display on the line
MeasurementSelect Measurement (Input, Function, Output, PID)Measurement to display on the line
Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use
Measurement LabelTextSet to overwrite the default measurement label
Measurement DecimalInteger - Default Value: 1The number of digits after the decimal
TextText - Default Value: TextText to display
Display UnitBoolean - Default Value: TrueDisplay the measurement unit (if available)

Display: SSD1306 OLED 128x32 [4 Lines] (I2C)~

This Function outputs to a 128x32 SSD1306 OLED display via I2C. This display Function will show 4 lines at a time, so channels are added in sets of 4 when Number of Line Sets is modified. Every Period, the LCD will refresh and display the next set of lines. Therefore, the first set of lines that are displayed are channels 0 - 3, then 4 - 7, and so on. After all channels have been displayed, it will cycle back to the beginning.

OptionTypeDescription
Period (Seconds)Decimal - Default Value: 10The duration between measurements or actions
I2C AddressText - Default Value: 0x3c
I2C BusInteger - Default Value: 1
Number of Line SetsInteger - Default Value: 1How many sets of lines to cycle on the LCD
Reset PinInteger - Default Value: 17The pin (BCM numbering) connected to RST of the display
Characters Per LineInteger - Default Value: 21The maximum number of characters to display per line
Use Non-Default FontBooleanDon't use the default font. Enable to specify the path to a font to use.
Non-Default Font PathText - Default Value: /usr/share/fonts/truetype/dejavu//DejaVuSans.ttfThe path to the non-default font to use
Font Size (pt)Integer - Default Value: 10The size of the font, in points
Channel Options
Line Display TypeSelectWhat to display on the line
MeasurementSelect Measurement (Input, Function, Output, PID)Measurement to display on the line
Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use
Measurement LabelTextSet to overwrite the default measurement label
Measurement DecimalInteger - Default Value: 1The number of digits after the decimal
TextText - Default Value: TextText to display
Display UnitBoolean - Default Value: TrueDisplay the measurement unit (if available)

Display: SSD1306 OLED 128x32 [4 Lines] (SPI)~

This Function outputs to a 128x32 SSD1306 OLED display via SPI. This display Function will show 4 lines at a time, so channels are added in sets of 4 when Number of Line Sets is modified. Every Period, the LCD will refresh and display the next set of lines. Therefore, the first set of lines that are displayed are channels 0 - 3, then 4 - 7, and so on. After all channels have been displayed, it will cycle back to the beginning.

OptionTypeDescription
Period (Seconds)Decimal - Default Value: 10The duration between measurements or actions
Number of Line SetsInteger - Default Value: 1How many sets of lines to cycle on the LCD
SPI DeviceIntegerThe SPI device
SPI BusIntegerThe SPI bus
DC PinInteger - Default Value: 16The pin (BCM numbering) connected to DC of the display
Reset PinInteger - Default Value: 19The pin (BCM numbering) connected to RST of the display
CS PinInteger - Default Value: 17The pin (BCM numbering) connected to CS of the display
Characters Per LineInteger - Default Value: 21The maximum number of characters to display per line
Use Non-Default FontBooleanDon't use the default font. Enable to specify the path to a font to use.
Non-Default Font PathText - Default Value: /usr/share/fonts/truetype/dejavu//DejaVuSans.ttfThe path to the non-default font to use
Font Size (pt)Integer - Default Value: 10The size of the font, in points
Display UnitBoolean - Default Value: TrueDisplay the measurement unit (if available)
Channel Options
Line Display TypeSelectWhat to display on the line
MeasurementSelect Measurement (Input, Function, Output, PID)Measurement to display on the line
Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use
Measurement LabelTextSet to overwrite the default measurement label
Measurement DecimalInteger - Default Value: 1The number of digits after the decimal
TextText - Default Value: TextText to display
Display UnitBoolean - Default Value: TrueDisplay the measurement unit (if available)

Display: SSD1306 OLED 128x64 [4 Lines] (I2C)~

This Function outputs to a 128x64 SSD1306 OLED display via I2C. This display Function will show 4 lines at a time, so channels are added in sets of 4 when Number of Line Sets is modified. Every Period, the LCD will refresh and display the next set of lines. Therefore, the first set of lines that are displayed are channels 0 - 3, then 4 - 7, and so on. After all channels have been displayed, it will cycle back to the beginning.

OptionTypeDescription
Period (Seconds)Decimal - Default Value: 10The duration between measurements or actions
I2C AddressText - Default Value: 0x3c
I2C BusInteger - Default Value: 1
Number of Line SetsInteger - Default Value: 1How many sets of lines to cycle on the LCD
Reset PinInteger - Default Value: 17The pin (BCM numbering) connected to RST of the display
Characters Per LineInteger - Default Value: 17The maximum number of characters to display per line
Use Non-Default FontBooleanDon't use the default font. Enable to specify the path to a font to use.
Non-Default Font PathText - Default Value: /usr/share/fonts/truetype/dejavu//DejaVuSans.ttfThe path to the non-default font to use
Font Size (pt)Integer - Default Value: 12The size of the font, in points
Channel Options
Line Display TypeSelectWhat to display on the line
MeasurementSelect Measurement (Input, Function, Output, PID)Measurement to display on the line
Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use
Measurement LabelTextSet to overwrite the default measurement label
Measurement DecimalInteger - Default Value: 1The number of digits after the decimal
TextText - Default Value: TextText to display
Display UnitBoolean - Default Value: TrueDisplay the measurement unit (if available)

Display: SSD1306 OLED 128x64 [4 Lines] (SPI)~

This Function outputs to a 128x64 SSD1306 OLED display via SPI. This display Function will show 4 lines at a time, so channels are added in sets of 4 when Number of Line Sets is modified. Every Period, the LCD will refresh and display the next set of lines. Therefore, the first set of lines that are displayed are channels 0 - 3, then 4 - 7, and so on. After all channels have been displayed, it will cycle back to the beginning.

OptionTypeDescription
Period (Seconds)Decimal - Default Value: 10The duration between measurements or actions
Number of Line SetsInteger - Default Value: 1How many sets of lines to cycle on the LCD
SPI DeviceIntegerThe SPI device
SPI BusIntegerThe SPI bus
DC PinInteger - Default Value: 16The pin (BCM numbering) connected to DC of the display
Reset PinInteger - Default Value: 19The pin (BCM numbering) connected to RST of the display
CS PinInteger - Default Value: 17The pin (BCM numbering) connected to CS of the display
Characters Per LineInteger - Default Value: 17The maximum number of characters to display per line
Use Non-Default FontBooleanDon't use the default font. Enable to specify the path to a font to use.
Non-Default Font PathText - Default Value: /usr/share/fonts/truetype/dejavu//DejaVuSans.ttfThe path to the non-default font to use
Font Size (pt)Integer - Default Value: 12The size of the font, in points
Channel Options
Line Display TypeSelectWhat to display on the line
MeasurementSelect Measurement (Input, Function, Output, PID)Measurement to display on the line
Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use
Measurement LabelTextSet to overwrite the default measurement label
Measurement DecimalInteger - Default Value: 1The number of digits after the decimal
TextText - Default Value: TextText to display
Display UnitBoolean - Default Value: TrueDisplay the measurement unit (if available)

Display: SSD1306 OLED 128x64 [8 Lines] (I2C)~

This Function outputs to a 128x64 SSD1306 OLED display via I2C. This display Function will show 8 lines at a time, so channels are added in sets of 8 when Number of Line Sets is modified. Every Period, the LCD will refresh and display the next set of lines. Therefore, the first set of lines that are displayed are channels 0 - 7, then 8 - 15, and so on. After all channels have been displayed, it will cycle back to the beginning.

OptionTypeDescription
Period (Seconds)Decimal - Default Value: 10The duration between measurements or actions
I2C AddressText - Default Value: 0x3c
I2C BusInteger - Default Value: 1
Number of Line SetsInteger - Default Value: 1How many sets of lines to cycle on the LCD
Reset PinInteger - Default Value: 17The pin (BCM numbering) connected to RST of the display
Characters Per LineInteger - Default Value: 21The maximum number of characters to display per line
Use Non-Default FontBooleanDon't use the default font. Enable to specify the path to a font to use.
Non-Default Font PathText - Default Value: /usr/share/fonts/truetype/dejavu//DejaVuSans.ttfThe path to the non-default font to use
Font Size (pt)Integer - Default Value: 10The size of the font, in points
Channel Options
Line Display TypeSelectWhat to display on the line
MeasurementSelect Measurement (Input, Function, Output, PID)Measurement to display on the line
Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use
Measurement LabelTextSet to overwrite the default measurement label
Measurement DecimalInteger - Default Value: 1The number of digits after the decimal
TextText - Default Value: TextText to display
Display UnitBoolean - Default Value: TrueDisplay the measurement unit (if available)

Display: SSD1306 OLED 128x64 [8 Lines] (SPI)~

This Function outputs to a 128x64 SSD1306 OLED display via SPI. This display Function will show 8 lines at a time, so channels are added in sets of 8 when Number of Line Sets is modified. Every Period, the LCD will refresh and display the next set of lines. Therefore, the first set of lines that are displayed are channels 0 - 7, then 8 - 15, and so on. After all channels have been displayed, it will cycle back to the beginning.

OptionTypeDescription
Period (Seconds)Decimal - Default Value: 10The duration between measurements or actions
Number of Line SetsInteger - Default Value: 1How many sets of lines to cycle on the LCD
SPI DeviceIntegerThe SPI device
SPI BusIntegerThe SPI bus
DC PinInteger - Default Value: 16The pin (BCM numbering) connected to DC of the display
Reset PinInteger - Default Value: 19The pin (BCM numbering) connected to RST of the display
CS PinInteger - Default Value: 17The pin (BCM numbering) connected to CS of the display
Characters Per LineInteger - Default Value: 21The maximum number of characters to display per line
Use Non-Default FontBooleanDon't use the default font. Enable to specify the path to a font to use.
Non-Default Font PathText - Default Value: /usr/share/fonts/truetype/dejavu//DejaVuSans.ttfThe path to the non-default font to use
Font Size (pt)Integer - Default Value: 10The size of the font, in points
Channel Options
Line Display TypeSelectWhat to display on the line
MeasurementSelect Measurement (Input, Function, Output, PID)Measurement to display on the line
Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use
Measurement LabelTextSet to overwrite the default measurement label
Measurement DecimalInteger - Default Value: 1The number of digits after the decimal
TextText - Default Value: TextText to display
Display UnitBoolean - Default Value: TrueDisplay the measurement unit (if available)

Display: SSD1309 OLED 128x64 [8 Lines] (I2C)~

This Function outputs to a 128x64 SSD1309 OLED display via I2C. This display Function will show 8 lines at a time, so channels are added in sets of 8 when Number of Line Sets is modified. Every Period, the LCD will refresh and display the next set of lines. Therefore, the first set of lines that are displayed are channels 0 - 7, then 8 - 15, and so on. After all channels have been displayed, it will cycle back to the beginning.

OptionTypeDescription
Period (Seconds)Decimal - Default Value: 10The duration between measurements or actions
I2C AddressText - Default Value: 0x3c
I2C BusInteger - Default Value: 1
Number of Line SetsInteger - Default Value: 1How many sets of lines to cycle on the LCD
Reset PinInteger - Default Value: 17The pin (BCM numbering) connected to RST of the display
Channel Options
Line Display TypeSelectWhat to display on the line
MeasurementSelect Measurement (Input, Function, Output, PID)Measurement to display on the line
Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use
Measurement LabelTextSet to overwrite the default measurement label
Measurement DecimalInteger - Default Value: 1The number of digits after the decimal
TextText - Default Value: TextText to display
Display UnitBoolean - Default Value: TrueDisplay the measurement unit (if available)

Equation (Multi-Measure)~

This function acquires two measurements and uses them within a user-set equation and stores the resulting value as the selected measurement and unit.

OptionTypeDescription
Period (Seconds)Decimal - Default Value: 60The duration between measurements or actions
Measurement: ASelect Measurement (Input, Output, Function)Measurement to replace a
Measurement A: Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use
Measurement: BSelect Measurement (Input, Output, Function)Measurement to replace b
Measurement B: Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use
EquationText - Default Value: a*(2+b)Equation using measurements a and b

Equation (Single-Measure)~

This function acquires a measurement and uses it within a user-set equation and stores the resulting value as the selected measurement and unit.

OptionTypeDescription
Period (Seconds)Decimal - Default Value: 60The duration between measurements or actions
MeasurementSelect Measurement (Input, Output, Function)Measurement to replace "x" in the equation
Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use
EquationText - Default Value: x*5+2Equation using the measurement

Example: Generic~

This is an example Function Module that showcases all the different type of UI options. It is not useful beyond showing how to develop new custom Function modules.This message will appear above the Function options. It will retrieve the last selected measurement, turn the selected output on for 15 seconds, then deactivate itself. Study the code to develop your own Function Module that can be imported on the Function Import page.

OptionTypeDescription
Period (Seconds)Decimal - Default Value: 60The duration between measurements or actions
The following fields are for text, integers, and decimal inputs. This message will automatically create a new line for the options that come after it. Alternatively, a new line can be created instead without a message, which are what separates each of the following three inputs.
Text InputText - Default Value: Text_1Type in text
Integer InputInteger - Default Value: 100Type in an Integer
Devimal InputDecimal - Default Value: 50.2Type in a decimal value
A boolean value can be made using a checkbox.
Boolean ValueBoolean - Default Value: TrueSet to either True (checked) or False (Unchecked)
A dropdown selection can be made of any user-defined options, with any of the options selected by default when the Function is added by the user.
Select OptionSelect(Options: [First Option Selected | Second Option Selected | Third Option Selected] (Default in bold)Select an option from the dropdown
A specific measurement from an Input, Function, or PID Controller can be selected. The following dropdown will be populated if at least one Input, Function, or PID Controller has been created (as long as the Function has measurements, e.g. Statistics Function).
Controller MeasurementSelect Measurement (Input, Function, PID)Select a controller Measurement
An output channel measurement can be selected that will return the Output ID, Channel ID, and Measurement ID. This is useful if you need more than just the Output and Channel IDs and require the user to select the specific Measurement of a channel.
Output Channel MeasurementSelect Device, Measurement, and Channel (Output)Select an output channel and measurement
An output can be selected that will return the Output ID if only the output ID is needed.
Output DeviceSelect DeviceSelect an Output device
An Input, Output, Function, PID, or Trigger can be selected that will return the ID if only the controller ID is needed (e.g. for activating/deactivating a controller)
Controller DeviceSelect DeviceSelect an Input/Output/Function/PID/Trigger controller
Commands
Button One will pass the Button One Value to the button_one() function of this module. This allows functions to be executed with user-specified inputs. These can be text, integers, decimals, or boolean values.
Button One ValueInteger - Default Value: 650Value for button one.
Button OneButton
Here is another action with another user input that will be passed to the function. Note that Button One Value will also be passed to this second function, so be sure to use unique ids for each input.
Button Two ValueInteger - Default Value: 1500Value for button two.
Button TwoButton

Humidity (Wet/Dry-Bulb)~

This function calculates the humidity based on wet and dry bulb temperature measurements.

OptionTypeDescription
Measurements EnabledMulti-SelectThe measurements to record
Period (Seconds)Decimal - Default Value: 60The duration between measurements or actions
Start Offset (Seconds)Integer - Default Value: 10The duration to wait before the first operation
Dry Bulb TemperatureSelect Measurement (Input, Function)Dry Bulb temperature measurement
Dry Bulb: Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use
Wet Bulb TemperatureSelect Measurement (Input, Function)Wet Bulb temperature measurement
Wet Bulb: Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use
PressureSelect Measurement (Input, Function)Pressure measurement
Pressure: Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use

Neokey 4x1 Neopixel Keyboard (Execute Actions)~

This Function executes actions when a key is pressed. Add actions at the bottom of this module, then enter one or more short action IDs for each key, separated by commas. The Action ID is found next to the Action (for example, the Action "[Action 0559689e] Controller: Activate" has an Action ID of 0559689e. When entering Action ID(s), separate multiple IDs by commas (for example, "asdf1234" or "asdf1234,qwer5678,zxcv0987"). Actions will be executed in the order they are entered in the text string. Enter Action IDs to execute those actions when the key is pressed. If enable Toggling Actions, every other key press will execute Actions listed in Toggled Action IDs. The LED color of the key before being pressed, after being pressed, and while the last action is running. Color is an RGB string, with 0-255 for each color. For example, red is "255, 0, 0" and blue is "0, 0, 255".

OptionTypeDescription
I2C AddressText - Default Value: 0x30
I2C BusInteger - Default Value: 1
LED Brightness (0.0-1.0)Decimal - Default Value: 0.2The brightness of the LEDs
LED Flash Period (Seconds)Decimal - Default Value: 1.0Set the period if the LED begins flashing
Channel Options
NameTextA name to distinguish this from others
LED Delay (Seconds)Decimal - Default Value: 1.5How long to leave the LED on after the last action executes.
Action ID(s)TextSet which action(s) execute when the key is pressed. Enter one or more Action IDs, separated by commas
Enable Toggling ActionsBooleanAlternate between executing two sets of Actions
Toggled Action ID(s)TextSet which action(s) execute when the key is pressed on even presses. Enter one or more Action IDs, separated by commas
Resting LED Color (RGB)Text - Default Value: 0, 0, 0The RGB color while no actions are running (e.g 10, 0, 0)
Actions Running LED Color: (RGB)Text - Default Value: 0, 255, 0The RGB color while all but the last action is running (e.g 10, 0, 0)
Last Action LED Color (RGB)Text - Default Value: 0, 0, 255The RGB color while the last action is running (e.g 10, 0, 0)
Shutdown LED Color (RGB)Text - Default Value: 0, 0, 0The RGB color when the Function is disabled (e.g 10, 0, 0)

PID Autotune~

This function will attempt to perform a PID controller autotune. That is, an output will be powered and the response measured from a sensor several times to calculate the P, I, and D gains. Updates about the operation will be sent to the Daemon log. If the autotune successfully completes, a summary will be sent to the Daemon log as well. Currently, only raising a Measurement is supported, but lowering should be possible with some modification to the function controller code. It is recommended to create a graph on a dashboard with the Measurement and Output to monitor that the Output is successfully raising the Measurement beyond the Setpoint. Note: Autotune is an experimental feature, it is not well-developed, and it has a high likelihood of failing to generate PID gains. Do not rely on it for accurately tuning your PID controller.

OptionTypeDescription
MeasurementSelect Measurement (Input, Function)Select a measurement the selected output will affect
OutputSelect Device, Measurement, and Channel (Output)Select an output to modulate that will affect the measurement
PeriodInteger - Default Value: 30The period between powering the output
SetpointDecimal - Default Value: 50A value sufficiently far from the current measured value that the output is capable of pushing the measurement toward
Noise BandDecimal - Default Value: 0.5The amount above the setpoint the measurement must reach
OutstepDecimal - Default Value: 10How many seconds the output will turn on every Period
Currently, only autotuning to raise a condition (measurement) is supported.
DirectionSelect(Options: [Raise] (Default in bold)The direction the Output will push the Measurement

Redundancy~

This function stores the first available measurement. This is useful if you have multiple sensors that you want to serve as backups in case one stops working, you can set them up in the order of importance. This function will check if a measurement exits, starting with the first measurement. If it doesn't, the next is checked, until a measurement is found. Once a measurement is found, it is stored in the database with the user-set measurement and unit. The output of this function can be used as an input throughout Mycodo. If you need more than 3 measurements to be checked, you can string multiple Redundancy Functions by creating a second Function and setting the first Function's output as the second Function's input.

OptionTypeDescription
Period (Seconds)Decimal - Default Value: 60The duration between measurements or actions
Measurement ASelect Measurement (Input, Function)Measurement to replace a
Measurement A: Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use
Measurement BSelect Measurement (Input, Function)Measurement to replace b
Measurement B: Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use
Measurement CSelect Measurement (Input, Function)Measurement to replace C
Measurement C: Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use

Regulate pH and Electrical Conductivity~

This function regulates pH with 2 pumps (acid and base solutions) and electrical conductivity (EC) with up to 4 pumps (nutrient solutions A, B, C, and D). Set only the nutrient solution outputs you want to use. Any outputs not set will not dispense when EC is being adjusted, allowing as few as 1 pump or as many as 4 pumps. Outputs can be instructed to turn on for durations (seconds) or volumes (ml). Set each Output Type to the correct type for each selected Output Channel (only select on/off Output Channels for durations and volume Output Channels for volumes). The ratio of nutrient solutions being dispensed is defined by the duration or volume set for each EC output.
If an e-mail address (or multiple addresses separated by commas) is entered into the E-Mail Notification field, a notification e-mail will be sent if 1) pH is outside the set danger range, 2) EC is too high and water needs to be added to the reservoir, or 3) a measurement could not be found in the database for the specific Max Age. Each e-mail notification type has its own timer that prevents e-mail spam, and will only allow sending for each notification type every set E-Mail Timer Duration. After this duration, the timer will automatically reset to allow new notifications to be sent. You may also manually reset e-mail timers at any time with the Custom Commands, below.
When the Function is active, Status text will appear below indicating the regulation information and total duration/volume for each output.

OptionTypeDescription
Period (Seconds)Decimal - Default Value: 300The duration between measurements or actions
Start Offset (Seconds)Integer - Default Value: 10The duration to wait before the first operation
Status Period (seconds)Integer - Default Value: 60The duration (seconds) to update the Function status on the UI
Measurement Options
pH MeasurementSelect Measurement (Input, Function)Measurement from the pH input
pH: Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use
EC MeasurementSelect Measurement (Input, Function)Measurement from the EC input
Electrical Conductivity: Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use
Output Options
Output: pH Dose Raise (Base)Select Channel (Output_Channels)Select an output to raise the pH
Output: pH Dose Lower (Acid)Select Channel (Output_Channels)Select an output to lower the pH
pH Output TypeSelect(Options: [Duration (seconds) | Volume (ml)] (Default in bold)Select the output type for the selected Output Channel
pH Output AmountDecimal - Default Value: 2.0The amount to send to the pH dosing pumps (duration or volume)
Output: EC Dose Nutrient ASelect Channel (Output_Channels)Select an output to dose nutrient A
Nutrient A Output TypeSelect(Options: [Duration (seconds) | Volume (ml)] (Default in bold)Select the output type for the selected Output Channel
Nutrient A Output AmountDecimal - Default Value: 2.0The amount to send to the Nutrient A dosing pump (duration or volume)
Output: EC Dose Nutrient BSelect Channel (Output_Channels)Select an output to dose nutrient B
Nutrient B Output TypeSelect(Options: [Duration (seconds) | Volume (ml)] (Default in bold)Select the output type for the selected Output Channel
Nutrient B Output AmountDecimal - Default Value: 2.0The amount to send to the Nutrient B dosing pump (duration or volume)
Output: EC Dose Nutrient CSelect Channel (Output_Channels)Select an output to dose nutrient C
Nutrient C Output TypeSelect(Options: [Duration (seconds) | Volume (ml)] (Default in bold)Select the output type for the selected Output Channel
Nutrient C Output AmountDecimal - Default Value: 2.0The amount to send to the Nutrient C dosing pump (duration or volume)
Output: EC Dose Nutrient DSelect Channel (Output_Channels)Select an output to dose nutrient D
Nutrient D Output TypeSelect(Options: [Duration (seconds) | Volume (ml)] (Default in bold)Select the output type for the selected Output Channel
Nutrient D Output AmountDecimal - Default Value: 2.0The amount to send to the Nutrient D dosing pump (duration or volume)
Setpoint Options
pH SetpointDecimal - Default Value: 5.85The desired pH setpoint
pH HysteresisDecimal - Default Value: 0.35The hysteresis to determine the pH range
EC SetpointDecimal - Default Value: 150.0The desired electrical conductivity setpoint
EC HysteresisDecimal - Default Value: 50.0The hysteresis to determine the EC range
pH Danger Range (High Value)Decimal - Default Value: 7.0This high pH value for the danger range
pH Danger Range (Low Value)Decimal - Default Value: 5.0This low pH value for the danger range
Alert Notification Options
Notification E-MailTextE-mail to notify when there is an issue (blank to disable)
E-Mail Timer Duration (Hours)Decimal - Default Value: 12.0How long to wait between sending e-mail notifications
Commands
Each e-mail notification timer can be manually reset before the expiration.
Reset EC E-mail TimerButton
Reset pH E-mail TimerButton
Reset Measurement Issue E-mail TimerButton
Reset All E-Mail TimersButton
Each total duration and volume can be manually reset.
Reset All TotalsButton
Reset Total Raise pH DurationButton
Reset Total Lower pH DurationButton
Reset Total Raise pH VolumeButton
Reset Total Lower pH VolumeButton
Reset Total EC A DurationButton
Reset Total EC A VolumeButton
Reset Total EC B DurationButton
Reset Total EC B VolumeButton
Reset Total EC C DurationButton
Reset Total EC C VolumeButton
Reset Total EC D DurationButton
Reset Total EC D VolumeButton

Spacer~

A spacer to organize Functions.

OptionTypeDescription
ColorText - Default Value: #000000The color of the name text

Statistics (Last, Multiple)~

This function acquires multiple measurements, calculates statistics, and stores the resulting values as the selected unit.

OptionTypeDescription
Measurements EnabledMulti-SelectThe measurements to record
Period (Seconds)Decimal - Default Value: 60The duration between measurements or actions
Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use
MeasurementMeasurements to perform statistics on
Halt on Missing MeasurementBooleanDon't calculate statistics if >= 1 measurement is not found within Max Age

Statistics (Past, Single)~

This function acquires multiple values from a single measurement, calculates statistics, and stores the resulting values as the selected unit.

OptionTypeDescription
Measurements EnabledMulti-SelectThe measurements to record
Period (Seconds)Decimal - Default Value: 60The duration between measurements or actions
Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use
MeasurementSelect Measurement (Input, Function)Measurement to perform statistics on

Sum (Last, Multiple)~

This function acquires the last measurement of those that are selected, sums them, then stores the resulting value as the selected measurement and unit.

OptionTypeDescription
Period (Seconds)Decimal - Default Value: 60The duration between measurements or actions
Start Offset (Seconds)Integer - Default Value: 10The duration to wait before the first operation
Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use
MeasurementMeasurement to replace "x" in the equation

Sum (Past, Single)~

This function acquires the past measurements (within Max Age) for the selected measurement, sums them, then stores the resulting value as the selected measurement and unit.

OptionTypeDescription
Period (Seconds)Decimal - Default Value: 60The duration between measurements or actions
Start Offset (Seconds)Integer - Default Value: 10The duration to wait before the first operation
MeasurementSelect Measurement (Input, Function, Output)Measurement to replace "x" in the equation
Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use

Vapor Pressure Deficit~

This function calculates the vapor pressure deficit based on leaf temperature and humidity.

OptionTypeDescription
Period (Seconds)Decimal - Default Value: 60The duration between measurements or actions
Start Offset (Seconds)Integer - Default Value: 10The duration to wait before the first operation
TemperatureSelect Measurement (Input, Function)Temperature measurement
Temperature: Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use
HumiditySelect Measurement (Input, Function)Humidity measurement
Humidity: Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use

Verification~

This function acquires 2 measurements, calculates the difference, and if the difference is not larger than the set threshold, the Measurement A value is stored. This enables verifying one sensor's measurement with another sensor's measurement. Only when they are both in agreement is a measurement stored. This stored measurement can be used in functions such as Conditional Functions that will notify the user if no measurement is available to indicate there may be an issue with a sensor.

OptionTypeDescription
Period (Seconds)Decimal - Default Value: 60The duration between measurements or actions
Measurement ASelect Measurement (Input, Function)Measurement A
Measurement A: Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use
Measurement BSelect Measurement (Input, Function)Measurement B
Measurement B: Max Age (Seconds)Integer - Default Value: 360The maximum age of the measurement to use
Maximum DifferenceDecimal - Default Value: 10.0The maximum allowed difference between the measurements
Average MeasurementsBooleanStore the average of the measurements in the database