|
|
@@ -6,6 +6,13 @@ tmpdir = tempfile.TemporaryDirectory()
|
|
|
beginning = str((1000*int(time.time()))-(17*3600000))
|
|
|
end = str(1000*int(time.time()))
|
|
|
|
|
|
+
|
|
|
+def get_uptime():
|
|
|
+ with open('/proc/uptime', 'r') as f:
|
|
|
+ uptime_hours = round(float(f.readline().split()[0])/3600, 2)
|
|
|
+ return uptime_hours
|
|
|
+
|
|
|
+
|
|
|
client = InfluxDBClient(host='127.0.0.1', port=8086, database='solar')
|
|
|
result = client.query("SELECT sum(\"eingespeiste_leistung\") *0.000002777777777 FROM \"Tannenstrasse\" WHERE time >= " + beginning + "ms and time <= " + end + "ms")
|
|
|
kwh = round(result.raw['series'][0]['values'][0][1], 1)
|
|
|
@@ -39,7 +46,7 @@ msgText = MIMEText('This is the alternative plain text message.')
|
|
|
msgAlternative.attach(msgText)
|
|
|
|
|
|
# We reference the image in the IMG SRC attribute by the ID we give it below
|
|
|
-msgText = MIMEText('<img src="cid:image1">', 'html')
|
|
|
+msgText = MIMEText('<img src="cid:image1"><br><p>Up: ' + str(get_uptime()) + ' Stunden</p>', 'html')
|
|
|
msgAlternative.attach(msgText)
|
|
|
|
|
|
# This example assumes the image is in the current directory
|