Browse Source

added comments calculation

tsi 2 years ago
parent
commit
9746e69f2f
2 changed files with 16 additions and 0 deletions
  1. 13 0
      scriptbase.code-workspace
  2. 3 0
      scripts/send_email.py

+ 13 - 0
scriptbase.code-workspace

@@ -0,0 +1,13 @@
+{
+	"folders": [
+		{
+			"name": "solar_collector",
+			"path": "."
+		},
+		{
+			"name": "rpi_darmstadt",
+			"path": "."
+		}
+	],
+	"settings": {}
+}

+ 3 - 0
scripts/send_email.py

@@ -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: