Thomas Buck hace 2 años
padre
commit
b99e7a9296
Se han modificado 3 ficheros con 69 adiciones y 43 borrados
  1. 1
    1
      README.md
  2. 65
    42
      lights/index.html
  3. 3
    0
      uploadlocal.sh

+ 1
- 1
README.md Ver fichero

@@ -2,7 +2,7 @@
2 2
 
3 3
 Simple Bootstrap webinterface to control room lights via MQTT.
4 4
 
5
-## Quick started
5
+## Getting Started
6 6
 
7 7
 To set up the MQTT broker credentials, run the following commands:
8 8
 

+ 65
- 42
lights/index.html Ver fichero

@@ -17,24 +17,32 @@
17 17
                 </div>
18 18
             </div>
19 19
 
20
-            <nav>
21
-                <div class="nav nav-tabs" id="nav-tab" role="tablist">
22
-                    <button class="nav-link" id="nav-livingroom-tab" data-bs-toggle="tab" data-bs-target="#nav-livingroom" type="button" role="tab" aria-controls="nav-livingroom" aria-selected="false">
23
-                        Livingroom
24
-                    </button>
25
-                    <button class="nav-link active" id="nav-bathroom-tab" data-bs-toggle="tab" data-bs-target="#nav-bathroom" type="button" role="tab" aria-controls="nav-bathroom" aria-selected="true">
26
-                        Bathroom
27
-                    </button>
28
-                    <button class="nav-link" id="nav-help-tab" data-bs-toggle="tab" data-bs-target="#nav-help" type="button" role="tab" aria-controls="nav-help" aria-selected="false">
29
-                        Help
30
-                    </button>
20
+            <div class="row">
21
+                <div class="col-2"></div>
22
+                <div class="col-8">
23
+                    <nav>
24
+                        <div class="nav nav-tabs" id="nav-tab" role="tablist">
25
+                            <button class="nav-link" id="nav-livingroom-tab" data-bs-toggle="tab" data-bs-target="#nav-livingroom" type="button" role="tab" aria-controls="nav-livingroom" aria-selected="false">
26
+                                Livingroom
27
+                            </button>
28
+                            <button class="nav-link active" id="nav-bathroom-tab" data-bs-toggle="tab" data-bs-target="#nav-bathroom" type="button" role="tab" aria-controls="nav-bathroom" aria-selected="true">
29
+                                Bathroom
30
+                            </button>
31
+                            <button class="nav-link" id="nav-help-tab" data-bs-toggle="tab" data-bs-target="#nav-help" type="button" role="tab" aria-controls="nav-help" aria-selected="false">
32
+                                Help
33
+                            </button>
34
+                        </div>
35
+                    </nav>
31 36
                 </div>
32
-            </nav>
37
+                <div class="col-2"></div>
38
+            </div>
33 39
 
34 40
             <div class="row">
35
-                <div class="col">
41
+                <div class="col-2"></div>
42
+                <div class="col-8">
36 43
                     <hr>
37 44
                 </div>
45
+                <div class="col-2"></div>
38 46
             </div>
39 47
 
40 48
             <div class="tab-content" id="nav-tabContent">
@@ -46,10 +54,10 @@
46 54
                     </div>
47 55
 
48 56
                     <div class="row">
49
-                        <div class="col">
50
-                            <p>Lights</p>
57
+                        <div class="col text-end">
58
+                            <p>Lights<br><small>(will return to 'Auto' after 2h)</small></p>
51 59
                         </div>
52
-                        <div class="col">
60
+                        <div class="col text-start">
53 61
                             <div class="btn-group" role="group">
54 62
                                 <input type="radio" class="btn-check" name="bathroomradio" id="bathroomlightauto" autocomplete="off">
55 63
                                 <label class="btn btn-outline-primary" for="bathroomlightauto">
@@ -72,9 +80,11 @@
72 80
                     </div>
73 81
 
74 82
                     <div class="row">
75
-                        <div class="col">
83
+                        <div class="col-2"></div>
84
+                        <div class="col-8">
76 85
                             <hr>
77 86
                         </div>
87
+                        <div class="col-2"></div>
78 88
                     </div>
79 89
 
80 90
                     <div class="row">
@@ -84,46 +94,46 @@
84 94
                     </div>
85 95
 
86 96
                     <div class="row">
87
-                        <div class="col">
97
+                        <div class="col text-end">
88 98
                             <p>Temperature</p>
89 99
                         </div>
90
-                        <div class="col" id="bathtemp">
100
+                        <div class="col text-start" id="bathtemp">
91 101
                             <p>Unknown</p>
92 102
                         </div>
93 103
                     </div>
94 104
 
95 105
                     <div class="row">
96
-                        <div class="col">
106
+                        <div class="col text-end">
97 107
                             <p>Relative Humidity</p>
98 108
                         </div>
99
-                        <div class="col" id="bathhumid">
109
+                        <div class="col text-start" id="bathhumid">
100 110
                             <p>Unknown</p>
101 111
                         </div>
102 112
                     </div>
103 113
 
104 114
                     <div class="row">
105
-                        <div class="col">
115
+                        <div class="col text-end">
106 116
                             <p>tVOC</p>
107 117
                         </div>
108
-                        <div class="col" id="bathtvoc">
118
+                        <div class="col text-start" id="bathtvoc">
109 119
                             <p>Unknown</p>
110 120
                         </div>
111 121
                     </div>
112 122
 
113 123
                     <div class="row">
114
-                        <div class="col">
115
-                            <p>eCo2</p>
124
+                        <div class="col text-end">
125
+                            <p>eCO2</p>
116 126
                         </div>
117
-                        <div class="col" id="batheco2">
127
+                        <div class="col text-start" id="batheco2">
118 128
                             <p>Unknown</p>
119 129
                         </div>
120 130
                     </div>
121 131
 
122 132
                     <div class="row">
123
-                        <div class="col">
133
+                        <div class="col text-end">
124 134
                             <p>Air Pressure</p>
125 135
                         </div>
126
-                        <div class="col" id="bathpress">
136
+                        <div class="col text-start" id="bathpress">
127 137
                             <p>Unknown</p>
128 138
                         </div>
129 139
                     </div>
@@ -137,10 +147,10 @@
137 147
                     </div>
138 148
 
139 149
                     <div class="row">
140
-                        <div class="col">
150
+                        <div class="col text-end">
141 151
                             <p>Workspace Lights</p>
142 152
                         </div>
143
-                        <div class="col">
153
+                        <div class="col text-start">
144 154
                             <div class="btn-group" role="group">
145 155
                                 <input type="radio" class="btn-check" name="workspaceradio" id="workspaceon" autocomplete="off">
146 156
                                 <label class="btn btn-outline-primary" for="workspaceon">
@@ -155,10 +165,10 @@
155 165
                     </div>
156 166
 
157 167
                     <div class="row">
158
-                        <div class="col">
168
+                        <div class="col text-end">
159 169
                             <p>TV Lights</p>
160 170
                         </div>
161
-                        <div class="col">
171
+                        <div class="col text-start">
162 172
                             <div class="btn-group" role="group">
163 173
                                 <input type="radio" class="btn-check" name="tvradio" id="tvon" autocomplete="off">
164 174
                                 <label class="btn btn-outline-primary" for="tvon">
@@ -173,10 +183,10 @@
173 183
                     </div>
174 184
 
175 185
                     <div class="row">
176
-                        <div class="col">
186
+                        <div class="col text-end">
177 187
                             <p>Kitchen Lights</p>
178 188
                         </div>
179
-                        <div class="col">
189
+                        <div class="col text-start">
180 190
                             <div class="btn-group" role="group">
181 191
                                 <input type="radio" class="btn-check" name="kitchenradio" id="kitchenon" autocomplete="off">
182 192
                                 <label class="btn btn-outline-primary" for="kitchenon">
@@ -198,24 +208,37 @@
198 208
                         </div>
199 209
                     </div>
200 210
                     <div class="row">
201
-                        <div class="col">
211
+                        <div class="col-2"></div>
212
+                        <div class="col-8">
202 213
                             <p>Please wait after opening the page until the buttons change to reflect the current state of the lights. If that doesn't happen after a couple of seconds, there is probably a connection problem.</p>
203 214
                         </div>
215
+                        <div class="col-2"></div>
204 216
                     </div>
205 217
                     <div class="row">
206
-                        <div class="col">
218
+                        <div class="col-2"></div>
219
+                        <div class="col-8">
207 220
                             <p><b>Please note:</b> this only works when the MQTT broker and the NodeRED logic are working properly. Also not all web browsers support web socket connections to the MQTT broker. Firefox gives problems, so try a Chromium based browser instead.</p>
208 221
                         </div>
222
+                        <div class="col-2"></div>
209 223
                     </div>
210 224
                 </div>
211 225
             </div>
212 226
 
213 227
             <div class="row">
214
-                <div class="col">
228
+                <div class="col-2"></div>
229
+                <div class="col-8">
215 230
                     <hr>
216 231
                 </div>
232
+                <div class="col-2"></div>
217 233
             </div>
218 234
 
235
+            <div class="row">
236
+                <div class="col-2"></div>
237
+                <div class="col-8">
238
+                    <p class="text-muted">By <a class="text-decoration-none" href="https://www.xythobuz.de">xythobuz</a>. <a class="text-decoration-none" href="https://git.xythobuz.de/thomas/lights-web">Source</a>.</p>
239
+                </div>
240
+                <div class="col-2"></div>
241
+            </div>
219 242
         </div>
220 243
 
221 244
         <!--<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous"></script>-->
@@ -275,23 +298,23 @@
275 298
             // handle bathroom sensors
276 299
             subscribeTopic("bathroom/temperature", function (msg) {
277 300
                 const txt = document.querySelector("#bathtemp")
278
-                txt.innerHTML = "<p>" + msg + " °C</p>"
301
+                txt.innerHTML = "<p>" + parseInt(msg) + " °C</p>"
279 302
             })
280 303
             subscribeTopic("bathroom/humidity", function (msg) {
281 304
                 const txt = document.querySelector("#bathhumid")
282
-                txt.innerHTML = "<p>" + msg + " %</p>"
305
+                txt.innerHTML = "<p>" + parseInt(msg) + " %</p>"
283 306
             })
284 307
             subscribeTopic("bathroom/pressure", function (msg) {
285 308
                 const txt = document.querySelector("#bathpress")
286
-                txt.innerHTML = "<p>" + msg + " Pa</p>"
309
+                txt.innerHTML = "<p>" + parseInt(msg / 100.0) + " mbar</p>"
287 310
             })
288 311
             subscribeTopic("bathroom/tvoc", function (msg) {
289 312
                 const txt = document.querySelector("#bathtvoc")
290
-                txt.innerHTML = "<p>" + msg + "</p>"
313
+                txt.innerHTML = "<p>" + parseInt(msg) + " ppb</p>"
291 314
             })
292 315
             subscribeTopic("bathroom/eco2", function (msg) {
293 316
                 const txt = document.querySelector("#batheco2")
294
-                txt.innerHTML = "<p>" + msg + " ppm</p>"
317
+                txt.innerHTML = "<p>" + parseInt(msg) + " ppm</p>"
295 318
             })
296 319
         </script>
297 320
     </body>

+ 3
- 0
uploadlocal.sh Ver fichero

@@ -0,0 +1,3 @@
1
+#!/usr/bin/bash
2
+
3
+scp -r lights iot-root:/var/www/lights-web/

Loading…
Cancelar
Guardar