Skip to content

icyspace/MudPiInflux

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 

Repository files navigation

Skip to walkthrough

Overview

MudPiInflux is simple interface to Mudpi which subscribes to the Redis PubSub and stores data from your garden in Influx. Using Grafana you can then enable dashboards and alerting. This can all run on the mudpi master raspberry pi (or could be configured on a separate machine)

Limitations

The interface from Redis to Influx is only written for the following. (Others will likely work, but this is all I have tested)

  • Weather / soil sensors on Arduino
  • Only 1 Relay (relay name not part of message)
  • Temp / Humidity Sensor

Dashboard

MudPi Dashboard

Email Alerts

Garden Needs Water

Watering Alert

Alert History

Reference sites

Hardware I used

Software

Walkthroughs

Building Grafana Dashboard on Mudpi

Prerequisite

Confirm the software installed on raspberry pi are both working

  1. Installing MudPi from Github
  2. Follow This guide to install Influx and Grafana you can skip step 0 - Guide
  3. (Optional) Follow through with the network speed tutorial if you want to learn more about how data flows from Influx to Grafana. - Guide
  4. (Optional) if installing influx on a different machine you can run this script on that machine or you can install influxdb-client on the PI instedad.
    pip3 install influxdb
    should upgrade to the new client pip3 install influxdb-client

Deploy Interface Script

  1. Download the mudpitoinflux3.py script to your download directory
    cd ~/Downloads 
    wget https://raw.githubusercontent.com/icyspace/MudPiInflux/master/mudpitoinflux3.py
  2. Update mudpitoinflux3.py influx credentials
    sudo nano mudpitoinflux3.py
    Alert History
    Enter Keys ctl + o then Enter - to save the file
    Enter Keys ctl + x – to exit
  3. Move config file to execution directory Move py file with your saved configurations to the directory you would like to run it from. I am just running this from my home dir.
    mv mudpitoinflux3.py ~/
  4. Add to supervisor config If you would like this file to run automatically on startup and restart on failures it's good to added it to supervisor. Just like Mudpi is running. Navigate to sup supervisor directory
    cd /etc/supervisor/conf.d
    Create new conf file for mudpitoinflux3 script
    sudo nano mudpitoinflux3.conf 
    Paste the following code in the file. I have my script running out of my home directory. If you want it to run from a different location you can create that and update this config here.
    [program:mudpitoinflux3]
    directory=/home/pi
    user=pi
    command=python3 -u /home/pi/mudpitoinflux3.py
    autostart=true
    autorestart=true
    stderr_logfile=/home/pi/logs/mudpitoinflux3.err.log
    stdout_logfile=/home/pi/logs/mudpitoinflux3.out.log 
    
    Enter Keys ctl + o then Enter - to save the file
    Enter Keys ctl + x – to exit
    Start Supervisor
    sudo supervisorctl update
    
    sudo supervisorctl start mudpitoinflux3
    To check the status
    sudo supervisorctl start mudpitoinflux3
    or review error log in the location you specified in the supervisor config file

Confirming Influx is collecting data

  1. Connect to influx Go to home dir
    cd ~ 
    influx 
  2. Select the home database (or the table you configured the mudpitoinflux3.py to write to)
    use home 
  3. List and query measurements being collected
     show measurements 
    You should see your sensors by name listed here. Select one and use it in the query below.
    Select * from <measurement> limit 100 
    This will display the data in the measurement of the time series database. If you see your data you are good to go.
    influx Results

Building a Grafana Dashboard

  1. Log into Grafana Open a browser and navigate to your Pi IP address http://<your.rpi.address>:3000
  2. Create new data source
    Navigate to Configuration > Data Sources Search for "Influx" search for influx
    Below is my configuration and is fairly standard if you installed Grafana on the same raspberry pi as Mudpi and influx
    influxconfig1
    influxconfig2
  3. Create new Dashboard GrafanaQuery
    GrafanaSettings
    GrafanaSettings1
    influxconfig2

Enabling Email Alerting

To use alerting you must set up a Notification Channel. Grafana supports a large range of options here.

  1. For Email Edit the Grafana Config
    gmailconfig
  2. Set up a notification channel
    notificationChannel
  3. Edit your dashboard and add alerts
    EmailGardenAlertConfig
    GrafanaAlertConfiguration
    GrafanaAlertDashboard

Summary

At this point you should have a low maintenance solution to collect, view, and be alerted on your garden’s performance.
Happy Growing!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages