sw documentation - acaird/raspi-scale GitHub Wiki
BeanBot’s software is written in Python, which is a pretty nice language for things like this.
I wrote most of the functions as separate files so each one can be run on its own to see if it’s working.
The files are:
- scale.py
- scaleAlerts.py
- scaleConfig.py
- scaleEmail.py
- scalePlotly.py
- scaleTwitter.py
Following these steps has a reasonable likelyhood of installing this software on your Raspberry Pi.
- Git
- You need Git so you can clone down the software, to
install Git on your Pi type:
apt-get install git - Python 2.7
- Or 2.something where something is a nice number.
To install Python on your Raspberry Pi type:
apt-get install python-2.7 - pip
-
pipis a tool to install Python packages, which we need to do. It’s possiblepipcame with your Python distribution, but if not, you can install it by typing:apt-get install python-pip - RPi.GPIO
- RPi.GPIO is the Python package that lets programs communicate with the Raspberry Pi’s GPIO subsystem. Install this by typing:
pip install RPi.GPIO- Plotly Python libraries
- BeanBot uses Plot.ly to make its plots, so you need the Plot.ly Python libraries. Install these by typing:
pip install plotly- Python/Twitter libraries
- In order to tweet the state of your
beans and alert you via Twitter when you are low, you need
Python to talk to Twitter. BeanBot’s
scale.pyandscaleTwitter.pyexpect thepython-twitterpackage, so install it by typing:
pip install python-twittergit clone https://github.com/acaird/raspi-scale.gitOr pick a release from https://github.com/acaird/raspi-scale/releases and download a .tgz file.
There is some art to this, but you’ll edit the scaleConfig.yaml
file and create some .sec files.
sudo python ./scale.py &The main program
The function to decide on sending alerts. It also updates the
scaleState.db file to keep track of the alert state between
software restarts.
The function to read the configuration file. It also contains the hard-coded defaults for all of the available settings.
The function to send email for updates and alerts.
The function to talk to Plot.ly and update the chart.
The function to talk to Twitter for updates and alerts.