From f6c0a2bee5f2e6306664ae85186c0cdd5afe99f8 Mon Sep 17 00:00:00 2001 From: ferdzo Date: Thu, 29 Aug 2024 19:57:23 +0200 Subject: [PATCH] Update chart.html, experimenting with MQTT. --- iotDashboard/mqtt.py | 4 +++ iotDashboard/templates/chart.html | 44 +++++++++++++++++++++++++++++-- iotDashboard/urls.py | 1 - iotDashboard/views.py | 6 ++--- 4 files changed, 48 insertions(+), 7 deletions(-) create mode 100644 iotDashboard/mqtt.py diff --git a/iotDashboard/mqtt.py b/iotDashboard/mqtt.py new file mode 100644 index 0000000..9c13a8f --- /dev/null +++ b/iotDashboard/mqtt.py @@ -0,0 +1,4 @@ +import paho.mqtt.subscribe as subscribe + +msg = subscribe.simple("esptest-01/sensor/tempreature/state", hostname="localhost") +print("%s %s" % (msg.topic, msg.payload)) diff --git a/iotDashboard/templates/chart.html b/iotDashboard/templates/chart.html index 7791ef9..09b3707 100644 --- a/iotDashboard/templates/chart.html +++ b/iotDashboard/templates/chart.html @@ -23,11 +23,31 @@ width: 100% !important; height: 100% !important; } + + .current-conditions { + text-align: center; + padding: 20px; + margin-bottom: 20px; + background-color: #ffffff; + border-radius: 10px; + box-shadow: 0px 0px 15px rgba(0, 0, 0, 0.1); + } + + .current-conditions h2 { + font-size: 36px; + margin: 10px 0; + } + + .current-conditions .value { + font-size: 48px; + font-weight: bold; + margin-bottom: 10px; + } -