Mirror of espurna firmware for wireless switches and more
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.

120 lines
4.4 KiB

8 years ago
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>SONOFF 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. if (data.ip) $("span.ip").html(data.ip);
  19. if (data.network) $("span.network").html(data.network);
  20. if (data.status) $("span.status").html(data.status);
  21. $(":submit").prop("value", "Connect").removeAttr("disabled");
  22. }).fail(function() {
  23. $(":submit").prop("value", "Connect").removeAttr("disabled");
  24. });
  25. event.preventDefault();
  26. });
  27. });
  28. </script>
  29. </head>
  30. <body>
  31. <form id="config" action="/" method="post">
  32. <header>
  33. <h2>SONOFF Configuration</h2>
  34. <div>This form lets you define the WIFI network this SONOFF should try to join.</div>
  35. </header>
  36. <div>
  37. <p>Connection: <span class="status">{status}</span></p>
  38. <p>Network: <span class="network">{network}</span> (<span class="ip">{ip}</span>)</p>
  39. </div>
  40. <div>
  41. <label class="desc" for="ssid0">Network SSID 0</label>
  42. <div>
  43. <input id="ssid0" name="ssid0" type="text" class="field text fn" value="{ssid0}" size="8" tabindex="1">
  44. </div>
  45. </div>
  46. <div>
  47. <label class="desc" for="pass0">Network Password 0</label>
  48. <div>
  49. <input id="pass0" name="pass0" type="text" spellcheck="false" value="{pass0}" maxlength="255" tabindex="2">
  50. </div>
  51. </div>
  52. <div>
  53. <label class="desc" for="ssid1">Network SSID 1</label>
  54. <div>
  55. <input id="ssid1" name="ssid1" type="text" class="field text fn" value="{ssid1}" size="8" tabindex="3">
  56. </div>
  57. </div>
  58. <div>
  59. <label class="desc" for="pass1">Network Password 1</label>
  60. <div>
  61. <input id="pass1" name="pass1" type="text" spellcheck="false" value="{pass1}" maxlength="255" tabindex="4">
  62. </div>
  63. </div>
  64. <div>
  65. <label class="desc" for="ssid2">Network SSID 2</label>
  66. <div>
  67. <input id="ssid2" name="ssid2" type="text" class="field text fn" value="{ssid2}" size="8" tabindex="5">
  68. </div>
  69. </div>
  70. <div>
  71. <label class="desc" for="pass2">Network Password 2</label>
  72. <div>
  73. <input id="pass2" name="pass2" type="text" spellcheck="false" value="{pass2}" maxlength="255" tabindex="6">
  74. </div>
  75. </div>
  76. <div>
  77. <label class="desc" for="mqtt_server">MQTT Server</label>
  78. <div>
  79. <input id="mqtt_server" name="mqtt_server" type="text" class="field text fn" value="{mqtt_server}" size="8" tabindex="7">
  80. </div>
  81. </div>
  82. <div>
  83. <label class="desc" for="mqtt_port">MQTT Port</label>
  84. <div>
  85. <input id="mqtt_port" name="mqtt_port" type="text" spellcheck="false" value="{mqtt_port}" maxlength="255" tabindex="8">
  86. </div>
  87. </div>
  88. <div>
  89. <label class="desc" for="mqtt_topic">MQTT Topic</label>
  90. <div>
  91. <input id="mqtt_topic" name="mqtt_topic" type="text" class="field text fn" value="{mqtt_topic}" size="8" tabindex="9">
  92. </div>
  93. </div>
  94. <div>
  95. <div>
  96. <input id="submit" name="submit" type="submit" value="Connect">
  97. </div>
  98. </div>
  99. </form>
  100. </body>
  101. </html>