Email Notify

The reason BoatIO was designed, was to be able to monitor the condition of the boat. BoatIO has many inputs and outputs and these can be used for example to monitor the condition of the batteries or even the bilge pumps. When the PI is connected to a marina WiFi access point, its easy to monitor the boat remotely.


This python program is written to monitor both the analog and digital inputs and then send an email if any of the inputs is outside of the set limits.

For the analog inputs, the input is compared against a MIN and MAX level, the digital inputs are compared for either an ON or OFF condition.

Setup is very simple, just follow the instructions below.

Note: All source code is provided with full rights to copy, modify and distribute. The user accepts all responsibility.

Step 1 - Download the code

1. Download the code using the button to the right. This is a gzip file with two files and EmailNotify.conf

2. Unzip the downloaded file using tar -zxvf boatio.gz

Step 2 - Setup a email account for the boat

1. Setup an email account that will be used by the PI as the sending email account. Google gmail is a good solution. Follow this link to create an account. Make sure you record the login information for this account as its needed below when setting up the configuration file

Example Configuration File

analog,1,false,Battery 1,volts,14.0,10.0,10
analog,2,false,Battery 2,volts,14.0,10.0,10
analog,3,true,Battery 3,volts,14.0,10.0,10
analog,4,false,Battery 4,volts,14.0,10.0,10
digital,1,enable,Bilge 1,1,10
digital,2,enable,Bilge 2,0,10
digital,3,false,Bilge 3,1,10
digital,4,false,Bilge 4,1,10
digital,5,false,Bilge 5,1,10
digital,6,false,Bilge 6,1,10
digital,7,false,Bilge 7,1,10
digital,8,false,Bilge 8,1,10

Step 3 - Setup email in the configuration file

1. Using your favorite text editor on the PI, edit the EmailNotify.conf file. This should look very similar to that shown on the right. You can use the simple editor nano by typing nano EmailNofity.conf

2. The configuration file is setup in two sections. The first sections are used to configure the analog and digital inputs. The second section is to configure the email account

3. From step 2 above, change the password, and sending_email entries. If your using gmail, the port and smtpserver can remain unchanged

4. Change the receiving_email address to the email account that you want the warning messages to go to. Ideally this is the email address you use all the time and available on your phone.

5. If your not using gmail you may need to change the port and smtpserver

Step 4 - Setup the inputs in the configuration file

The inputs are configured using lines 2 thru 13. Line 2 thru 5 are the analog inputs and the line starts with the word "analog". Lines 6 thru 13 are the digital inputs and start with the word "digital".

Line 2 - analog,1,false,Battery 1,volts,14.0,10.0,10

analog - Indicates the input is an analog input.

1 -  This is the analog channel number. On BoatIO there are 4 analog inputs

false - This indicates the input is either enabled or disabled. false = disabled, true = enabled

Battery 1 - This is just a text name for the channel. It can be changed to any string

volts - This is just the units for the channel and appears in the email messages

14.0 - This is the maximum voltage limit

10.0 - This is the minimum voltage limit. When the analog input is less than the min and greater than the max an email is sent

10 - This is a hysteresis time in second (currently not used)

Line 13 - digital,8,false,Bilge 0,1,10

digital -  Indicates this is a digital input

8 -  This is the channel number and appears in the email message, on BoatIO there are 8 digital inputs

false - This indicates the input is enabled or disabled. false = disabled, true = enabled

Bilge 0 - This is just a text name for the channel and appears in the email message

1 - This is the error condition. If the input equals this value, an email is sent. 

10 - This is a hysteresis time in seconds (currently not used)

Step 5 - Run the program

1. Once the configuration file has been adjust for your application, run the program using python