index.html 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <!DOCTYPE html>
  2. <html lang="en" xml:lang="en">
  3. <head>
  4. <link rel="icon" href="favicon.ico?v=$COMMIT_HASH" type="image/x-icon">
  5. <link rel="apple-touch-icon" href="watermeter.svg" />
  6. <link rel="shortcut icon" href="watermeter.svg" sizes="196x196">
  7. <title>AI on the edge</title>
  8. <meta charset="UTF-8" />
  9. <meta name="viewport" content="width=device-width, initial-scale=1">
  10. <link rel="stylesheet" href="style.css?v=$COMMIT_HASH" type="text/css" >
  11. <link href="firework.css?v=$COMMIT_HASH" rel="stylesheet">
  12. <script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script>
  13. <script type="text/javascript" src="readconfigcommon.js?v=$COMMIT_HASH"></script>
  14. <script type="text/javascript" src="readconfigparam.js?v=$COMMIT_HASH"></script>
  15. <script type="text/javascript" src="jquery-3.6.0.min.js?v=$COMMIT_HASH"></script>
  16. <script type="text/javascript" src="firework.js?v=$COMMIT_HASH"></script>
  17. <script>
  18. var streamPopup;
  19. var streamFlashlight = false;
  20. var streamWindowFeatures =
  21. 'channelmode=no,directories=no,fullscreen=no,' +
  22. 'location=no,dependent=yes,menubar=no,resizable=no,scrollbars=no,' +
  23. 'status=no,toolbar=no,titlebar=no,' +
  24. 'left=10,top=250,width=640px,height=480px';
  25. function loadPage(page) {
  26. console.log("loadPage( " + page + " )");
  27. if (streamPopup) // Ensure that stream popup is closed because it's blocking web interface
  28. streamPopup.close();
  29. asyncPageLoad(page);
  30. }
  31. async function asyncPageLoad(page ) {
  32. console.log(" loading " + page + " ...");
  33. document.cookie = "page="+page + "; path=/";
  34. document.getElementById('maincontent').src = page;
  35. [].forEach.call(document.querySelectorAll('.submenu'), function (el) {
  36. el.style.visibility = 'hidden';
  37. });
  38. }
  39. function resetMenu() {
  40. [].forEach.call(document.querySelectorAll('.submenu'), function (el) {
  41. el.style.visibility = 'visible';
  42. });
  43. }
  44. function getCookie(cname) {
  45. let name = cname + "=";
  46. let decodedCookie = decodeURIComponent(document.cookie);
  47. let ca = decodedCookie.split(';');
  48. for(let i = 0; i <ca.length; i++) {
  49. let c = ca[i];
  50. while (c.charAt(0) == ' ') {
  51. c = c.substring(1);
  52. }
  53. if (c.indexOf(name) == 0) {
  54. return c.substring(name.length, c.length);
  55. }
  56. }
  57. return "";
  58. }
  59. </script>
  60. </head>
  61. <body>
  62. <div class="main">
  63. <table style="border: none; width:100%">
  64. <tr>
  65. <td style="padding-right: 10px;"><img style="width:64px; height:64px" src="favicon.ico?v=$COMMIT_HASH"></td>
  66. <td><h1 id="id_title"> Digitizer - AI on the edge</h1>
  67. <h2>An ESP32 all inclusive neural network recognition system for meter digitalization</h2>
  68. </td>
  69. </tr>
  70. </table>
  71. <div class="menu" onmouseover="resetMenu()">
  72. <ul>
  73. <li><a href="#" onclick="loadPage('overview.html?v=$COMMIT_HASH');">Overview</a></li>
  74. <li><a>Settings <i class="arrow down"></i></a>
  75. <ul class="submenu">
  76. <li><a href="#" onclick="loadPage('prevalue_set.html?v=$COMMIT_HASH');">Set "Previous Value"</a></li>
  77. <li><a href="#" onclick="loadPage('edit_config_param.html?v=$COMMIT_HASH');">Configuration</a></li>
  78. <li><a>Alignment <i class="arrow right"></i></a>
  79. <ul>
  80. <li><a href="#" onclick="loadPage('edit_reference.html?v=$COMMIT_HASH');">Reference Image</a></li>
  81. <li><a href="#" onclick="loadPage('edit_alignment.html?v=$COMMIT_HASH');">Alignment Marker</a></li>
  82. </ul>
  83. </li>
  84. <li><a><strong>R</strong>egions <strong>O</strong>f <strong>I</strong>nterest <i class="arrow right"></i></a>
  85. <ul>
  86. <li><a href="#" onclick="loadPage('edit_digits.html?v=$COMMIT_HASH');">Digit ROI</a></li>
  87. <li><a href="#" onclick="loadPage('edit_analog.html?v=$COMMIT_HASH');">Analog ROI</a></li>
  88. </ul>
  89. </li>
  90. </ul>
  91. <li><a>Data<i class="arrow down"></i></a>
  92. <ul class="submenu">
  93. <li><a href="#" onclick="loadPage(getDomainname() + '/value?full');">Recognition</a></li>
  94. <li><a>Livestream <i class="arrow right"></i></a>
  95. <ul>
  96. <li><a href="#" onclick="start_livestream(false);">Live Stream (Light off)</a></li>
  97. <li><a href="#" onclick="start_livestream(true);">Live Stream (Light on)</a></li>
  98. </ul>
  99. </li>
  100. <li><a href="#" onclick="loadPage('graph.html?v=$COMMIT_HASH');">Data Graph</a></li>
  101. <li><a href="#" onclick="loadPage('data.html?v=$COMMIT_HASH');">Data Table</a></li>
  102. <li><a href="#" onclick="loadPage(getDomainname() + '/fileserver/log/data/');">Data Files</a></li>
  103. </ul>
  104. </li>
  105. <li><a>System <i class="arrow down"></i></a>
  106. <ul class="submenu">
  107. <li><a href="#" onclick="loadPage('backup.html?v=$COMMIT_HASH');">Backup/Restore</a></li>
  108. <li><a href="#" onclick="loadPage('ota_page.html?v=$COMMIT_HASH');">OTA Update</a></li>
  109. <li><a href="#" onclick="loadPage('log.html?v=$COMMIT_HASH');">Log Viewer</a></li>
  110. <li><a href="#" onclick="loadPage(getDomainname() + '/fileserver/');">File Server</a></li>
  111. <li><a href="#" onclick="loadPage('reboot_page.html?v=$COMMIT_HASH');">Reboot</a></li>
  112. <li><a href="#" onclick="loadPage('info.html?v=$COMMIT_HASH');">Info</a></li>
  113. <li><a href="https://jomjol.github.io/AI-on-the-edge-device-docs/" target="_blank">Help</a></li>
  114. </ul>
  115. </li>
  116. <li id="ManualControl" style="display:none;"><a>Manual Control <i class="arrow down"></i></a> <!-- Workaround: Hide menu if no entry is available -->
  117. <ul class="submenu">
  118. <!--<li><a href="#" onclick="flow_start()">Start Round</a></li>--> <!-- Needs to be adapted on code side first to ensure proper user feedback -->
  119. <li id="HASendDiscovery" style="display:none;"><a href="#" onclick="HA_send_discovery()">Resend HA Discovery</a></li>
  120. </ul>
  121. </li>
  122. </ul>
  123. </div>
  124. <iframe title="maincontent" name="maincontent" class="iframe" id="maincontent"></iframe>
  125. <span id="Version" style="font-size: 10px; margin-top: -5px;padding-left: 10px;">Loading version...</span>
  126. <script type="text/javascript">
  127. LoadHostname();
  128. LoadFwVersion();
  129. LoadWebUiVersion();
  130. HA_send_discovery_visibility();
  131. if (getCookie("page") == "" || getCookie("page") == "reboot_page.html?v=$COMMIT_HASH") {
  132. document.cookie = "page=overview.html?v=$COMMIT_HASH" + "; path=/";
  133. }
  134. console.log("Loading page: " + getCookie("page"));
  135. document.getElementById('maincontent').src = getCookie("page");
  136. /*
  137. function flow_start() {
  138. var url = getDomainname() + '/flow_start';
  139. var xhttp = new XMLHttpRequest();
  140. xhttp.onreadystatechange = function() {
  141. if (this.readyState == 4 && this.status == 200) {
  142. if (xhttp.responseText.substring(0,3) == "001") {
  143. firework.launch('Flow start triggered', 'success', 5000);
  144. window.location.reload();
  145. }
  146. else if (xhttp.responseText.substring(0,3) == "002") {
  147. firework.launch('Flow start scheduled. Start after round is completed', 'success', 5000);
  148. }
  149. else if (xhttp.responseText.substring(0,3) == "099") {
  150. firework.launch('Flow start triggered, but start not possible (no flow task available)', 'danger', 5000);
  151. }
  152. }
  153. }
  154. xhttp.open("GET", url, true);
  155. xhttp.send();
  156. }
  157. */
  158. function HA_send_discovery_visibility() {
  159. loadConfig(domainname);
  160. ParseConfig();
  161. category = getConfigCategory();
  162. param = getConfigParameters();
  163. if (category["MQTT"]["enabled"] && param["MQTT"]["HomeassistantDiscovery"]["value1"] == "true") {
  164. document.getElementById("ManualControl").style.display="";
  165. document.getElementById("HASendDiscovery").style.display="";
  166. }
  167. }
  168. function HA_send_discovery() {
  169. console.log("HA Discovery scheduled");
  170. var url = getDomainname() + '/mqtt_publish_discovery';
  171. var xhttp = new XMLHttpRequest();
  172. xhttp.onreadystatechange = function() {
  173. if (this.readyState == 4 && this.status == 200) {
  174. firework.launch('Sending HA discovery topics scheduled. The sending will be processed in state "Publish to MQTT"', 'success', 5000);
  175. }
  176. }
  177. xhttp.open("GET", url, true);
  178. xhttp.send();
  179. }
  180. function start_livestream(streamFlashlight) {
  181. if (streamPopup)
  182. streamPopup.close();
  183. if (streamFlashlight)
  184. streamPopup = window.open(getDomainname() + '/stream?flashlight=true','LivestreamWithlight',streamWindowFeatures);
  185. else
  186. streamPopup = window.open(getDomainname() + '/stream','Livestream',streamWindowFeatures);
  187. streamPopup.focus();
  188. }
  189. </script>
  190. </body>
  191. </html>