!doctype html>
cm160 >/dev/null 2>&1 &
#!/bin/sh
##Simple script to send the energy consuption to my website
YEAR=`date +%Y`
MESE=`date +%m`
SQ=`echo -e '.mode line\n.headers on\n.width 4 0 4 6 0 \nselect month,year,round(sum(ch1_kw_avg)/1000,1) AS "KWh from start of month",round(sum(ch1_kw_avg)/1000*0.12,1) AS "Cost in pounds to date" from energy_history where month='${MESE}' and year='${YEAR}' ;\n'| sqlite3 eagleowl.db` ; echo -e "$SQ\nLive: `cat .live|sed -e s/kW/W/` " | txt2html -pm --append_head /home/max/energy_header.txt --body_deco " bgcolor=#000000 ><font face='noto sans,verdana,arial,sans-serif' color='#00FFFF'" -tf -t "Energy Consumption" | sed -e s/"Live"/"<mark>Live"/ | sed -e s/" W"/"W<\/mark>"/ > /home/max/energy.html
chown max.max /home/max/energy.html
curl --key ~/.ssh/id_ecdsa -k -T /home/max/energy.html sftp://xxx/xxx/www/ -u xxxx.yyyy