@Webb.Peter As requested, here’s a post on making charts. Rather than narrate what I’ve been doing with Go and dynamically generated SVGs, I thought it would be more useful to make an example GitHub repo with a simple Python program that demonstrates how to parse my sensor log and turn it into a matplotlib chart.
How to try the demo
Make sure you have matplotlib. On macOS, it’s already there. On Raspbian, do this:
sudo apt-get update && sudo apt-get install python-matplotlib
Clone my repo of example code:
git clone https://github.com/wsnook/farm-chart-demo.git
Read the code and the comments in
chart.py. In short, it’s opening a sample sensor log file that I created with my farm controller, looking for records from 23 May 2017, extracting the Si7021 °C and %RH measurements, and turning them into charts with matplotlib.
This is a copy of the sample chart from the example repo:
How to apply this to an MVP
Do something to save sensor data to a log file. You could run my farm controller and my Photon firmware, or you could make up something of your own. You don’t need to use my record file format, but if you use some other format, you’ll need to modify my parsing code.
Modify my script to take a date as a command line argument or maybe have it use
Set up nginx and modify my script’s output file to go in
/var/www/htmlor whatever. You might need to make sure your user is in the right group to have write permissions for the web server’s web root directory.
Make a cron job to run the script at whatever interval you’d like the chart to update.