Browse Source

add giessomat state

Thomas Buck 1 year ago
parent
commit
6b64afe5a2
3 changed files with 18 additions and 0 deletions
  1. 9
    0
      lights/index.html
  2. 2
    0
      lights/lights.js
  3. 7
    0
      lights/mqtt.js

+ 9
- 0
lights/index.html View File

278
                             <p>Unknown</p>
278
                             <p>Unknown</p>
279
                         </div>
279
                         </div>
280
                     </div>
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
                 </div>
290
                 </div>
282
 
291
 
283
                 <!-- Help Tab Panel -->
292
                 <!-- Help Tab Panel -->

+ 2
- 0
lights/lights.js View File

263
 subscribeSensor("livingroom/pressure", "mbar", "#livingpress", 100.0)
263
 subscribeSensor("livingroom/pressure", "mbar", "#livingpress", 100.0)
264
 subscribeSensor("livingroom/tvoc", "ppb", "#livingtvoc")
264
 subscribeSensor("livingroom/tvoc", "ppb", "#livingtvoc")
265
 subscribeSensor("livingroom/eco2", "ppm", "#livingeco2")
265
 subscribeSensor("livingroom/eco2", "ppm", "#livingeco2")
266
+
267
+subscribeSensorString("giessomat", "#giessomat")

+ 7
- 0
lights/mqtt.js View File

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
 function setTopic(topic, message) {
64
 function setTopic(topic, message) {
58
     console.log("Tx \"" + topic.toString() + "\": \"" + message.toString() + "\"")
65
     console.log("Tx \"" + topic.toString() + "\": \"" + message.toString() + "\"")
59
 
66
 

Loading…
Cancel
Save