Bladeren bron

add giessomat state

Thomas Buck 1 jaar geleden
bovenliggende
commit
6b64afe5a2
3 gewijzigde bestanden met toevoegingen van 18 en 0 verwijderingen
  1. 9
    0
      lights/index.html
  2. 2
    0
      lights/lights.js
  3. 7
    0
      lights/mqtt.js

+ 9
- 0
lights/index.html Bestand weergeven

@@ -278,6 +278,15 @@
278 278
                             <p>Unknown</p>
279 279
                         </div>
280 280
                     </div>
281
+
282
+                    <div class="row">
283
+                        <div class="col text-end">
284
+                            <p>Giess-o-mat</p>
285
+                        </div>
286
+                        <div class="col text-start" id="giessomat">
287
+                            <p>Unknown</p>
288
+                        </div>
289
+                    </div>
281 290
                 </div>
282 291
 
283 292
                 <!-- Help Tab Panel -->

+ 2
- 0
lights/lights.js Bestand weergeven

@@ -263,3 +263,5 @@ subscribeSensor("livingroom/humidity", "%", "#livinghumid")
263 263
 subscribeSensor("livingroom/pressure", "mbar", "#livingpress", 100.0)
264 264
 subscribeSensor("livingroom/tvoc", "ppb", "#livingtvoc")
265 265
 subscribeSensor("livingroom/eco2", "ppm", "#livingeco2")
266
+
267
+subscribeSensorString("giessomat", "#giessomat")

+ 7
- 0
lights/mqtt.js Bestand weergeven

@@ -54,6 +54,13 @@ function subscribeSensor(topic, unit, selector, divisor = 1.0) {
54 54
     })
55 55
 }
56 56
 
57
+function subscribeSensorString(topic, selector) {
58
+    subscribeTopic(topic, function (msg) {
59
+        const txt = document.querySelector(selector)
60
+        txt.innerHTML = "<p>" + msg + "</p>"
61
+    })
62
+}
63
+
57 64
 function setTopic(topic, message) {
58 65
     console.log("Tx \"" + topic.toString() + "\": \"" + message.toString() + "\"")
59 66
 

Laden…
Annuleren
Opslaan