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.

470 lines
25 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
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
8 years ago
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>ESPurna 0.0.0</title>
  5. <meta charset="utf-8" />
  6. <link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
  7. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  8. <!-- build:css style.css -->
  9. <link rel="stylesheet" href="pure-min.css" />
  10. <link rel="stylesheet" href="side-menu.css" />
  11. <link rel="stylesheet" href="grids-responsive-min.css" />
  12. <link rel="stylesheet" href="checkboxes.css" />
  13. <link rel="stylesheet" href="custom.css" />
  14. <!-- endbuild -->
  15. </head>
  16. <body>
  17. <div id="layout">
  18. <a href="#menu" id="menuLink" class="menu-link">
  19. <span></span>
  20. </a>
  21. <div id="menu">
  22. <div class="pure-menu">
  23. <span class="pure-menu-heading">ESPurna 0.0.0</span>
  24. <ul class="pure-menu-list">
  25. <li class="pure-menu-item">
  26. <a href="#" class="pure-menu-link" data="panel-status">STATUS</a>
  27. </li>
  28. <li class="pure-menu-item">
  29. <a href="#" class="pure-menu-link" data="panel-general">GENERAL</a>
  30. </li>
  31. <li class="pure-menu-item">
  32. <a href="#" class="pure-menu-link" data="panel-security">SECURITY</a>
  33. </li>
  34. <li class="pure-menu-item">
  35. <a href="#" class="pure-menu-link" data="panel-wifi">WIFI</a>
  36. </li>
  37. <li class="pure-menu-item">
  38. <a href="#" class="pure-menu-link" data="panel-mqtt">MQTT</a>
  39. </li>
  40. <li class="pure-menu-item module module-dcz">
  41. <a href="#" class="pure-menu-link" data="panel-domoticz">DOMOTICZ</a>
  42. </li>
  43. <li class="pure-menu-item module module-pow">
  44. <a href="#" class="pure-menu-link" data="panel-power">POWER</a>
  45. </li>
  46. </ul>
  47. <div class="main-buttons">
  48. <button class="pure-button button-update">Update</button>
  49. <button class="pure-button button-reconnect">Reconnect</button>
  50. <button class="pure-button button-reset">Reset</button>
  51. </div>
  52. </div>
  53. </div>
  54. <div class="content">
  55. <div class="panel" id="panel-status" style="display: block;">
  56. <div class="header">
  57. <h1>STATUS</h1>
  58. <h2>Current configuration</h2>
  59. </div>
  60. <div class="page">
  61. <form class="pure-form pure-form-aligned">
  62. <fieldset>
  63. <div class="pure-g">
  64. <label class="pure-u-1 pure-u-sm-1-4" for="manufacturer">Manufacturer</label>
  65. <input class="pure-u-1 pure-u-sm-3-4" type="text" name="manufacturer" readonly />
  66. </div>
  67. <div class="pure-g">
  68. <label class="pure-u-1 pure-u-sm-1-4" for="device">Device</label>
  69. <input class="pure-u-1 pure-u-sm-3-4" type="text" name="device" readonly />
  70. </div>
  71. <div class="pure-g">
  72. <label class="pure-u-1 pure-u-sm-1-4" for="chipid">Chip ID</label>
  73. <input class="pure-u-1 pure-u-sm-3-4" type="text" name="chipid" readonly />
  74. </div>
  75. <div class="pure-g">
  76. <label class="pure-u-1 pure-u-sm-1-4" for="mac">MAC</label>
  77. <input class="pure-u-1 pure-u-sm-3-4" type="text" name="mac" readonly />
  78. </div>
  79. <div class="pure-g">
  80. <label class="pure-u-1 pure-u-sm-1-4" for="network">Network</label>
  81. <input class="pure-u-1 pure-u-sm-3-4" type="text" name="network" readonly />
  82. </div>
  83. <div class="pure-g">
  84. <label class="pure-u-1 pure-u-sm-1-4" for="deviceip">IP</label>
  85. <input class="pure-u-1 pure-u-sm-3-4" type="text" name="deviceip" readonly />
  86. </div>
  87. <div class="pure-g">
  88. <label class="pure-u-1 pure-u-sm-1-4" for="mqtt">MQTT Status</label>
  89. <input class="pure-u-1 pure-u-sm-3-4" type="text" name="mqttStatus" readonly />
  90. </div>
  91. <div class="pure-g module module-ds">
  92. <label class="pure-u-1 pure-u-sm-1-4" for="dsTmp">Temperature (ºC)</label>
  93. <input class="pure-u-1 pure-u-sm-3-4" type="text" name="dsTmp" readonly />
  94. </div>
  95. <div class="pure-g module module-dht">
  96. <label class="pure-u-1 pure-u-sm-1-4" for="dhtTmp">Temperature (ºC)</label>
  97. <input class="pure-u-1 pure-u-sm-3-4" type="text" name="dhtTmp" readonly />
  98. </div>
  99. <div class="pure-g module module-dht">
  100. <label class="pure-u-1 pure-u-sm-1-4" for="dhtHum">Humidity (%)</label>
  101. <input class="pure-u-1 pure-u-sm-3-4" type="text" name="dhtHum" readonly />
  102. </div>
  103. <div class="pure-g module module-pow">
  104. <label class="pure-u-1 pure-u-sm-1-4" for="powActivePower">Power (W)</label>
  105. <input class="pure-u-1 pure-u-sm-3-4" type="text" name="powActivePower" readonly />
  106. </div>
  107. <div id="relays">
  108. </div>
  109. </fieldset>
  110. </form>
  111. </div>
  112. </div>
  113. <form id="formSave" class="pure-form" action="/" method="post">
  114. <div class="panel" id="panel-general">
  115. <div class="header">
  116. <h1>GENERAL</h1>
  117. <h2>General configuration values</h2>
  118. </div>
  119. <div class="page">
  120. <fieldset>
  121. <div class="pure-g">
  122. <label class="pure-u-1 pure-u-md-1-4" for="hostname">Hostname</label>
  123. <input name="hostname" class="pure-u-1 pure-u-md-3-4" type="text" tabindex="1" />
  124. <div class="pure-u-0 pure-u-md-1-4">&nbsp;</div>
  125. <div class="pure-u-1 pure-u-md-3-4 hint">This name will identify this device in your network (http://&lt;hostname&gt;.local). For this setting to take effect you should restart the wifi interface clicking the "Reconnect" button.</div>
  126. </div>
  127. <div class="pure-g">
  128. <label class="pure-u-1 pure-u-md-1-4" for="relayMode">Relay boot mode</label>
  129. <div class="pure-u-1 pure-u-md-3-4">
  130. <select name="relayMode" class="pure-u-1-2" tabindex="2">
  131. <option value="0">Always OFF</a>
  132. <option value="1">Always ON</a>
  133. <option value="2">Same as before</a>
  134. </select>
  135. </div>
  136. <div class="pure-u-0 pure-u-md-1-4">&nbsp;</div>
  137. <div class="pure-u-1 pure-u-md-3-4 hint">Here you can define what will be the status of the relay after a reboot.</div>
  138. </div>
  139. <div class="pure-g module module-multirelay">
  140. <label class="pure-u-1 pure-u-md-1-4" for="relaySync">Relay sync mode</label>
  141. <div class="pure-u-1 pure-u-md-3-4">
  142. <select name="relaySync" class="pure-u-1-2" tabindex="3">
  143. <option value="0">No synchonisation</a>
  144. <option value="1">Zero or one relays active</a>
  145. <option value="2">One and just one relay active</a>
  146. <option value="3">All synchonised</a>
  147. </select>
  148. </div>
  149. <div class="pure-u-0 pure-u-md-1-4">&nbsp;</div>
  150. <div class="pure-u-1 pure-u-md-3-4 hint">Define how the different relays should be synchronized.</div>
  151. </div>
  152. <div class="pure-g">
  153. <label class="pure-u-1 pure-u-md-1-4" for="relayPulseMode">Relay pulse mode</label>
  154. <div class="pure-u-1 pure-u-md-3-4">
  155. <select name="relayPulseMode" class="pure-u-1-2" tabindex="4">
  156. <option value="0">Don't pulse</a>
  157. <option value="1">Normally OFF (stays on for a brief interval)</a>
  158. <option value="2">Normally ON (stays off for a brief interval)</a>
  159. </select>
  160. </div>
  161. <div class="pure-u-0 pure-u-md-1-4">&nbsp;</div>
  162. <div class="pure-u-1 pure-u-md-3-4 hint">When pulse mode is enabled the relay will automatically switch back to its normal state after the pulse time (below).</div>
  163. </div>
  164. <div class="pure-g">
  165. <label class="pure-u-1 pure-u-md-1-4" for="relayPulseTime">Relay pulse time</label>
  166. <input name="relayPulseTime" class="pure-u-1 pure-u-md-3-4" type="number" min="1" tabindex="5" />
  167. <div class="pure-u-0 pure-u-md-1-4">&nbsp;</div>
  168. <div class="pure-u-1 pure-u-md-3-4 hint">Pulse time in seconds.</div>
  169. </div>
  170. <div class="pure-g module module-fauxmo">
  171. <div class="pure-u-1 pure-u-sm-1-4"><label for="fauxmoEnabled">Enable WeMo emulation</label></div>
  172. <div class="pure-u-1 pure-u-sm-1-4"><input type="checkbox" name="fauxmoEnabled" tabindex="6" /></div>
  173. </div>
  174. </fieldset>
  175. </div>
  176. </div>
  177. <div class="panel" id="panel-security">
  178. <div class="header">
  179. <h1>SECURITY</h1>
  180. <h2>Device security settings</h2>
  181. </div>
  182. <div class="page">
  183. <fieldset>
  184. <div class="pure-g">
  185. <label class="pure-u-1 pure-u-md-1-4" for="adminPass1">Admin password</label>
  186. <input name="adminPass1" class="pure-u-1 pure-u-md-3-4" type="password" tabindex="11" />
  187. <div class="pure-u-0 pure-u-md-1-4">&nbsp;</div>
  188. <div class="pure-u-1 pure-u-md-3-4 hint">
  189. The administrator password is used to access this web interface (user 'admin'), but also to connect to the device when in AP mode or to flash a new firmware over-the-air (OTA).<br />
  190. It should have at least <strong>eight characters</strong> (letters, numbers or the underscore) and at least <strong>one number</strong>, <strong>one lowercase</strong> and <strong>one uppercase</strong> letter.</div>
  191. </div>
  192. <div class="pure-g">
  193. <label class="pure-u-1 pure-u-md-1-4" for="adminPass2">Admin password (repeat)</label>
  194. <input name="adminPass2" class="pure-u-1 pure-u-md-3-4" type="password" tabindex="12" />
  195. </div>
  196. <div class="pure-g">
  197. <div class="pure-u-1 pure-u-sm-1-4"><label for="apiEnabled">Enable HTTP API</label></div>
  198. <div class="pure-u-1 pure-u-sm-1-4"><input type="checkbox" name="apiEnabled" /></div>
  199. </div>
  200. <div class="pure-g">
  201. <label class="pure-u-1 pure-u-md-1-4" for="apiKey">HTTP API Key</label>
  202. <input name="apiKey" class="pure-u-3-4 pure-u-md-1-2" type="text" tabindex="13" />
  203. <div class=" pure-u-1-4 pure-u-md-1-4"><button class="pure-button button-apikey pure-u-23-24">Generate</button></div>
  204. <div class="pure-u-0 pure-u-md-1-4">&nbsp;</div>
  205. <div class="pure-u-1 pure-u-md-3-4 hint">This is the key you will have to pass with every HTTP request to the API, either to get or write values.</div>
  206. </div>
  207. </fieldset>
  208. </div>
  209. </div>
  210. <div class="panel" id="panel-wifi">
  211. <div class="header">
  212. <h1>WIFI</h1>
  213. <h2>You can configure up to 5 different WiFi networks. The device will try to connect in order of signal strength.</h2>
  214. </div>
  215. <div class="page">
  216. <fieldset>
  217. <div id="networks">
  218. </div>
  219. <button type="button" class="pure-button button-add-network">Add network</button>
  220. </fieldset>
  221. </div>
  222. </div>
  223. <div class="panel" id="panel-mqtt">
  224. <div class="header">
  225. <h1>MQTT</h1>
  226. <h2>Configure an <strong>MQTT broker</strong> in your network and you will be able to change the switch status via an MQTT message. Leave the server field empty to disable MQTT.</h2>
  227. </div>
  228. <div class="page">
  229. <fieldset>
  230. <div class="pure-g">
  231. <label class="pure-u-1 pure-u-md-1-4" for="mqttServer">MQTT Server</label>
  232. <input class="pure-u-1 pure-u-md-3-4" name="mqttServer" type="text" size="20" tabindex="21" placeholder="MQTT Server" />
  233. </div>
  234. <div class="pure-g">
  235. <label class="pure-u-1 pure-u-md-1-4" for="mqttPort">MQTT Port</label>
  236. <input class="pure-u-1 pure-u-md-3-4" name="mqttPort" type="text" size="6" tabindex="22" placeholder="1883" />
  237. </div>
  238. <div class="pure-g">
  239. <label class="pure-u-1 pure-u-md-1-4" for="mqttUser">MQTT User</label>
  240. <input class="pure-u-1 pure-u-md-3-4" name="mqttUser" type="text" size="20" tabindex="23" placeholder="Leave blank if no user/pass" />
  241. </div>
  242. <div class="pure-g">
  243. <label class="pure-u-1 pure-u-md-1-4" for="mqttPassword">MQTT Password</label>
  244. <input class="pure-u-1 pure-u-md-3-4" name="mqttPassword" type="text" size="20" tabindex="24" placeholder="Leave blank if no user/pass" />
  245. </div>
  246. <div class="pure-g">
  247. <label class="pure-u-1 pure-u-md-1-4" for="mqttTopic">MQTT Root Topic</label>
  248. <input class="pure-u-1 pure-u-md-3-4" name="mqttTopic" type="text" size="20" tabindex="25" />
  249. <div class="pure-u-0 pure-u-md-1-4">&nbsp;</div>
  250. <div class="pure-u-1 pure-u-md-3-4 hint">This is the root topic for this device. The {identifier} placeholder will be replaces by the device hostname.<br />
  251. - <strong>&lt;root&gt;/relay/#</strong> Send a 0 or a 1 as a payload to this topic to switch it on or off. You can also send a 2 to toggle its current state. Replace # with the relay ID (starting from 0). If the board has only one relay it will be 0.<br />
  252. - <strong>&lt;root&gt;/led/#</strong> Send a 0 or a 1 as a payload to this topic to set the onboard LED to the given state, send a 3 to turn it back to WIFI indicator. Replace # with the LED ID (starting from 0). If the board has only one LED it will be 0.<br />
  253. - <strong>&lt;root&gt;/ip</strong> The device will report to this topic its IP.<br />
  254. - <strong>&lt;root&gt;/heartbeat</strong> The device will report to this topic every few minutes.<br />
  255. - <strong>&lt;root&gt;/version</strong> The device will report to this topic its firmware version on boot.<br />
  256. </div>
  257. </fieldset>
  258. </div>
  259. </div>
  260. <div class="panel" id="panel-domoticz">
  261. <div class="header">
  262. <h1>DOMOTICZ</h1>
  263. <h2>
  264. Configure the connection to your Domoticz server.
  265. </h2>
  266. </div>
  267. <div class="page">
  268. <fieldset>
  269. <div class="pure-g">
  270. <label class="pure-u-1 pure-u-md-1-4" for="dczTopicIn">Domoticz IN Topic</label>
  271. <input class="pure-u-1 pure-u-md-3-4" name="dczTopicIn" type="text" tabindex="31" placeholder="domoticz/in" />
  272. </div>
  273. <div class="pure-g">
  274. <label class="pure-u-1 pure-u-md-1-4" for="dczTopicOut">Domoticz OUT Topic</label>
  275. <input class="pure-u-1 pure-u-md-3-4" name="dczTopicOut" type="text" tabindex="32" placeholder="domoticz/out" />
  276. </div>
  277. <div id="idxs">
  278. </div>
  279. </fieldset>
  280. </div>
  281. </div>
  282. <div class="panel" id="panel-power">
  283. <div class="header">
  284. <h1>POWER</h1>
  285. <h2>
  286. Calibrate your power monitor device. Use a pure resistive load and introduce the expected values for active power, current and voltage. Use the nominal values or a multimeter to get the proper numbers. Set any field to 0 to leave the calibration value untouched.
  287. </h2>
  288. </div>
  289. <div class="page">
  290. <fieldset>
  291. <div class="pure-g">
  292. <label class="pure-u-1 pure-u-md-1-4" for="powExpectedPower">AC RMS Active Power</label>
  293. <input class="pure-u-1 pure-u-md-3-4 powExpected" name="powExpectedPower" type="text" size="8" tabindex="41" placeholder="0" />
  294. <div class="pure-u-0 pure-u-md-1-4">&nbsp;</div>
  295. <div class="pure-u-1 pure-u-md-3-4 hint">If you are using a pure resistive load like a bulb this will be writen on it, otherwise use a socket multimeter to get this value.</div>
  296. </div>
  297. </fieldset>
  298. </div>
  299. </div>
  300. </form>
  301. </div> <!-- content -->
  302. </div> <!-- layout -->
  303. <!-- Templates -->
  304. <div id="networkTemplate" class="template">
  305. <div class="pure-g">
  306. <label class="pure-u-md-1-6 pure-u-1-4" for="ssid">Network SSID</label>
  307. <div class="pure-u-md-3-4 pure-u-5-8"><input name="ssid" type="text" class="pure-u-23-24" value="" size="8" tabindex="0" placeholder="Network SSID" required /></div>
  308. <div class="pure-u-md-1-12 pure-u-1-8"><button type="button" class="pure-button button-more-network pure-u-1">...</button></div>
  309. <div class="more">
  310. <div class="break"></div>
  311. <label class="pure-u-md-1-6 pure-u-1-4" for="pass">Password</label>
  312. <input class="pure-u-md-5-6 pure-u-3-4" name="pass" type="password" value="" tabindex="0" />
  313. <div class="break"></div>
  314. <label class="pure-u-md-1-6 pure-u-1-4" for="ip">Static IP</label>
  315. <input class="pure-u-md-5-6 pure-u-3-4" name="ip" type="text" value="" size="15" tabindex="0" />
  316. <div class="pure-u-md-1-6 pure-u-1-4"></div>
  317. <div class="pure-u-md-5-6 pure-u-3-4 hint">Leave empty for DNS negotiation</div>
  318. <label class="pure-u-md-1-6 pure-u-1-4" for="gw">Gateway IP</label>
  319. <input class="pure-u-md-5-6 pure-u-3-4" name="gw" type="text" value="" size="15" tabindex="0" />
  320. <div class="pure-u-md-1-6 pure-u-1-4"></div>
  321. <div class="pure-u-md-5-6 pure-u-3-4 hint">Set when using a static IP</div>
  322. <label class="pure-u-md-1-6 pure-u-1-4" for="mask">Network Mask</label>
  323. <input class="pure-u-md-5-6 pure-u-3-4" name="mask" type="text" value="" size="15" tabindex="0" placeholder="255.255.255.0" />
  324. <div class="pure-u-md-1-6 pure-u-1-4"></div>
  325. <div class="pure-u-md-5-6 pure-u-3-4 hint">Usually 255.255.255.0 for /24 networks</div>
  326. <label class="pure-u-md-1-6 pure-u-1-4" for="dns">DNS IP</label>
  327. <input class="pure-u-md-5-6 pure-u-3-4" name="dns" type="text" value="" size="15" tabindex="0" placeholder="8.8.8.8" />
  328. <div class="pure-u-md-1-6 pure-u-1-4"></div>
  329. <div class="pure-u-md-5-6 pure-u-3-4 hint">Set the Domain Name Server IP to use when using a static IP</div>
  330. <div class="pure-u-md-1-6 pure-u-1-4"></div>
  331. <div class="pure-u-md-1-6 pure-u-1-4"><button type="button" class="pure-button button-del-network pure-u-5-6 pure-u-md-5-6">Del</button></div>
  332. </div>
  333. </div>
  334. </div>
  335. <div id="relayTemplate" class="template">
  336. <div class="pure-g">
  337. <label class="pure-u-1 pure-u-sm-1-4">Relay<span class="relay_id"></span> Status</label>
  338. <div class="pure-u-1 pure-u-sm-1-4"><input type="checkbox" class="relayStatus" data="0" /></div>
  339. </div>
  340. </div>
  341. <div id="idxTemplate" class="template">
  342. <div class="pure-g">
  343. <label class="pure-u-1 pure-u-sm-1-4">Relay<span class="id"></span> IDX</label>
  344. <div class="pure-u-1 pure-u-sm-1-8"><input class="pure-u-sm-23-24 dczIdx" name="dczIdx" type="number" min="0" tabindex="0" data="0" /></div>
  345. <div class="pure-u-1 pure-u-sm-5-8 hint center">Set to 0 to disable notifications.</div>
  346. </div>
  347. </div>
  348. </body>
  349. <!-- build:js script.js -->
  350. <script src="jquery-1.12.3.min.js"></script>
  351. <script src="checkboxes.js"></script>
  352. <script src="custom.js"></script>
  353. <!-- endbuild -->
  354. </html>