From 4182d49adbc6e2e942abde29953bc9c1aa28b5c6 Mon Sep 17 00:00:00 2001 From: Gitea Date: Wed, 6 Sep 2023 12:09:11 +0200 Subject: [PATCH] Initial commit --- Aktuelle_Temperaturwerte.svg | 2133 ++++++++++ Temperaturverlauf.svg | 7223 ++++++++++++++++++++++++++++++++++ Temperaturverlauf_Tank2.svg | 2151 ++++++++++ change.py | 22 + cron_temp.py | 60 + data.csv | 168 + datenbank.py | 31 + diagramm.svg | 5499 ++++++++++++++++++++++++++ import.py | 30 + istwert_tank1.svg | 1301 ++++++ plotact.py | 50 + plott1.py | 54 + plott2.py | 52 + plottemp.py | 72 + show.py | 22 + temp.py | 24 + temperaturen.db | Bin 0 -> 40960 bytes temperaturverlauf.svg | 1564 ++++++++ trend.py | 81 + 19 files changed, 20537 insertions(+) create mode 100644 Aktuelle_Temperaturwerte.svg create mode 100644 Temperaturverlauf.svg create mode 100644 Temperaturverlauf_Tank2.svg create mode 100755 change.py create mode 100755 cron_temp.py create mode 100644 data.csv create mode 100755 datenbank.py create mode 100644 diagramm.svg create mode 100644 import.py create mode 100644 istwert_tank1.svg create mode 100755 plotact.py create mode 100755 plott1.py create mode 100755 plott2.py create mode 100755 plottemp.py create mode 100755 show.py create mode 100755 temp.py create mode 100644 temperaturen.db create mode 100644 temperaturverlauf.svg create mode 100755 trend.py diff --git a/Aktuelle_Temperaturwerte.svg b/Aktuelle_Temperaturwerte.svg new file mode 100644 index 0000000..3c312e9 --- /dev/null +++ b/Aktuelle_Temperaturwerte.svg @@ -0,0 +1,2133 @@ + + + + + + + + + 2023-09-05T13:09:50.971784 + image/svg+xml + + + Matplotlib v3.3.4, https://matplotlib.org/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Temperaturverlauf.svg b/Temperaturverlauf.svg new file mode 100644 index 0000000..a9860d1 --- /dev/null +++ b/Temperaturverlauf.svg @@ -0,0 +1,7223 @@ + + + + + + + + + 2023-09-05T13:59:06.126537 + image/svg+xml + + + Matplotlib v3.3.4, https://matplotlib.org/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Temperaturverlauf_Tank2.svg b/Temperaturverlauf_Tank2.svg new file mode 100644 index 0000000..4964e75 --- /dev/null +++ b/Temperaturverlauf_Tank2.svg @@ -0,0 +1,2151 @@ + + + + + + + + + 2023-09-05T13:11:58.447183 + image/svg+xml + + + Matplotlib v3.3.4, https://matplotlib.org/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/change.py b/change.py new file mode 100755 index 0000000..8c37e9b --- /dev/null +++ b/change.py @@ -0,0 +1,22 @@ +import sqlite3 + +# SQLite-Datenbankverbindung herstellen +conn = sqlite3.connect('temperaturen.db') +cursor = conn.cursor() + +# Funktion zum Aktualisieren der Tanknamen in der Datenbank +def update_tankname(table_name, old_name, new_name): + cursor.execute(f"UPDATE {table_name} SET messstelle = ? WHERE messstelle = ?", + (new_name, old_name)) + conn.commit() + +# Korrektur durchführen (Tabelle "istwert") +update_tankname("istwert", "Tank 1", "1") +update_tankname("istwert", "Tank 2", "2") + +# Korrektur durchführen (Tabelle "sollwert") +update_tankname("sollwert", "Tank 1", "1") +update_tankname("sollwert", "Tank 2", "2") + +# Die Datenbankverbindung schließen +conn.close() diff --git a/cron_temp.py b/cron_temp.py new file mode 100755 index 0000000..e8d3e6f --- /dev/null +++ b/cron_temp.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python3 + +import requests +from bs4 import BeautifulSoup +import sqlite3 + +# URL der HTML-Seite, die Sie abrufen möchten +url = "http://localhost:5010" + +# HTTP-Anfrage senden und den HTML-Inhalt abrufen +response = requests.get(url) +html = response.text + +# HTML-Dokument in BeautifulSoup-Objekt umwandeln +soup = BeautifulSoup(html, 'html.parser') + +# Die Daten in der Tabelle extrahieren +table = soup.find('table') +rows = table.find_all('tr') + +# Initialisieren der Tanknummern mit 1 und 2 +tank1_nummer = 1 +tank2_nummer = 2 + +# SQLite-Datenbankverbindung herstellen +db_path = '/home/divers/datenbank/temperaturen.db' +conn = sqlite3.connect(db_path) +cursor = conn.cursor() + +# Funktion zum Einfügen von Tanknummern und Temperaturwerten in die Datenbank +def insert_temperature(table_name, tanknummer, temperatur): + cursor.execute(f"INSERT INTO {table_name} (messstelle, temperatur) VALUES (?, ?)", + (tanknummer, temperatur)) + conn.commit() + +# Daten in die Datenbank eintragen (Tabelle "istwert") +for row in rows[1:-1]: + columns = row.find_all('td') + if len(columns) >= 3: + tank_name = columns[0].text + istwert_text = columns[1].text.strip() # Temperaturwert ohne Leerzeichen am Anfang/Ende + if istwert_text: # Nur wenn die Zeichenfolge nicht leer ist + istwert = float(istwert_text.split('°')[0]) # Extrahieren des Istwertes und Konvertieren in Float + tank_nummer = int(tank_name.split()[-1]) # Extrahieren der Tanknummer aus dem Namen + insert_temperature("istwert", tank_nummer, istwert) + +# Daten in die Datenbank eintragen (Tabelle "sollwert") +for row in rows[1:-1]: + columns = row.find_all('td') + if len(columns) >= 3: + tank_name = columns[0].text + sollwert_text = columns[2].text.strip() # Temperaturwert ohne Leerzeichen am Anfang/Ende + if sollwert_text: # Nur wenn die Zeichenfolge nicht leer ist + sollwert = float(sollwert_text.split('°')[0]) # Extrahieren des Sollwertes und Konvertieren in Float + tank_nummer = int(tank_name.split()[-1]) # Extrahieren der Tanknummer aus dem Namen + insert_temperature("sollwert", tank_nummer, sollwert) + +# Die Datenbankverbindung schließen +conn.close() + diff --git a/data.csv b/data.csv new file mode 100644 index 0000000..24573e6 --- /dev/null +++ b/data.csv @@ -0,0 +1,168 @@ +id,temperature,Timestamp +1,13.25,"2023-09-04 21:52:27" +2,13.38,"2023-09-04 21:54:24" +3,13.38,"2023-09-04 22:05:01" +4,13.5,"2023-09-04 22:07:01" +5,13.5,"2023-09-04 22:10:01" +6,13.5,"2023-09-04 22:15:02" +7,13.63,"2023-09-04 22:20:01" +8,13.63,"2023-09-04 22:25:02" +9,13.75,"2023-09-04 22:30:01" +10,13.75,"2023-09-04 22:35:02" +11,13.88,"2023-09-04 22:40:01" +12,13.88,"2023-09-04 22:45:01" +13,14.0,"2023-09-04 22:50:02" +14,14.0,"2023-09-04 22:55:01" +15,14.0,"2023-09-04 23:00:02" +16,14.13,"2023-09-04 23:05:02" +17,14.13,"2023-09-04 23:10:01" +18,14.13,"2023-09-04 23:15:02" +19,14.13,"2023-09-04 23:20:02" +20,14.25,"2023-09-04 23:25:01" +21,14.25,"2023-09-04 23:30:02" +22,14.25,"2023-09-04 23:35:01" +23,14.38,"2023-09-04 23:40:02" +24,14.5,"2023-09-04 23:45:02" +25,14.38,"2023-09-04 23:50:01" +26,14.38,"2023-09-04 23:55:02" +27,14.5,"2023-09-05 00:00:01" +28,14.5,"2023-09-05 00:05:02" +29,14.63,"2023-09-05 00:10:01" +30,14.63,"2023-09-05 00:15:01" +31,14.63,"2023-09-05 00:20:02" +32,14.63,"2023-09-05 00:25:02" +33,14.75,"2023-09-05 00:30:01" +34,14.63,"2023-09-05 00:35:02" +35,14.75,"2023-09-05 00:40:01" +36,14.75,"2023-09-05 00:45:01" +37,14.75,"2023-09-05 00:50:02" +38,14.88,"2023-09-05 00:55:01" +39,14.88,"2023-09-05 01:00:02" +40,14.88,"2023-09-05 01:05:01" +41,14.88,"2023-09-05 01:10:02" +42,15.0,"2023-09-05 01:15:02" +43,14.88,"2023-09-05 01:20:01" +44,15.0,"2023-09-05 01:25:02" +45,15.0,"2023-09-05 01:30:02" +46,15.0,"2023-09-05 01:35:01" +47,15.13,"2023-09-05 01:40:02" +48,15.0,"2023-09-05 01:45:02" +49,15.13,"2023-09-05 01:50:01" +50,15.13,"2023-09-05 01:55:02" +51,15.13,"2023-09-05 02:00:01" +52,15.13,"2023-09-05 02:05:02" +53,15.13,"2023-09-05 02:10:02" +54,15.25,"2023-09-05 02:15:01" +55,15.25,"2023-09-05 02:20:02" +56,15.25,"2023-09-05 02:25:01" +57,15.25,"2023-09-05 02:30:02" +58,15.25,"2023-09-05 02:35:02" +59,15.38,"2023-09-05 02:40:02" +60,15.38,"2023-09-05 02:45:01" +61,15.38,"2023-09-05 02:50:02" +62,15.38,"2023-09-05 02:55:01" +63,15.38,"2023-09-05 03:00:02" +64,15.5,"2023-09-05 03:05:02" +65,15.5,"2023-09-05 03:10:01" +66,15.5,"2023-09-05 03:15:02" +67,15.63,"2023-09-05 03:20:01" +68,15.5,"2023-09-05 03:25:01" +69,15.63,"2023-09-05 03:30:02" +70,15.63,"2023-09-05 03:35:01" +71,15.63,"2023-09-05 03:40:01" +72,15.75,"2023-09-05 03:45:01" +73,15.75,"2023-09-05 03:50:02" +74,15.75,"2023-09-05 03:55:01" +75,15.75,"2023-09-05 04:00:02" +76,15.75,"2023-09-05 04:05:01" +77,15.75,"2023-09-05 04:10:02" +78,15.75,"2023-09-05 04:15:02" +79,15.75,"2023-09-05 04:20:01" +80,15.88,"2023-09-05 04:25:02" +81,15.88,"2023-09-05 04:30:01" +82,15.88,"2023-09-05 04:35:01" +83,15.88,"2023-09-05 04:40:02" +84,15.88,"2023-09-05 04:45:02" +85,16.0,"2023-09-05 04:50:01" +86,15.88,"2023-09-05 04:55:01" +87,15.88,"2023-09-05 05:00:02" +88,16.0,"2023-09-05 05:05:01" +89,16.0,"2023-09-05 05:10:02" +90,16.0,"2023-09-05 05:15:02" +91,16.0,"2023-09-05 05:20:01" +92,16.0,"2023-09-05 05:25:02" +93,16.12,"2023-09-05 05:30:01" +94,16.12,"2023-09-05 05:35:02" +95,16.12,"2023-09-05 05:40:02" +96,16.12,"2023-09-05 05:45:01" +97,16.12,"2023-09-05 05:50:01" +98,16.12,"2023-09-05 05:55:02" +99,16.25,"2023-09-05 06:00:02" +100,16.12,"2023-09-05 06:05:01" +101,16.25,"2023-09-05 06:10:02" +102,16.25,"2023-09-05 06:15:02" +103,16.25,"2023-09-05 06:20:01" +104,16.25,"2023-09-05 06:25:02" +105,16.37,"2023-09-05 06:30:02" +106,16.37,"2023-09-05 06:35:01" +107,16.37,"2023-09-05 06:40:02" +108,16.37,"2023-09-05 06:45:01" +109,16.5,"2023-09-05 06:50:02" +110,16.5,"2023-09-05 06:55:02" +111,16.5,"2023-09-05 07:00:01" +112,16.5,"2023-09-05 07:05:02" +113,16.62,"2023-09-05 07:10:02" +114,16.62,"2023-09-05 07:15:01" +115,16.62,"2023-09-05 07:20:02" +116,16.62,"2023-09-05 07:25:02" +117,16.62,"2023-09-05 07:30:02" +118,16.62,"2023-09-05 07:35:02" +119,16.62,"2023-09-05 07:40:02" +120,16.75,"2023-09-05 07:45:02" +121,16.75,"2023-09-05 07:50:02" +122,16.75,"2023-09-05 07:55:02" +123,16.87,"2023-09-05 08:00:01" +124,16.75,"2023-09-05 08:05:01" +125,16.87,"2023-09-05 08:10:02" +126,16.87,"2023-09-05 08:15:02" +127,16.87,"2023-09-05 08:20:02" +128,16.87,"2023-09-05 08:25:02" +129,17.0,"2023-09-05 08:30:02" +130,17.0,"2023-09-05 08:37:18" +131,17.0,"2023-09-05 08:45:02" +132,17.12,"2023-09-05 08:50:01" +133,17.12,"2023-09-05 08:55:02" +134,17.12,"2023-09-05 09:00:02" +135,17.12,"2023-09-05 09:05:02" +136,17.12,"2023-09-05 09:10:02" +137,17.25,"2023-09-05 09:15:02" +138,17.25,"2023-09-05 09:20:02" +139,17.25,"2023-09-05 09:25:01" +140,17.25,"2023-09-05 09:30:02" +141,17.37,"2023-09-05 09:35:02" +142,17.37,"2023-09-05 09:40:01" +143,17.37,"2023-09-05 09:45:01" +144,17.5,"2023-09-05 09:50:02" +145,17.37,"2023-09-05 09:55:02" +146,17.37,"2023-09-05 10:00:02" +147,17.5,"2023-09-05 10:05:02" +148,17.5,"2023-09-05 10:10:02" +149,17.5,"2023-09-05 10:15:02" +150,17.5,"2023-09-05 10:20:02" +151,17.5,"2023-09-05 10:25:24" +152,17.5,"2023-09-05 10:30:02" +153,17.62,"2023-09-05 10:35:02" +154,17.62,"2023-09-05 10:40:02" +155,17.62,"2023-09-05 10:45:01" +156,17.62,"2023-09-05 10:50:01" +157,17.75,"2023-09-05 10:55:01" +158,17.75,"2023-09-05 11:00:01" +159,17.75,"2023-09-05 11:05:02" +160,17.75,"2023-09-05 11:10:02" +161,17.87,"2023-09-05 11:15:02" +162,17.87,"2023-09-05 11:20:02" +163,17.87,"2023-09-05 11:25:01" +164,17.87,"2023-09-05 11:30:01" +165,18.0,"2023-09-05 11:35:02" +166,17.87,"2023-09-05 11:40:02" +167,18.0,"2023-09-05 11:45:02" diff --git a/datenbank.py b/datenbank.py new file mode 100755 index 0000000..2dbb45f --- /dev/null +++ b/datenbank.py @@ -0,0 +1,31 @@ +import sqlite3 + +# SQLite-Datenbankverbindung herstellen oder erstellen (temperatursteuerung.db) +conn = sqlite3.connect('temperaturen.db') +cursor = conn.cursor() + +# Tabelle "istwert" erstellen +cursor.execute(''' + CREATE TABLE IF NOT EXISTS istwert ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + messstelle INTEGER, + temperatur REAL, + zeitstempel TIMESTAMP DEFAULT CURRENT_TIMESTAMP + ) +''') + +# Tabelle "sollwert" erstellen +cursor.execute(''' + CREATE TABLE IF NOT EXISTS sollwert ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + messstelle INTEGER, + temperatur REAL, + zeitstempel TIMESTAMP DEFAULT CURRENT_TIMESTAMP + ) +''') + +# Änderungen in der Datenbank speichern +conn.commit() + +# Die Datenbankverbindung schließen +conn.close() diff --git a/diagramm.svg b/diagramm.svg new file mode 100644 index 0000000..d35339d --- /dev/null +++ b/diagramm.svg @@ -0,0 +1,5499 @@ + + + + + + + + + 2023-09-05T09:42:33.592638 + image/svg+xml + + + Matplotlib v3.3.4, https://matplotlib.org/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/import.py b/import.py new file mode 100644 index 0000000..7092e13 --- /dev/null +++ b/import.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 +import sqlite3 +import csv + +# Pfad zur CSV-Datei +csv_file = 'data.csv' + +# Pfad zur SQLite-Datenbank +db_path = '/home/divers/datenbank/temperaturen.db' + +# Verbindung zur SQLite-Datenbank herstellen +conn = sqlite3.connect(db_path) +cursor = conn.cursor() + +# CSV-Datei öffnen und Daten einfügen +with open(csv_file, 'r') as file: + csv_reader = csv.DictReader(file) + for row in csv_reader: + temperature = float(row['temperature']) # Temperaturwert aus der CSV-Datei + timestamp = row['Timestamp'] # Zeitstempel aus der CSV-Datei + + # SQL-Abfrage zum Einfügen des Datensatzes in die Tabelle "istwert" + cursor.execute("INSERT INTO istwert (messstelle, temperatur, zeitstempel) VALUES (?, ?, ?)", + (1, temperature, timestamp)) + +# Änderungen in der Datenbank speichern +conn.commit() + +# Datenbankverbindung schließen +conn.close() diff --git a/istwert_tank1.svg b/istwert_tank1.svg new file mode 100644 index 0000000..6646ebd --- /dev/null +++ b/istwert_tank1.svg @@ -0,0 +1,1301 @@ + + + + + + + + + 2023-09-05T11:52:46.509907 + image/svg+xml + + + Matplotlib v3.3.4, https://matplotlib.org/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plotact.py b/plotact.py new file mode 100755 index 0000000..96d7f55 --- /dev/null +++ b/plotact.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python3 + +import matplotlib.pyplot as plt +import sqlite3 + +# Pfad zur Datenbank +db_path = '/home/divers/datenbank/temperaturen.db' + +# SQLite-Datenbankverbindung herstellen +conn = sqlite3.connect(db_path) +cursor = conn.cursor() + +# SQL-Abfrage, um die letzten 10 Istwerte von Tank 1 abzurufen +cursor.execute("SELECT zeitstempel, temperatur FROM istwert WHERE messstelle = 1 ORDER BY zeitstempel ASC LIMIT 30") +rows_tank1_istwert = cursor.fetchall() +datetimes_tank1_istwert = [row[0] for row in rows_tank1_istwert] +temperaturen_tank1_istwert = [row[1] for row in rows_tank1_istwert] + +# SQL-Abfrage, um die letzten 10 Istwerte von Tank 2 abzurufen +cursor.execute("SELECT zeitstempel, temperatur FROM istwert WHERE messstelle = 2 ORDER BY zeitstempel ASC LIMIT 30") +rows_tank2_istwert = cursor.fetchall() +datetimes_tank2_istwert = [row[0] for row in rows_tank2_istwert] +temperaturen_tank2_istwert = [row[1] for row in rows_tank2_istwert] + +conn.close() + +# Grafik erstellen +plt.figure(figsize=(12, 8)) + +# Plot für Istwert (Tank 1) +plt.plot(datetimes_tank1_istwert, temperaturen_tank1_istwert, label='Istwert Tank 1', color='blue') + +# Plot für Istwert (Tank 2) +plt.plot(datetimes_tank2_istwert, temperaturen_tank2_istwert, label='Istwert Tank 2', color='green') + +plt.xlabel('Zeitstempel') +plt.ylabel('Temperatur (°C)') +plt.title('Aktuelle Temperaturwerte von Tank 1 und Tank 2') + +# Vertikale Ausrichtung der x-Achsenbeschriftung +plt.xticks(rotation='vertical') + +plt.legend() +plt.grid(True) + +# Speichern Sie die Grafik als SVG-Datei +plt.savefig('AktuellT1T2.svg', format='svg', bbox_inches='tight') + +# Grafik anzeigen (optional) +plt.show() diff --git a/plott1.py b/plott1.py new file mode 100755 index 0000000..a5481cf --- /dev/null +++ b/plott1.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python3 + +import matplotlib.pyplot as plt +import sqlite3 + +# Pfad zur Datenbank +db_path = '/home/divers/datenbank/temperaturen.db' + +# SQLite-Datenbankverbindung herstellen +conn = sqlite3.connect(db_path) +cursor = conn.cursor() + +# SQL-Abfrage, um die Zeitstempel und Temperaturen zu erhalten (Tabelle "istwert" für Tank 1) +cursor.execute("SELECT zeitstempel, temperatur FROM istwert WHERE messstelle = 1") +rows_istwert = cursor.fetchall() + +# SQL-Abfrage, um die Zeitstempel und Temperaturen zu erhalten (Tabelle "sollwert" für Tank 1) +cursor.execute("SELECT zeitstempel, temperatur FROM sollwert WHERE messstelle = 1") +rows_sollwert = cursor.fetchall() + +conn.close() + +# Die Zeitstempel und Temperaturen in separate Listen aufteilen (Istwert) +datetimes_istwert = [row[0] for row in rows_istwert] +temperaturen_istwert = [row[1] for row in rows_istwert] + +# Die Zeitstempel und Temperaturen in separate Listen aufteilen (Sollwert) +datetimes_sollwert = [row[0] for row in rows_sollwert] +temperaturen_sollwert = [row[1] for row in rows_sollwert] + +# Grafik erstellen +plt.figure(figsize=(10, 8)) # Vergrößern Sie die Höhe des Grafikbereichs + +# Plot für Istwert (Tank 1) +plt.plot(datetimes_istwert, temperaturen_istwert, label='Istwert Tank 1', color='blue') + +# Plot für Sollwert (Tank 1) +plt.plot(datetimes_sollwert, temperaturen_sollwert, label='Sollwert Tank 1', color='red', linestyle='--') + +plt.xlabel('Zeitstempel') +plt.ylabel('Temperatur (°C)') +plt.title('Temperaturverlauf Tank 1 (Istwert und Sollwert)') + +# Vertikale Ausrichtung der x-Achsenbeschriftung +plt.xticks(rotation='vertical') + +plt.legend() +plt.grid(True) + +# Speichern Sie die Grafik als SVG-Datei +plt.savefig('Temperaturverlauf.svg', format='svg', bbox_inches='tight') + +# Grafik anzeigen (optional) +plt.show() diff --git a/plott2.py b/plott2.py new file mode 100755 index 0000000..2442874 --- /dev/null +++ b/plott2.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 + +import matplotlib.pyplot as plt +import sqlite3 + +# Pfad zur Datenbank +db_path = '/home/divers/datenbank/temperaturen.db' + +# SQLite-Datenbankverbindung herstellen +conn = sqlite3.connect(db_path) +cursor = conn.cursor() + +# SQL-Abfrage, um die Zeitstempel und Temperaturen zu erhalten (Tabelle "istwert" für Tank 2) +cursor.execute("SELECT zeitstempel, temperatur FROM istwert WHERE messstelle = 2") +rows_istwert_tank2 = cursor.fetchall() + +# SQL-Abfrage, um die Zeitstempel und Temperaturen zu erhalten (Tabelle "sollwert" für Tank 2) +cursor.execute("SELECT zeitstempel, temperatur FROM sollwert WHERE messstelle = 2") +rows_sollwert_tank2 = cursor.fetchall() + +conn.close() + +# Die Zeitstempel und Temperaturen in separate Listen aufteilen (Istwert und Sollwert Tank 2) +datetimes_istwert_tank2 = [row[0] for row in rows_istwert_tank2] +temperaturen_istwert_tank2 = [row[1] for row in rows_istwert_tank2] +datetimes_sollwert_tank2 = [row[0] for row in rows_sollwert_tank2] +temperaturen_sollwert_tank2 = [row[1] for row in rows_sollwert_tank2] + +# Grafik erstellen +plt.figure(figsize=(10, 8)) # Vergrößern Sie die Höhe des Grafikbereichs + +# Plot für Istwert (Tank 2) +plt.plot(datetimes_istwert_tank2, temperaturen_istwert_tank2, label='Istwert Tank 2', color='green') + +# Plot für Sollwert (Tank 2) +plt.plot(datetimes_sollwert_tank2, temperaturen_sollwert_tank2, label='Sollwert Tank 2', color='orange', linestyle='--') + +plt.xlabel('Zeitstempel') +plt.ylabel('Temperatur (°C)') +plt.title('Temperaturverlauf Tank 2 (Istwert und Sollwert)') + +# Vertikale Ausrichtung der x-Achsenbeschriftung +plt.xticks(rotation='vertical') + +plt.legend() +plt.grid(True) + +# Speichern Sie die Grafik als SVG-Datei +plt.savefig('Temperaturverlauf_Tank2.svg', format='svg', bbox_inches='tight') + +# Grafik anzeigen (optional) +plt.show() diff --git a/plottemp.py b/plottemp.py new file mode 100755 index 0000000..96cf9dc --- /dev/null +++ b/plottemp.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 + +import matplotlib.pyplot as plt +import sqlite3 + +# Pfad zur Datenbank +db_path = '/home/divers/datenbank/temperaturen.db' + +# SQLite-Datenbankverbindung herstellen +conn = sqlite3.connect(db_path) +cursor = conn.cursor() + +# SQL-Abfrage, um die Zeitstempel und Temperaturen zu erhalten (Tabelle "istwert" für Tank 1) +cursor.execute("SELECT zeitstempel, temperatur FROM istwert WHERE messstelle = 1") +rows_istwert_tank1 = cursor.fetchall() + +# SQL-Abfrage, um die Zeitstempel und Temperaturen zu erhalten (Tabelle "sollwert" für Tank 1) +cursor.execute("SELECT zeitstempel, temperatur FROM sollwert WHERE messstelle = 1") +rows_sollwert_tank1 = cursor.fetchall() + +# SQL-Abfrage, um die Zeitstempel und Temperaturen zu erhalten (Tabelle "istwert" für Tank 2) +cursor.execute("SELECT zeitstempel, temperatur FROM istwert WHERE messstelle = 2") +rows_istwert_tank2 = cursor.fetchall() + +# SQL-Abfrage, um die Zeitstempel und Temperaturen zu erhalten (Tabelle "sollwert" für Tank 2) +cursor.execute("SELECT zeitstempel, temperatur FROM sollwert WHERE messstelle = 2") +rows_sollwert_tank2 = cursor.fetchall() + +conn.close() + +# Die Zeitstempel und Temperaturen in separate Listen aufteilen (Istwert und Sollwert Tank 1) +datetimes_istwert_tank1 = [row[0] for row in rows_istwert_tank1] +temperaturen_istwert_tank1 = [row[1] for row in rows_istwert_tank1] +datetimes_sollwert_tank1 = [row[0] for row in rows_sollwert_tank1] +temperaturen_sollwert_tank1 = [row[1] for row in rows_sollwert_tank1] + +# Die Zeitstempel und Temperaturen in separate Listen aufteilen (Istwert und Sollwert Tank 2) +datetimes_istwert_tank2 = [row[0] for row in rows_istwert_tank2] +temperaturen_istwert_tank2 = [row[1] for row in rows_istwert_tank2] +datetimes_sollwert_tank2 = [row[0] for row in rows_sollwert_tank2] +temperaturen_sollwert_tank2 = [row[1] for row in rows_sollwert_tank2] + +# Grafik erstellen +plt.figure(figsize=(10, 8)) # Vergrößern Sie die Höhe des Grafikbereichs + +# Plot für Istwert (Tank 1) +plt.plot(datetimes_istwert_tank1, temperaturen_istwert_tank1, label='Istwert Tank 1', color='blue') + +# Plot für Sollwert (Tank 1) +plt.plot(datetimes_sollwert_tank1, temperaturen_sollwert_tank1, label='Sollwert Tank 1', color='red', linestyle='--') + +# Plot für Istwert (Tank 2) +plt.plot(datetimes_istwert_tank2, temperaturen_istwert_tank2, label='Istwert Tank 2', color='green') + +# Plot für Sollwert (Tank 2) +plt.plot(datetimes_sollwert_tank2, temperaturen_sollwert_tank2, label='Sollwert Tank 2', color='orange', linestyle='--') + +plt.xlabel('Zeitstempel') +plt.ylabel('Temperatur (°C)') +plt.title('Temperaturverlauf Tank 1 und Tank 2 (Istwert und Sollwert)') + +# Vertikale Ausrichtung der x-Achsenbeschriftung +plt.xticks(rotation='vertical') + +plt.legend() +plt.grid(True) + +# Speichern Sie die Grafik als SVG-Datei +plt.savefig('Temperaturverlauf.svg', format='svg', bbox_inches='tight') + +# Grafik anzeigen (optional) +plt.show() diff --git a/show.py b/show.py new file mode 100755 index 0000000..07a7b2c --- /dev/null +++ b/show.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 + +import sqlite3 + +# SQLite-Datenbankverbindung herstellen +conn = sqlite3.connect('temperaturen.db') +cursor = conn.cursor() + +# Funktion zum Auslesen und Ausgeben der Werte +def read_and_print_table(table_name): + print(f"Auslesen der Tabelle '{table_name}':") + cursor.execute(f"SELECT * FROM {table_name}") + rows = cursor.fetchall() + for row in rows: + print(row) + +# Tabellen "istwert" und "sollwert" auslesen und ausgeben +read_and_print_table("istwert") +read_and_print_table("sollwert") + +# Die Datenbankverbindung schließen +conn.close() diff --git a/temp.py b/temp.py new file mode 100755 index 0000000..3eb00f3 --- /dev/null +++ b/temp.py @@ -0,0 +1,24 @@ +import sqlite3 + +# Pfad zur Datenbank +db_path = '/home/divers/datenbank/temperaturen.db' + +# SQLite-Datenbankverbindung herstellen +conn = sqlite3.connect(db_path) +cursor = conn.cursor() + +# SQL-Update-Statement zum Entfernen von "°C" aus der Temperaturspalte +update_query = """ +UPDATE sollwert +SET temperatur = REPLACE(temperatur, '°C', '') +WHERE temperatur LIKE '%°C' +""" + +# Führen Sie das Update-Statement aus +cursor.execute(update_query) +conn.commit() + +# Die Datenbankverbindung schließen +conn.close() + +print("°C-Symbole in der Temperaturspalte entfernt.") diff --git a/temperaturen.db b/temperaturen.db new file mode 100644 index 0000000000000000000000000000000000000000..983e2b86a064b5e5d9952a1ed6122c7932b10792 GIT binary patch literal 40960 zcmeHPdzc(mmG7>8R9AO(cK{_+C4?$KAS8t8?wLFWgh?O>B!OfyAx2$|fs|)z~+Fb5lj(cv{>+=j@VCIRV8!iKu;yynOnqMMd+nlbt{FXALi3IeV$4ptAJw`%F|hG50=4Z+fNBNv``0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jt ztd)W4z0qhkCed_U!We!fkT6r77G4mKnrLV=mzrqQqJXc6E-}!cOBi3=p^+X6+af{y gDiaNjW`l`_SJ5jCH0Tn>>y0!J3Lfer6OD5DUl3(by8r+H literal 0 HcmV?d00001 diff --git a/temperaturverlauf.svg b/temperaturverlauf.svg new file mode 100644 index 0000000..8db7683 --- /dev/null +++ b/temperaturverlauf.svg @@ -0,0 +1,1564 @@ + + + + + + + + + 2023-09-05T11:44:18.734623 + image/svg+xml + + + Matplotlib v3.3.4, https://matplotlib.org/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/trend.py b/trend.py new file mode 100755 index 0000000..f729d37 --- /dev/null +++ b/trend.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python3 + +import cgi +import sqlite3 +import mpld3 +import matplotlib.pyplot as plt +from datetime import datetime, timedelta +import csv +from io import StringIO + +# Parse the form data +form = cgi.FieldStorage() + +# Get the current date and time +current_datetime = datetime.now() + +# Calculate one day before and after the current date at 22:22 +start_datetime_default = current_datetime - timedelta(days=1, hours=current_datetime.hour, minutes=current_datetime.minute, seconds=current_datetime.second) +start_datetime_default = start_datetime_default.replace(hour=22, minute=22, second=0) + +end_datetime_default = current_datetime + timedelta(days=1, hours=1, minutes=38) # Assuming you want 24 hours + 1 hour and 38 minutes +end_datetime_default = end_datetime_default.replace(hour=22, minute=22, second=0) + +# Get the selected start and end dates with times from the form, or use the defaults +start_datetime = form.getvalue("start_datetime", start_datetime_default.strftime("%Y-%m-%dT%H:%M")) +end_datetime = form.getvalue("end_datetime", end_datetime_default.strftime("%Y-%m-%dT%H:%M")) + +# Establish a connection to the database (please adjust the database path) +conn = sqlite3.connect('/home/divers/datenbank/temperaturen.db') +cursor = conn.cursor() + +# Create a function to generate the temperature plot and CSV data +def generate_temperature_plot_and_csv(start_datetime, end_datetime): + cursor.execute("SELECT zeitstempel, temperatur FROM istwert WHERE messstelle = 1 AND zeitstempel BETWEEN ? AND ?", (start_datetime, end_datetime)) + rows = cursor.fetchall() + + timestamps = [datetime.strptime(row[0], "%Y-%m-%d %H:%M:%S").strftime("%Y-%m-%d %H:%M:%S") for row in rows] + temperaturen = [row[1] for row in rows] + + # Generate CSV data + csv_data = "Zeitstempel,Temperatur (°C)\n" + csv_data += "\n".join([f"{timestamps[i]},{temperaturen[i]}" for i in range(len(timestamps))]) + + plt.figure(figsize=(10, 5)) + plt.plot(timestamps, temperaturen, marker='o', linestyle='-', color='b') + plt.xlabel('Zeitstempel') + plt.ylabel('Temperatur (°C)') + plt.title('Temperaturverlauf Tank 1') + plt.grid(True) + + plot_html = mpld3.fig_to_html(plt.gcf()) + plt.close() + + return plot_html, csv_data + +# Generate the temperature plot and CSV data +temperature_plot, csv_data = generate_temperature_plot_and_csv(start_datetime, end_datetime) + +# Generate the HTML page with the temperature plot and CSV data +print("Content-type: text/html\n") +print("") +print("") +print("Temperaturverlauf") +print("") +print("") +print("

Temperaturverlauf Tank 1

") +print("
") +print("Startdatum und Uhrzeit:
".format(start_datetime)) +print("Enddatum und Uhrzeit:
".format(end_datetime)) +print("") +print("
") +print(temperature_plot) +print("

Dargestellte Werte als CSV

") +print("
")
+print(csv_data)
+print("
") +print("") +print("") + +# Close the database connection +conn.close()