Coder Social home page Coder Social logo

mudpiinflux's Introduction

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!

mudpiinflux's People

Contributors

icyspace avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

mudpiinflux's Issues

no measurements show

Hello I followed the guide but when I going to do show measurements into influx it returns nothing.
I've configured MudPy with 1 soil sensor connected to an Arduino Uno (connected via usb to a raspberry 2/4).
Any clue?

Thank you :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.