Update the solar edge environmental information graphic on the website
Go to file
2020-10-28 10:45:03 -07:00
.envrc Inital Commit 2019-04-15 15:15:57 -07:00
.gitignore works with pyinstaller 2020-10-28 08:04:44 -07:00
Biko_Regular.otf Inital Commit 2019-04-15 15:15:57 -07:00
env.sample set to handle multiple URLs 2020-10-28 10:45:03 -07:00
environmental_benefits_black.png added new png backgrond colors 2019-04-16 05:48:35 -07:00
environmental_benefits_blank.png Inital Commit 2019-04-15 15:15:57 -07:00
environmental_benefits_grey.png added new png backgrond colors 2019-04-16 05:48:35 -07:00
environmental_benefits_greyb.png added new png backgrond colors 2019-04-16 05:48:35 -07:00
environmental_benefits_greyw.png added new png backgrond colors 2019-04-16 05:48:35 -07:00
environmental_benefits_white.png added new png backgrond colors 2019-04-16 05:48:35 -07:00
LICENSE.md Added LICENCE.md with the unlicense 2019-04-15 16:30:28 -07:00
README.md set to handle multiple URLs 2020-10-28 10:45:03 -07:00
requirements.txt works with pyinstaller 2020-10-28 08:04:44 -07:00
solar_edeg_logo_normal.png added new png backgrond colors 2019-04-16 05:48:35 -07:00
solar_edge_grey1.png added new png backgrond colors 2019-04-16 05:48:35 -07:00
solar_edge_grey2.png added new png backgrond colors 2019-04-16 05:48:35 -07:00
solar_edge_logo_trans.png added new png backgrond colors 2019-04-16 05:48:35 -07:00
solar_edge.py set to handle multiple URLs 2020-10-28 10:45:03 -07:00
solar_edge.spec set to handle multiple URLs 2020-10-28 10:45:03 -07:00

Solar Edge Status Updater

When placed in a cron job this uppdater will make an https call to a json api to retrieve the co2 savings and equivenant trees planted and overlay those numbers on a graphic and upload them to the website.

Dependancies

Python 3 and contents of requirements.txt.

The font Biko_Regular.otf.

A .png graphic to write text on.

The package direnv and the follwing changes to the user account:

If ssh_host is blank will copy file locally instead of scping file to sever. To scp valid sshkeys are required.

Bulid Instructions

assumes installed to ~/python/solar_edge

cd ~/python
git clone http://git.elder-geek.net/fredw/solar_edge.git
cd solar_edge
cp env.sample .env
direnv allow
pip install -r requirements.txt

edit .env and update accordingly

add to user crontab to update site every 5 minutes

*/5   *     *   *  *    cd ~/python/solar_edge && direnv exec . python solar_edge.py > /dev/null 2>&1

Create pyinstaller

pyinstaller --onefile solar_edge.spec
cp dist/solar_edge ~/bin # user must have bin folder

add to user crontab to update site every 5 minutes

*/5   *     *   *  *    ~/bin/solar_edge > /dev/null 2>&1

Sample .env if installed on the server

SSH_HOST=
SSH_PORT=
SSH_USER=
SSH_FOLDER=/var/www/wordpress
URL=https://monitoringapi.solaredge.com/site/55555/envBenefits?systemUnits=Imperial&api_key=
INFILE=environmental_benefits_blank.png
OUTFILE=solar.png
FONT_FACE=Biko_Regular.otf
LINE1=81
LINE2=157
MARGIN=91
COLOR=#298246

Sample .env file for scp

SSH_HOST=myserver.com
SSH_PORT=22
SSH_USER=www-data
SSH_FOLDER=/var/www/wordpress
URL=https://monitoringapi.solaredge.com/site/55555/envBenefits?systemUnits=Imperial&api_key=
INFILE=environmental_benefits_blank.png
OUTFILE=solar.png
FONT_FACE=Biko_Regular.otf
LINE1=81
LINE2=157
MARGIN=91
COLOR=#298246

Backgrounds

There are multilpe backgrounds to choose from. They can be selected by changing the INFILE variable