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.

148 lines
5.5 KiB

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