Browse Source

tweak layout

Thomas Buck 2 years ago
parent
commit
b99e7a9296
3 changed files with 69 additions and 43 deletions
  1. 1
    1
      README.md
  2. 65
    42
      lights/index.html
  3. 3
    0
      uploadlocal.sh

+ 1
- 1
README.md View File

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

+ 65
- 42
lights/index.html View File

17
                 </div>
17
                 </div>
18
             </div>
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
                 </div>
36
                 </div>
32
-            </nav>
37
+                <div class="col-2"></div>
38
+            </div>
33
 
39
 
34
             <div class="row">
40
             <div class="row">
35
-                <div class="col">
41
+                <div class="col-2"></div>
42
+                <div class="col-8">
36
                     <hr>
43
                     <hr>
37
                 </div>
44
                 </div>
45
+                <div class="col-2"></div>
38
             </div>
46
             </div>
39
 
47
 
40
             <div class="tab-content" id="nav-tabContent">
48
             <div class="tab-content" id="nav-tabContent">
46
                     </div>
54
                     </div>
47
 
55
 
48
                     <div class="row">
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
                         </div>
59
                         </div>
52
-                        <div class="col">
60
+                        <div class="col text-start">
53
                             <div class="btn-group" role="group">
61
                             <div class="btn-group" role="group">
54
                                 <input type="radio" class="btn-check" name="bathroomradio" id="bathroomlightauto" autocomplete="off">
62
                                 <input type="radio" class="btn-check" name="bathroomradio" id="bathroomlightauto" autocomplete="off">
55
                                 <label class="btn btn-outline-primary" for="bathroomlightauto">
63
                                 <label class="btn btn-outline-primary" for="bathroomlightauto">
72
                     </div>
80
                     </div>
73
 
81
 
74
                     <div class="row">
82
                     <div class="row">
75
-                        <div class="col">
83
+                        <div class="col-2"></div>
84
+                        <div class="col-8">
76
                             <hr>
85
                             <hr>
77
                         </div>
86
                         </div>
87
+                        <div class="col-2"></div>
78
                     </div>
88
                     </div>
79
 
89
 
80
                     <div class="row">
90
                     <div class="row">
84
                     </div>
94
                     </div>
85
 
95
 
86
                     <div class="row">
96
                     <div class="row">
87
-                        <div class="col">
97
+                        <div class="col text-end">
88
                             <p>Temperature</p>
98
                             <p>Temperature</p>
89
                         </div>
99
                         </div>
90
-                        <div class="col" id="bathtemp">
100
+                        <div class="col text-start" id="bathtemp">
91
                             <p>Unknown</p>
101
                             <p>Unknown</p>
92
                         </div>
102
                         </div>
93
                     </div>
103
                     </div>
94
 
104
 
95
                     <div class="row">
105
                     <div class="row">
96
-                        <div class="col">
106
+                        <div class="col text-end">
97
                             <p>Relative Humidity</p>
107
                             <p>Relative Humidity</p>
98
                         </div>
108
                         </div>
99
-                        <div class="col" id="bathhumid">
109
+                        <div class="col text-start" id="bathhumid">
100
                             <p>Unknown</p>
110
                             <p>Unknown</p>
101
                         </div>
111
                         </div>
102
                     </div>
112
                     </div>
103
 
113
 
104
                     <div class="row">
114
                     <div class="row">
105
-                        <div class="col">
115
+                        <div class="col text-end">
106
                             <p>tVOC</p>
116
                             <p>tVOC</p>
107
                         </div>
117
                         </div>
108
-                        <div class="col" id="bathtvoc">
118
+                        <div class="col text-start" id="bathtvoc">
109
                             <p>Unknown</p>
119
                             <p>Unknown</p>
110
                         </div>
120
                         </div>
111
                     </div>
121
                     </div>
112
 
122
 
113
                     <div class="row">
123
                     <div class="row">
114
-                        <div class="col">
115
-                            <p>eCo2</p>
124
+                        <div class="col text-end">
125
+                            <p>eCO2</p>
116
                         </div>
126
                         </div>
117
-                        <div class="col" id="batheco2">
127
+                        <div class="col text-start" id="batheco2">
118
                             <p>Unknown</p>
128
                             <p>Unknown</p>
119
                         </div>
129
                         </div>
120
                     </div>
130
                     </div>
121
 
131
 
122
                     <div class="row">
132
                     <div class="row">
123
-                        <div class="col">
133
+                        <div class="col text-end">
124
                             <p>Air Pressure</p>
134
                             <p>Air Pressure</p>
125
                         </div>
135
                         </div>
126
-                        <div class="col" id="bathpress">
136
+                        <div class="col text-start" id="bathpress">
127
                             <p>Unknown</p>
137
                             <p>Unknown</p>
128
                         </div>
138
                         </div>
129
                     </div>
139
                     </div>
137
                     </div>
147
                     </div>
138
 
148
 
139
                     <div class="row">
149
                     <div class="row">
140
-                        <div class="col">
150
+                        <div class="col text-end">
141
                             <p>Workspace Lights</p>
151
                             <p>Workspace Lights</p>
142
                         </div>
152
                         </div>
143
-                        <div class="col">
153
+                        <div class="col text-start">
144
                             <div class="btn-group" role="group">
154
                             <div class="btn-group" role="group">
145
                                 <input type="radio" class="btn-check" name="workspaceradio" id="workspaceon" autocomplete="off">
155
                                 <input type="radio" class="btn-check" name="workspaceradio" id="workspaceon" autocomplete="off">
146
                                 <label class="btn btn-outline-primary" for="workspaceon">
156
                                 <label class="btn btn-outline-primary" for="workspaceon">
155
                     </div>
165
                     </div>
156
 
166
 
157
                     <div class="row">
167
                     <div class="row">
158
-                        <div class="col">
168
+                        <div class="col text-end">
159
                             <p>TV Lights</p>
169
                             <p>TV Lights</p>
160
                         </div>
170
                         </div>
161
-                        <div class="col">
171
+                        <div class="col text-start">
162
                             <div class="btn-group" role="group">
172
                             <div class="btn-group" role="group">
163
                                 <input type="radio" class="btn-check" name="tvradio" id="tvon" autocomplete="off">
173
                                 <input type="radio" class="btn-check" name="tvradio" id="tvon" autocomplete="off">
164
                                 <label class="btn btn-outline-primary" for="tvon">
174
                                 <label class="btn btn-outline-primary" for="tvon">
173
                     </div>
183
                     </div>
174
 
184
 
175
                     <div class="row">
185
                     <div class="row">
176
-                        <div class="col">
186
+                        <div class="col text-end">
177
                             <p>Kitchen Lights</p>
187
                             <p>Kitchen Lights</p>
178
                         </div>
188
                         </div>
179
-                        <div class="col">
189
+                        <div class="col text-start">
180
                             <div class="btn-group" role="group">
190
                             <div class="btn-group" role="group">
181
                                 <input type="radio" class="btn-check" name="kitchenradio" id="kitchenon" autocomplete="off">
191
                                 <input type="radio" class="btn-check" name="kitchenradio" id="kitchenon" autocomplete="off">
182
                                 <label class="btn btn-outline-primary" for="kitchenon">
192
                                 <label class="btn btn-outline-primary" for="kitchenon">
198
                         </div>
208
                         </div>
199
                     </div>
209
                     </div>
200
                     <div class="row">
210
                     <div class="row">
201
-                        <div class="col">
211
+                        <div class="col-2"></div>
212
+                        <div class="col-8">
202
                             <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>
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
                         </div>
214
                         </div>
215
+                        <div class="col-2"></div>
204
                     </div>
216
                     </div>
205
                     <div class="row">
217
                     <div class="row">
206
-                        <div class="col">
218
+                        <div class="col-2"></div>
219
+                        <div class="col-8">
207
                             <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>
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
                         </div>
221
                         </div>
222
+                        <div class="col-2"></div>
209
                     </div>
223
                     </div>
210
                 </div>
224
                 </div>
211
             </div>
225
             </div>
212
 
226
 
213
             <div class="row">
227
             <div class="row">
214
-                <div class="col">
228
+                <div class="col-2"></div>
229
+                <div class="col-8">
215
                     <hr>
230
                     <hr>
216
                 </div>
231
                 </div>
232
+                <div class="col-2"></div>
217
             </div>
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
         </div>
242
         </div>
220
 
243
 
221
         <!--<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous"></script>-->
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
             // handle bathroom sensors
298
             // handle bathroom sensors
276
             subscribeTopic("bathroom/temperature", function (msg) {
299
             subscribeTopic("bathroom/temperature", function (msg) {
277
                 const txt = document.querySelector("#bathtemp")
300
                 const txt = document.querySelector("#bathtemp")
278
-                txt.innerHTML = "<p>" + msg + " °C</p>"
301
+                txt.innerHTML = "<p>" + parseInt(msg) + " °C</p>"
279
             })
302
             })
280
             subscribeTopic("bathroom/humidity", function (msg) {
303
             subscribeTopic("bathroom/humidity", function (msg) {
281
                 const txt = document.querySelector("#bathhumid")
304
                 const txt = document.querySelector("#bathhumid")
282
-                txt.innerHTML = "<p>" + msg + " %</p>"
305
+                txt.innerHTML = "<p>" + parseInt(msg) + " %</p>"
283
             })
306
             })
284
             subscribeTopic("bathroom/pressure", function (msg) {
307
             subscribeTopic("bathroom/pressure", function (msg) {
285
                 const txt = document.querySelector("#bathpress")
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
             subscribeTopic("bathroom/tvoc", function (msg) {
311
             subscribeTopic("bathroom/tvoc", function (msg) {
289
                 const txt = document.querySelector("#bathtvoc")
312
                 const txt = document.querySelector("#bathtvoc")
290
-                txt.innerHTML = "<p>" + msg + "</p>"
313
+                txt.innerHTML = "<p>" + parseInt(msg) + " ppb</p>"
291
             })
314
             })
292
             subscribeTopic("bathroom/eco2", function (msg) {
315
             subscribeTopic("bathroom/eco2", function (msg) {
293
                 const txt = document.querySelector("#batheco2")
316
                 const txt = document.querySelector("#batheco2")
294
-                txt.innerHTML = "<p>" + msg + " ppm</p>"
317
+                txt.innerHTML = "<p>" + parseInt(msg) + " ppm</p>"
295
             })
318
             })
296
         </script>
319
         </script>
297
     </body>
320
     </body>

+ 3
- 0
uploadlocal.sh View File

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

Loading…
Cancel
Save