MQTT smart home web interface
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <meta name="color-scheme" content="dark light">
  7. <title>Lights Control</title>
  8. <!--<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">-->
  9. <link href="https://cdn.jsdelivr.net/npm/bootstrap-dark-5@1.1.3/dist/css/bootstrap-dark.min.css" rel="stylesheet">
  10. </head>
  11. <body>
  12. <div class="container text-center">
  13. <div class="row">
  14. <div class="col">
  15. <h1>Lights Control</h1>
  16. </div>
  17. </div>
  18. <div class="row">
  19. <div class="col-2"></div>
  20. <div class="col-8">
  21. <nav>
  22. <div class="nav nav-tabs" id="nav-tab" role="tablist">
  23. <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">
  24. Livingroom
  25. </button>
  26. <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">
  27. Bathroom
  28. </button>
  29. <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">
  30. Help
  31. </button>
  32. </div>
  33. </nav>
  34. </div>
  35. <div class="col-2"></div>
  36. </div>
  37. <div class="row">
  38. <div class="col-2"></div>
  39. <div class="col-8">
  40. <hr>
  41. </div>
  42. <div class="col-2"></div>
  43. </div>
  44. <!-- Bathroom Tab Panel -->
  45. <div class="tab-content" id="nav-tabContent">
  46. <div class="tab-pane fade show active" id="nav-bathroom" role="tabpanel" aria-labelledby="nav-bathroom-tab" tabindex="0">
  47. <div class="row">
  48. <div class="col">
  49. <h2>Actors</h2>
  50. </div>
  51. </div>
  52. <div class="row">
  53. <div class="col text-end">
  54. <p>Lights<br><small>(will return to 'Auto' after 2h)</small></p>
  55. </div>
  56. <div class="col text-start">
  57. <div class="btn-group" role="group">
  58. <input type="radio" class="btn-check" name="bathroomradio" id="bathroomlightauto" autocomplete="off">
  59. <label class="btn btn-outline-primary" for="bathroomlightauto">
  60. Auto
  61. </label>
  62. <input type="radio" class="btn-check" name="bathroomradio" id="bathroomlightbig" autocomplete="off">
  63. <label class="btn btn-outline-success" for="bathroomlightbig">
  64. Big
  65. </label>
  66. <input type="radio" class="btn-check" name="bathroomradio" id="bathroomlightsmall" autocomplete="off">
  67. <label class="btn btn-outline-info" for="bathroomlightsmall">
  68. Small
  69. </label>
  70. <input type="radio" class="btn-check" name="bathroomradio" id="bathroomlightoff" autocomplete="off">
  71. <label class="btn btn-outline-dark" for="bathroomlightoff">
  72. Off
  73. </label>
  74. </div>
  75. </div>
  76. </div>
  77. <div class="row">
  78. <div class="col-2"></div>
  79. <div class="col-8">
  80. <hr>
  81. </div>
  82. <div class="col-2"></div>
  83. </div>
  84. <div class="row">
  85. <div class="col">
  86. <h2>Sensors</h2>
  87. </div>
  88. </div>
  89. <div class="row">
  90. <div class="col text-end">
  91. <p>Temperature</p>
  92. </div>
  93. <div class="col text-start" id="bathtemp">
  94. <p>Unknown</p>
  95. </div>
  96. </div>
  97. <div class="row">
  98. <div class="col text-end">
  99. <p>Relative Humidity</p>
  100. </div>
  101. <div class="col text-start" id="bathhumid">
  102. <p>Unknown</p>
  103. </div>
  104. </div>
  105. <div class="row">
  106. <div class="col text-end">
  107. <p>tVOC</p>
  108. </div>
  109. <div class="col text-start" id="bathtvoc">
  110. <p>Unknown</p>
  111. </div>
  112. </div>
  113. <div class="row">
  114. <div class="col text-end">
  115. <p>eCO<sub>2</sub></p>
  116. </div>
  117. <div class="col text-start" id="batheco2">
  118. <p>Unknown</p>
  119. </div>
  120. </div>
  121. <div class="row">
  122. <div class="col text-end">
  123. <p>Air Pressure</p>
  124. </div>
  125. <div class="col text-start" id="bathpress">
  126. <p>Unknown</p>
  127. </div>
  128. </div>
  129. </div>
  130. <!-- Livingroom Tab Panel -->
  131. <div class="tab-pane fade" id="nav-livingroom" role="tabpanel" aria-labelledby="nav-livingroom-tab" tabindex="0">
  132. <div class="row">
  133. <div class="col">
  134. <h2>Actors</h2>
  135. </div>
  136. </div>
  137. <div class="row">
  138. <div class="col text-end">
  139. <p>Workspace Lights</p>
  140. </div>
  141. <div class="col text-start">
  142. <div class="btn-group" role="group">
  143. <input type="radio" class="btn-check" name="workspaceradio" id="workspaceon" autocomplete="off">
  144. <label class="btn btn-outline-primary" for="workspaceon">
  145. On
  146. </label>
  147. <input type="radio" class="btn-check" name="workspaceradio" id="workspacebench" autocomplete="off">
  148. <label class="btn btn-outline-info" for="workspacebench">
  149. Bench
  150. </label>
  151. <input type="radio" class="btn-check" name="workspaceradio" id="workspacepc" autocomplete="off">
  152. <label class="btn btn-outline-success" for="workspacepc">
  153. PC
  154. </label>
  155. <input type="radio" class="btn-check" name="workspaceradio" id="workspaceoff" autocomplete="off">
  156. <label class="btn btn-outline-dark" for="workspaceoff">
  157. Off
  158. </label>
  159. </div>
  160. </div>
  161. </div>
  162. <div class="row">
  163. <div class="col text-end">
  164. <p>TV Lights</p>
  165. </div>
  166. <div class="col text-start">
  167. <div class="btn-group" role="group">
  168. <input type="radio" class="btn-check" name="tvradio" id="tvon" autocomplete="off">
  169. <label class="btn btn-outline-primary" for="tvon">
  170. On
  171. </label>
  172. <input type="radio" class="btn-check" name="tvradio" id="tvbox" autocomplete="off">
  173. <label class="btn btn-outline-info" for="tvbox">
  174. Box
  175. </label>
  176. <input type="radio" class="btn-check" name="tvradio" id="tvamp" autocomplete="off">
  177. <label class="btn btn-outline-success" for="tvamp">
  178. Amp
  179. </label>
  180. <input type="radio" class="btn-check" name="tvradio" id="tvoff" autocomplete="off">
  181. <label class="btn btn-outline-dark" for="tvoff">
  182. Off
  183. </label>
  184. </div>
  185. </div>
  186. </div>
  187. <div class="row">
  188. <div class="col text-end">
  189. <p>Kitchen Lights</p>
  190. </div>
  191. <div class="col text-start">
  192. <div class="btn-group" role="group">
  193. <input type="radio" class="btn-check" name="kitchenradio" id="kitchenon" autocomplete="off">
  194. <label class="btn btn-outline-primary" for="kitchenon">
  195. On
  196. </label>
  197. <input type="radio" class="btn-check" name="kitchenradio" id="kitchenoff" autocomplete="off">
  198. <label class="btn btn-outline-dark" for="kitchenoff">
  199. Off
  200. </label>
  201. </div>
  202. </div>
  203. </div>
  204. <div class="row">
  205. <div class="col-2"></div>
  206. <div class="col-8">
  207. <hr>
  208. </div>
  209. <div class="col-2"></div>
  210. </div>
  211. <div class="row">
  212. <div class="col">
  213. <h2>Sensors</h2>
  214. </div>
  215. </div>
  216. <div class="row">
  217. <div class="col text-end">
  218. <p>Temperature</p>
  219. </div>
  220. <div class="col text-start" id="livingtemp">
  221. <p>Unknown</p>
  222. </div>
  223. </div>
  224. <div class="row">
  225. <div class="col text-end">
  226. <p>Relative Humidity</p>
  227. </div>
  228. <div class="col text-start" id="livinghumid">
  229. <p>Unknown</p>
  230. </div>
  231. </div>
  232. <div class="row">
  233. <div class="col text-end">
  234. <p>tVOC</p>
  235. </div>
  236. <div class="col text-start" id="livingtvoc">
  237. <p>Unknown</p>
  238. </div>
  239. </div>
  240. <div class="row">
  241. <div class="col text-end">
  242. <p>eCO<sub>2</sub></p>
  243. </div>
  244. <div class="col text-start" id="livingeco2">
  245. <p>Unknown</p>
  246. </div>
  247. </div>
  248. <div class="row">
  249. <div class="col text-end">
  250. <p>Air Pressure</p>
  251. </div>
  252. <div class="col text-start" id="livingpress">
  253. <p>Unknown</p>
  254. </div>
  255. </div>
  256. <div class="row">
  257. <div class="col text-end">
  258. <p>Giess-o-mat</p>
  259. </div>
  260. <div class="col text-start" id="giessomat">
  261. <p>Unknown</p>
  262. </div>
  263. </div>
  264. </div>
  265. <!-- Help Tab Panel -->
  266. <div class="tab-pane fade" id="nav-help" role="tabpanel" aria-labelledby="nav-help-tab" tabindex="0">
  267. <div class="row">
  268. <div class="col">
  269. <p><a href=".">Refresh page</a></p>
  270. </div>
  271. </div>
  272. <div class="row">
  273. <div class="col-2"></div>
  274. <div class="col-8">
  275. <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>
  276. </div>
  277. <div class="col-2"></div>
  278. </div>
  279. <div class="row">
  280. <div class="col-2"></div>
  281. <div class="col-8">
  282. <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>
  283. </div>
  284. <div class="col-2"></div>
  285. </div>
  286. </div>
  287. </div>
  288. <div class="row">
  289. <div class="col-2"></div>
  290. <div class="col-8">
  291. <hr>
  292. </div>
  293. <div class="col-2"></div>
  294. </div>
  295. <div class="row">
  296. <div class="col-2"></div>
  297. <div class="col-8">
  298. <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>
  299. </div>
  300. <div class="col-2"></div>
  301. </div>
  302. </div>
  303. <!--<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous"></script>-->
  304. <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"></script>
  305. <script src="https://unpkg.com/mqtt/dist/mqtt.min.js"></script>
  306. <script src="autotab.js"></script>
  307. <script src="credentials.js"></script>
  308. <script src="mqtt.js"></script>
  309. <script src="lights.js"></script>
  310. </body>
  311. </html>