Fork of the espurna firmware for `mhsw` switches
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

157 lines
5.7 KiB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>{appname} - Configuration</title>
  5. <meta charset="utf-8" />
  6. <link rel="stylesheet" href="index.css" />
  7. <script src="jquery-1.12.3.min.js"></script>
  8. <script>
  9. $(function() {
  10. var updateInterval = 1000;
  11. $("#config").submit(function(event) {
  12. $(":submit").prop("value", "Wait...").attr("disabled", true);
  13. $.ajax({
  14. 'method': 'POST',
  15. 'url': '/save',
  16. 'dataType': 'json',
  17. 'data': $(this).serializeArray()
  18. }).done(function(data) {
  19. $(":submit").prop("value", "Connect").removeAttr("disabled");
  20. }).fail(function() {
  21. $(":submit").prop("value", "Connect").removeAttr("disabled");
  22. });
  23. event.preventDefault();
  24. });
  25. function update() {
  26. $.ajax({
  27. 'method': 'GET',
  28. 'url': '/status',
  29. 'dataType': 'json'
  30. }).done(function(data) {
  31. $("span.device").html(data.device);
  32. $("span.network").html(data.network.toUpperCase());
  33. $("span.ip").html(data.ip);
  34. $("span.mqtt").html(data.mqtt ? "CONNECTED" : "NOT CONNECTED");
  35. $("span.relay").html(data.relay ? "ON" : "OFF");
  36. updateInterval = parseInt(data.interval);
  37. setTimeout(update, updateInterval);
  38. }).fail(function() {
  39. setTimeout(update, updateInterval);
  40. });
  41. }
  42. update();
  43. });
  44. </script>
  45. </head>
  46. <body>
  47. <form id="config" action="/" method="post">
  48. <header>
  49. <h2>{appname} - Configuration</h2>
  50. <div>This form lets you define the WIFI network this device should try to join.</div>
  51. </header>
  52. <div>
  53. <p>Device: <span class="device"></span></p>
  54. <p>Network: <span class="network"></span></p>
  55. <p>IP: <span class="ip"></span></p>
  56. <p>MQTT: <span class="mqtt"></span></p>
  57. <p>Relay: <span class="relay"></span></p>
  58. </div>
  59. <div>
  60. <label class="desc" for="ssid0">Network SSID 0</label>
  61. <div>
  62. <input id="ssid0" name="ssid0" type="text" class="field text fn" value="{ssid0}" size="8" tabindex="1">
  63. </div>
  64. </div>
  65. <div>
  66. <label class="desc" for="pass0">Network Password 0</label>
  67. <div>
  68. <input id="pass0" name="pass0" type="text" spellcheck="false" value="{pass0}" maxlength="255" tabindex="2">
  69. </div>
  70. </div>
  71. <div>
  72. <label class="desc" for="ssid1">Network SSID 1</label>
  73. <div>
  74. <input id="ssid1" name="ssid1" type="text" class="field text fn" value="{ssid1}" size="8" tabindex="3">
  75. </div>
  76. </div>
  77. <div>
  78. <label class="desc" for="pass1">Network Password 1</label>
  79. <div>
  80. <input id="pass1" name="pass1" type="text" spellcheck="false" value="{pass1}" maxlength="255" tabindex="4">
  81. </div>
  82. </div>
  83. <div>
  84. <label class="desc" for="ssid2">Network SSID 2</label>
  85. <div>
  86. <input id="ssid2" name="ssid2" type="text" class="field text fn" value="{ssid2}" size="8" tabindex="5">
  87. </div>
  88. </div>
  89. <div>
  90. <label class="desc" for="pass2">Network Password 2</label>
  91. <div>
  92. <input id="pass2" name="pass2" type="text" spellcheck="false" value="{pass2}" maxlength="255" tabindex="6">
  93. </div>
  94. </div>
  95. <div>
  96. <label class="desc" for="mqttServer">MQTT Server</label>
  97. <div>
  98. <input id="mqttServer" name="mqttServer" type="text" class="field text fn" value="{mqttServer}" size="8" tabindex="7">
  99. </div>
  100. </div>
  101. <div>
  102. <label class="desc" for="mqttPort">MQTT Port</label>
  103. <div>
  104. <input id="mqttPort" name="mqttPort" type="text" spellcheck="false" value="{mqttPort}" maxlength="255" tabindex="8">
  105. </div>
  106. </div>
  107. <div>
  108. <label class="desc" for="mqttTopic">MQTT Topic</label>
  109. <div>
  110. <input id="mqttTopic" name="mqttTopic" type="text" class="field text fn" value="{mqttTopic}" size="8" tabindex="9">
  111. </div>
  112. </div>
  113. <div>
  114. <label class="desc" for="rfChannel">RF Channel</label>
  115. <div>
  116. <input id="rfChannel" name="rfChannel" type="text" spellcheck="false" value="{rfChannel}" maxlength="255" tabindex="10">
  117. </div>
  118. </div>
  119. <div>
  120. <label class="desc" for="rfDevice">RF Device</label>
  121. <div>
  122. <input id="rfDevice" name="rfDevice" type="text" class="field text fn" value="{rfDevice}" size="8" tabindex="11">
  123. </div>
  124. </div>
  125. <div>
  126. <div>
  127. <input id="submit" name="submit" type="submit" value="Connect">
  128. </div>
  129. </div>
  130. </form>
  131. </body>
  132. </html>