|
|
@@ -24,6 +24,9 @@ def get_boot_time():
|
|
|
return boot_time
|
|
|
|
|
|
def get_kwh(beginning, end):
|
|
|
+ # 10 seconds = 10/3600 hours = 1/360 hour.
|
|
|
+ # So, the conversion factor for watts to kilowatt-hours for a 10-second interval is:
|
|
|
+ # (1/1000) * (1/360) = 1/360000 = 0.000002777777777
|
|
|
client = InfluxDBClient(host='127.0.0.1', port=8086, database='solar')
|
|
|
result = client.query("SELECT sum(\"eingespeiste_leistung\") *0.000002777777777 FROM \"Tannenstrasse\" WHERE time >= {}ms and time <= {}ms".format(beginning, end))
|
|
|
if 'series' in result.raw:
|