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.

1949 lines
70 KiB

6 years ago
6 years ago
6 years ago
6 years ago
  1. /*
  2. HARDWARE MODULE
  3. Copyright (C) 2016-2018 by Xose Pérez <xose dot perez at gmail dot com>
  4. */
  5. // -----------------------------------------------------------------------------
  6. // Configuration HELP
  7. // -----------------------------------------------------------------------------
  8. //
  9. // Configuration settings for each device, the most common ones are:
  10. //
  11. // board: ID of the board according to boards enum in hardware.h
  12. // device: Name of the device ("string")
  13. // btnGPIO <n>: GPIO for the n-th button (0-based)
  14. // btnRelay <n>: Relay index linked to the n-th button
  15. // btnMode <n>: Mode for the n-th button, can be a sum of:
  16. // - BUTTON_PUSHBUTTON: button event is fired when released
  17. // - BUTTON_SWITCH: button event is fired when pressed or released
  18. // - BUTTON_DEFAULT_HIGH: there is a pull up in place
  19. // - BUTTON_SET_PULLUP: set pullup by software
  20. // rlyGPIO <n>: GPIO for the n-th relay (0-based)
  21. // rlyType <n>: Type of the n-th relaym can be on of:
  22. // - RELAY_TYPE_NORMAL
  23. // - RELAY_TYPE_INVERSE
  24. // - RELAY_TYPE_LATCHED
  25. // - RELAY_TYPE_LATCHED_INVERSE
  26. // ledGPIO <n>: GPIO for the n-th LED (0-based)
  27. // ledLogic <n>: GPIO_LOGIC_DIRECT or GPIO_LOGIC_INVERSE
  28. // ledMode <n>: Mode for the n-th LED, check types.h for LED_MODE_%
  29. // ledRelay <n>: Relay linked to the n-th LED
  30. //
  31. // Besides, other hardware specific information can be added to any device
  32. void _hardwareLoad() {
  33. // -------------------------------------------------------------------------
  34. // Board definitions
  35. // -------------------------------------------------------------------------
  36. #if defined(NODEMCU_LOLIN)
  37. setSetting("board", BOARD_NODEMCU_LOLIN);
  38. setSetting("device", "NODEMCU_LOLIN");
  39. setSetting("btnGPIO", 0, 0);
  40. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  41. setSetting("btnRelay", 0, 0);
  42. setSetting("ledGPIO", 0, 2);
  43. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  44. setSetting("rlyGPIO", 0, 12);
  45. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  46. #elif defined(WEMOS_D1_MINI_RELAYSHIELD)
  47. setSetting("board", BOARD_WEMOS_D1_MINI_RELAYSHIELD);
  48. setSetting("device", "WEMOS_D1_MINI_RELAYSHIELD");
  49. setSetting("btnGPIO", 0, 0);
  50. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  51. setSetting("btnRelay", 0, 0);
  52. setSetting("ledGPIO", 0, 2);
  53. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  54. setSetting("rlyGPIO", 0, 5);
  55. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  56. #elif defined(ITEAD_SONOFF_BASIC)
  57. setSetting("board", BOARD_ITEAD_SONOFF_BASIC);
  58. setSetting("device", "ITEAD_SONOFF_BASIC");
  59. setSetting("btnGPIO", 0, 0);
  60. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  61. setSetting("btnRelay", 0, 0);
  62. setSetting("ledGPIO", 0, 13);
  63. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  64. setSetting("rlyGPIO", 0, 12);
  65. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  66. #elif defined(ITEAD_SONOFF_TH)
  67. setSetting("board", BOARD_ITEAD_SONOFF_TH);
  68. setSetting("device", "ITEAD_SONOFF_TH");
  69. setSetting("btnGPIO", 0, 0);
  70. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  71. setSetting("btnRelay", 0, 0);
  72. // Jack is connected to GPIO14 (and with a small hack to GPIO4)
  73. setSetting("dhtEnabled", 1);
  74. setSetting("dhtGPIO", 0, 14);
  75. setSetting("dsEnabled", 1);
  76. setSetting("dsGPIO", 0, 14);
  77. setSetting("ledGPIO", 0, 13);
  78. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  79. setSetting("rlyGPIO", 0, 12);
  80. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  81. #elif defined(ITEAD_SONOFF_SV)
  82. setSetting("board", BOARD_ITEAD_SONOFF_SV);
  83. setSetting("device", "ITEAD_SONOFF_SV");
  84. setSetting("btnGPIO", 0, 0);
  85. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  86. setSetting("btnRelay", 0, 0);
  87. setSetting("ledGPIO", 0, 13);
  88. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  89. setSetting("rlyGPIO", 0, 12);
  90. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  91. #elif defined(ITEAD_SONOFF_TOUCH)
  92. setSetting("board", BOARD_ITEAD_SONOFF_TOUCH);
  93. setSetting("device", "ITEAD_SONOFF_TOUCH");
  94. setSetting("btnGPIO", 0, 0);
  95. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  96. setSetting("btnRelay", 0, 0);
  97. setSetting("btnPress", 0, BUTTON_MODE_TOGGLE);
  98. setSetting("btnClick", 0, BUTTON_MODE_NONE);
  99. setSetting("btnDblClick", 0, BUTTON_MODE_NONE);
  100. setSetting("btnLngClick", 0, BUTTON_MODE_NONE);
  101. setSetting("btnLngLngClick", 0, BUTTON_MODE_RESET);
  102. setSetting("ledGPIO", 0, 13);
  103. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  104. setSetting("rlyGPIO", 0, 12);
  105. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  106. #elif defined(ITEAD_SONOFF_POW)
  107. setSetting("board", BOARD_ITEAD_SONOFF_POW);
  108. setSetting("device", "ITEAD_SONOFF_POW");
  109. setSetting("btnGPIO", 0, 0);
  110. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  111. setSetting("btnRelay", 0, 0);
  112. setSetting("ledGPIO", 0, 15);
  113. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  114. setSetting("rlyGPIO", 0, 12);
  115. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  116. setSetting("hlwEnabled", 1);
  117. setSetting("hlwSELGPIO", 5);
  118. setSetting("hlwCF1GPIO", 13);
  119. setSetting("hlwCFGPIO", 14);
  120. #elif defined(ITEAD_SONOFF_DUAL)
  121. setSetting("board", BOARD_ITEAD_SONOFF_DUAL);
  122. setSetting("device", "ITEAD_SONOFF_DUAL");
  123. setSetting("btnRelay", 0, GPIO_NONE);
  124. setSetting("btnRelay", 1, GPIO_NONE);
  125. setSetting("btnRelay", 2, 0);
  126. setSetting("ledGPIO", 0, 13);
  127. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  128. setSetting("rlyProvider", RELAY_PROVIDER_DUAL);
  129. setSetting("rlyDummy", 2);
  130. setSetting("dbgSerial", 0);
  131. setSetting("dbgSpeed", 19230);
  132. #elif defined(ITEAD_1CH_INCHING)
  133. // The inching functionality is managed by a misterious IC in the board.
  134. // You cannot control the inching button and functionality from the ESP8266
  135. // Besides, enabling the inching functionality using the hardware button
  136. // will result in the relay switching on and off continuously.
  137. // Fortunately the unkown IC keeps memory of the hardware inching status
  138. // so you can just disable it and forget. The inching LED must be lit.
  139. // You can still use the pulse options from the web interface
  140. // without problem.
  141. setSetting("board", BOARD_ITEAD_1CH_INCHING);
  142. setSetting("device", "ITEAD_1CH_INCHING");
  143. setSetting("btnGPIO", 0, 0);
  144. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  145. setSetting("btnRelay", 0, 0);
  146. setSetting("ledGPIO", 0, 13);
  147. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  148. setSetting("rlyGPIO", 0, 12);
  149. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  150. #elif defined(ITEAD_SONOFF_4CH)
  151. setSetting("board", BOARD_ITEAD_SONOFF_4CH);
  152. setSetting("device", "ITEAD_SONOFF_4CH");
  153. setSetting("btnGPIO", 0, 0);
  154. setSetting("btnGPIO", 1, 9);
  155. setSetting("btnGPIO", 2, 10);
  156. setSetting("btnGPIO", 3, 14);
  157. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  158. setSetting("btnMode", 1, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  159. setSetting("btnMode", 2, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  160. setSetting("btnMode", 3, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  161. setSetting("btnRelay", 0, 0);
  162. setSetting("btnRelay", 1, 1);
  163. setSetting("btnRelay", 2, 2);
  164. setSetting("btnRelay", 3, 3);
  165. setSetting("ledGPIO", 0, 13);
  166. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  167. setSetting("rlyGPIO", 0, 12);
  168. setSetting("rlyGPIO", 1, 5);
  169. setSetting("rlyGPIO", 2, 4);
  170. setSetting("rlyGPIO", 3, 15);
  171. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  172. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  173. setSetting("rlyType", 2, RELAY_TYPE_NORMAL);
  174. setSetting("rlyType", 3, RELAY_TYPE_NORMAL);
  175. #elif defined(ITEAD_SLAMPHER)
  176. setSetting("board", BOARD_ITEAD_SLAMPHER);
  177. setSetting("device", "ITEAD_SLAMPHER");
  178. setSetting("btnGPIO", 0, 0);
  179. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  180. setSetting("btnRelay", 0, 0);
  181. setSetting("ledGPIO", 0, 13);
  182. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  183. setSetting("rlyGPIO", 0, 12);
  184. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  185. #elif defined(ITEAD_S20)
  186. setSetting("board", BOARD_ITEAD_S20);
  187. setSetting("device", "ITEAD_S20");
  188. setSetting("btnGPIO", 0, 0);
  189. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  190. setSetting("btnRelay", 0, 0);
  191. setSetting("ledGPIO", 0, 13);
  192. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  193. setSetting("rlyGPIO", 0, 12);
  194. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  195. #elif defined(ELECTRODRAGON_WIFI_IOT)
  196. setSetting("board", BOARD_ELECTRODRAGON_WIFI_IOT);
  197. setSetting("device", "ELECTRODRAGON_WIFI_IOT");
  198. setSetting("btnGPIO", 0, 0);
  199. setSetting("btnGPIO", 1, 2);
  200. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  201. setSetting("btnMode", 1, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  202. setSetting("btnRelay", 0, 0);
  203. setSetting("btnRelay", 1, 1);
  204. setSetting("ledGPIO", 0, 16);
  205. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  206. setSetting("rlyGPIO", 0, 12);
  207. setSetting("rlyGPIO", 1, 13);
  208. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  209. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  210. #elif defined(WORKCHOICE_ECOPLUG)
  211. setSetting("board", BOARD_WORKCHOICE_ECOPLUG);
  212. setSetting("device", "WORKCHOICE_ECOPLUG");
  213. setSetting("btnGPIO", 0, 13);
  214. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  215. setSetting("btnRelay", 0, 0);
  216. setSetting("ledGPIO", 0, 2);
  217. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  218. setSetting("rlyGPIO", 0, 15);
  219. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  220. #elif defined(JANGOE_WIFI_RELAY_NC)
  221. // Jan Goedeke Wifi Relay
  222. // https://github.com/JanGoe/esp8266-wifi-relay
  223. setSetting("board", BOARD_JANGOE_WIFI_RELAY_NC);
  224. setSetting("device", "JANGOE_WIFI_RELAY_NC");
  225. setSetting("btnGPIO", 0, 12);
  226. setSetting("btnGPIO", 1, 13);
  227. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  228. setSetting("btnMode", 1, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  229. setSetting("btnRelay", 0, 0);
  230. setSetting("btnRelay", 1, 1);
  231. setSetting("rlyGPIO", 0, 2);
  232. setSetting("rlyGPIO", 1, 14);
  233. setSetting("rlyType", 0, RELAY_TYPE_INVERSE);
  234. setSetting("rlyType", 1, RELAY_TYPE_INVERSE);
  235. #elif defined(JANGOE_WIFI_RELAY_NO)
  236. setSetting("board", BOARD_JANGOE_WIFI_RELAY_NO);
  237. setSetting("device", "JANGOE_WIFI_RELAY_NO");
  238. setSetting("btnGPIO", 0, 12);
  239. setSetting("btnGPIO", 1, 13);
  240. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  241. setSetting("btnMode", 1, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  242. setSetting("btnRelay", 0, 0);
  243. setSetting("btnRelay", 1, 1);
  244. setSetting("rlyGPIO", 0, 2);
  245. setSetting("rlyGPIO", 1, 14);
  246. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  247. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  248. #elif defined(OPENENERGYMONITOR_MQTT_RELAY)
  249. setSetting("board", BOARD_OPENENERGYMONITOR_MQTT_RELAY);
  250. setSetting("device", "OPENENERGYMONITOR_MQTT_RELAY");
  251. setSetting("btnGPIO", 0, 0);
  252. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  253. setSetting("btnRelay", 0, 0);
  254. setSetting("ledGPIO", 0, 16);
  255. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  256. setSetting("rlyGPIO", 0, 12);
  257. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  258. #elif defined(JORGEGARCIA_WIFI_RELAYS)
  259. // Jorge García Wifi+Relays Board Kit
  260. // https://www.tindie.com/products/jorgegarciadev/wifi--relays-board-kit
  261. // https://github.com/jorgegarciadev/wifikit
  262. setSetting("board", BOARD_JORGEGARCIA_WIFI_RELAYS);
  263. setSetting("device", "JORGEGARCIA_WIFI_RELAYS");
  264. setSetting("rlyGPIO", 0, 0);
  265. setSetting("rlyGPIO", 1, 2);
  266. setSetting("rlyType", 0, RELAY_TYPE_INVERSE);
  267. setSetting("rlyType", 1, RELAY_TYPE_INVERSE);
  268. #elif defined(AITHINKER_AI_LIGHT)
  269. setSetting("board", BOARD_AITHINKER_AI_LIGHT);
  270. setSetting("device", "AITHINKER_AI_LIGHT");
  271. setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
  272. setSetting("rlyDummy", 1);
  273. setSetting("litProvider", LIGHT_PROVIDER_MY92XX);
  274. setSetting("myModel", 0); // 4 channels per chip
  275. setSetting("myChips", 1);
  276. setSetting("myDIGPIO", 13);
  277. setSetting("myDCKIGPIO", 15);
  278. setSetting("myMapping", "0123");
  279. #elif defined(MAGICHOME_LED_CONTROLLER)
  280. setSetting("board", BOARD_MAGICHOME_LED_CONTROLLER);
  281. setSetting("device", "MAGICHOME_LED_CONTROLLER");
  282. setSetting("ledGPIO", 0, 2);
  283. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  284. setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
  285. setSetting("rlyDummy", 1);
  286. setSetting("irEnabled", 1);
  287. setSetting("irGPIO", 4);
  288. setSetting("irSet", 1);
  289. setSetting("litProvider", LIGHT_PROVIDER_DIMMER);
  290. setSetting("litChGPIO", 0, 14);
  291. setSetting("litChGPIO", 1, 5);
  292. setSetting("litChGPIO", 2, 12);
  293. setSetting("litChGPIO", 3, 13);
  294. setSetting("litChLogic", 0, GPIO_LOGIC_DIRECT);
  295. setSetting("litChLogic", 1, GPIO_LOGIC_DIRECT);
  296. setSetting("litChLogic", 2, GPIO_LOGIC_DIRECT);
  297. setSetting("litChLogic", 3, GPIO_LOGIC_DIRECT);
  298. #elif defined(ITEAD_MOTOR)
  299. setSetting("board", BOARD_ITEAD_MOTOR);
  300. setSetting("device", "ITEAD_MOTOR");
  301. setSetting("btnGPIO", 0, 0);
  302. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  303. setSetting("btnRelay", 0, 0);
  304. setSetting("ledGPIO", 0, 13);
  305. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  306. setSetting("rlyGPIO", 0, 12);
  307. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  308. #elif defined(TINKERMAN_ESPURNA_H06)
  309. setSetting("board", BOARD_TINKERMAN_ESPURNA_H06);
  310. setSetting("device", "TINKERMAN_ESPURNA_H06");
  311. setSetting("btnGPIO", 0, 4);
  312. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  313. setSetting("btnRelay", 0, 0);
  314. setSetting("ledGPIO", 0, 5);
  315. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  316. setSetting("rlyGPIO", 0, 12);
  317. setSetting("rlyType", 0, RELAY_TYPE_INVERSE);
  318. setSetting("hlwEnabled", 1);
  319. setSetting("hlwSELGPIO", 2);
  320. setSetting("hlwCF1GPIO", 13);
  321. setSetting("hlwCFGPIO", 14);
  322. #elif defined(HUACANXING_H801)
  323. setSetting("board", BOARD_HUACANXING_H801);
  324. setSetting("device", "HUACANXING_H801");
  325. setSetting("ledGPIO", 0, 5);
  326. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  327. setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
  328. setSetting("rlyDummy", 1);
  329. setSetting("dbgPort", 1);
  330. setSetting("litProvider", LIGHT_PROVIDER_DIMMER);
  331. setSetting("litChGPIO", 0, 15);
  332. setSetting("litChGPIO", 1, 13);
  333. setSetting("litChGPIO", 2, 12);
  334. setSetting("litChGPIO", 3, 14);
  335. setSetting("litChGPIO", 4, 4);
  336. setSetting("litChLogic", 0, GPIO_LOGIC_DIRECT);
  337. setSetting("litChLogic", 1, GPIO_LOGIC_DIRECT);
  338. setSetting("litChLogic", 2, GPIO_LOGIC_DIRECT);
  339. setSetting("litChLogic", 3, GPIO_LOGIC_DIRECT);
  340. setSetting("litChLogic", 4, GPIO_LOGIC_DIRECT);
  341. #elif defined(ITEAD_BNSZ01)
  342. setSetting("board", BOARD_ITEAD_BNSZ01);
  343. setSetting("device", "ITEAD_BNSZ01");
  344. setSetting("ledGPIO", 0, 13);
  345. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  346. setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
  347. setSetting("rlyDummy", 1);
  348. setSetting("litProvider", LIGHT_PROVIDER_DIMMER);
  349. setSetting("litChGPIO", 0, 12);
  350. setSetting("litChLogic", 0, GPIO_LOGIC_DIRECT);
  351. #elif defined(ITEAD_SONOFF_RFBRIDGE)
  352. setSetting("board", BOARD_ITEAD_SONOFF_RFBRIDGE);
  353. setSetting("device", "ITEAD_SONOFF_RFBRIDGE");
  354. setSetting("btnGPIO", 0, 0);
  355. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  356. setSetting("ledGPIO", 0, 13);
  357. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  358. setSetting("rlyProvider", RELAY_PROVIDER_RFBRIDGE);
  359. setSetting("rlyDummy", 8);
  360. // When using un-modified harware, ESPurna communicates with the secondary
  361. // MCU EFM8BB1 via UART at 19200 bps so we need to change the speed of
  362. // the port and remove UART noise on serial line
  363. setSetting("dbgSerial", 0);
  364. setSetting("dbgSpeed", 19200);
  365. setSetting("rfbDirect", 0);
  366. setSetting("rfbRXGPIO", 4);
  367. setSetting("rfbTXGPIO", 5);
  368. #elif defined(ITEAD_SONOFF_4CH_PRO)
  369. setSetting("board", BOARD_ITEAD_SONOFF_4CH_PRO);
  370. setSetting("device", "ITEAD_SONOFF_4CH_PRO");
  371. setSetting("btnGPIO", 0, 0);
  372. setSetting("btnGPIO", 1, 9);
  373. setSetting("btnGPIO", 2, 10);
  374. setSetting("btnGPIO", 3, 14);
  375. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  376. setSetting("btnMode", 1, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  377. setSetting("btnMode", 2, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  378. setSetting("btnMode", 3, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  379. setSetting("btnRelay", 0, 0);
  380. setSetting("btnRelay", 1, 1);
  381. setSetting("btnRelay", 2, 2);
  382. setSetting("btnRelay", 3, 3);
  383. // Sonoff 4CH Pro uses a secondary STM32 microcontroller to handle
  384. // buttons and relays, but it also forwards button presses to the ESP8285.
  385. // This allows ESPurna to handle button presses -almost- the same way
  386. // as with other devices except:
  387. // * Double click seems to break/disable the button on the STM32 side
  388. // * With S6 switch to 1 (self-locking and inching modes) everything's OK
  389. // * With S6 switch to 0 (interlock mode) if there is a relay ON
  390. // and you click on another relay button, the STM32 sends a "press"
  391. // event for the button of the first relay (to turn it OFF) but it
  392. // does not send a "release" event. It's like it's holding the
  393. // button down since you can see it is still LOW.
  394. // Whatever reason the result is that it may actually perform a
  395. // long click or long-long click.
  396. // The configuration below make the button toggle the relay on press events
  397. // and disables any possibly harmful combination with S6 set to 0.
  398. // If you are sure you will only use S6 to 1 you can comment the
  399. // btnLngClick(0) and btnLngLngClick(0) options below to recover the
  400. // reset mode and factory reset functionalities, or link other actions like
  401. // AP mode in the commented line below.
  402. setSetting("btnPress", 0, BUTTON_MODE_TOGGLE);
  403. setSetting("btnClick", 0, BUTTON_MODE_NONE);
  404. setSetting("btnDblClick", 0, BUTTON_MODE_NONE);
  405. setSetting("btnLngClick", 0, BUTTON_MODE_NONE); // or BUTTON_MODE_AP
  406. setSetting("btnLngLngClick", 0, BUTTON_MODE_NONE); // or BUTTON_MODE_FACTORY
  407. setSetting("btnPress", 1, BUTTON_MODE_TOGGLE);
  408. setSetting("btnClick", 1, BUTTON_MODE_NONE);
  409. setSetting("btnPress", 2, BUTTON_MODE_TOGGLE);
  410. setSetting("btnClick", 2, BUTTON_MODE_NONE);
  411. setSetting("btnPress", 3, BUTTON_MODE_TOGGLE);
  412. setSetting("btnClick", 3, BUTTON_MODE_NONE);
  413. setSetting("ledGPIO", 0, 13);
  414. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  415. setSetting("rlyGPIO", 0, 12);
  416. setSetting("rlyGPIO", 1, 5);
  417. setSetting("rlyGPIO", 2, 4);
  418. setSetting("rlyGPIO", 3, 15);
  419. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  420. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  421. setSetting("rlyType", 2, RELAY_TYPE_NORMAL);
  422. setSetting("rlyType", 3, RELAY_TYPE_NORMAL);
  423. #elif defined(ITEAD_SONOFF_B1)
  424. setSetting("board", BOARD_ITEAD_SONOFF_B1);
  425. setSetting("device", "ITEAD_SONOFF_B1");
  426. setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
  427. setSetting("rlyDummy", 1);
  428. setSetting("litProvider", LIGHT_PROVIDER_MY92XX);
  429. setSetting("litChFactor", 4, 0.1); // White LEDs are way more bright in the B1
  430. setSetting("litChFactor", 5, 0.1); // White LEDs are way more bright in the B1
  431. setSetting("myModel", 1); // 3 channels per chip
  432. setSetting("myChips", 2);
  433. setSetting("myDIGPIO", 12);
  434. setSetting("myDCKIGPIO", 14);
  435. setSetting("myMapping", "43501"); // TODO
  436. #elif defined(ITEAD_SONOFF_LED)
  437. setSetting("board", BOARD_ITEAD_SONOFF_LED);
  438. setSetting("device", "ITEAD_SONOFF_LED");
  439. setSetting("ledGPIO", 0, 13);
  440. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  441. setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
  442. setSetting("rlyDummy", 1);
  443. setSetting("litProvider", LIGHT_PROVIDER_DIMMER);
  444. setSetting("litChGPIO", 0, 12); // Cold white
  445. setSetting("litChGPIO", 1, 14); // Warm white
  446. setSetting("litChLogic", 0, GPIO_LOGIC_DIRECT);
  447. setSetting("litChLogic", 1, GPIO_LOGIC_DIRECT);
  448. #elif defined(ITEAD_SONOFF_T1_1CH)
  449. setSetting("board", BOARD_ITEAD_SONOFF_T1_1CH);
  450. setSetting("device", "ITEAD_SONOFF_T1_1CH");
  451. setSetting("btnGPIO", 0, 0);
  452. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  453. setSetting("btnRelay", 0, 0);
  454. setSetting("btnPress", 0, BUTTON_MODE_TOGGLE);
  455. setSetting("btnClick", 0, BUTTON_MODE_NONE);
  456. setSetting("btnDblClick", 0, BUTTON_MODE_NONE);
  457. setSetting("btnLngClick", 0, BUTTON_MODE_NONE);
  458. setSetting("btnLngLngClick", 0, BUTTON_MODE_RESET);
  459. setSetting("ledGPIO", 0, 13);
  460. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  461. setSetting("rlyGPIO", 0, 12);
  462. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  463. #elif defined(ITEAD_SONOFF_T1_2CH)
  464. setSetting("board", BOARD_ITEAD_SONOFF_T1_2CH);
  465. setSetting("device", "ITEAD_SONOFF_T1_2CH");
  466. setSetting("btnGPIO", 0, 0);
  467. setSetting("btnGPIO", 1, 9);
  468. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  469. setSetting("btnMode", 1, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  470. setSetting("btnRelay", 0, 0);
  471. setSetting("btnRelay", 1, 1);
  472. setSetting("btnPress", 0, BUTTON_MODE_TOGGLE);
  473. setSetting("btnPress", 1, BUTTON_MODE_TOGGLE);
  474. setSetting("btnClick", 0, BUTTON_MODE_NONE);
  475. setSetting("btnClick", 1, BUTTON_MODE_NONE);
  476. setSetting("btnDblClick", 0, BUTTON_MODE_NONE);
  477. setSetting("btnDblClick", 1, BUTTON_MODE_NONE);
  478. setSetting("btnLngClick", 0, BUTTON_MODE_NONE);
  479. setSetting("btnLngClick", 1, BUTTON_MODE_NONE);
  480. setSetting("btnLngLngClick", 0, BUTTON_MODE_RESET);
  481. setSetting("btnLngLngClick", 1, BUTTON_MODE_RESET);
  482. setSetting("ledGPIO", 0, 13);
  483. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  484. setSetting("rlyGPIO", 0, 12);
  485. setSetting("rlyGPIO", 1, 5);
  486. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  487. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  488. #elif defined(ITEAD_SONOFF_T1_3CH)
  489. setSetting("board", BOARD_ITEAD_SONOFF_T1_3CH);
  490. setSetting("device", "ITEAD_SONOFF_T1_3CH");
  491. setSetting("btnGPIO", 0, 0);
  492. setSetting("btnGPIO", 1, 9);
  493. setSetting("btnGPIO", 2, 10);
  494. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  495. setSetting("btnMode", 1, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  496. setSetting("btnMode", 2, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  497. setSetting("btnRelay", 0, 0);
  498. setSetting("btnRelay", 1, 1);
  499. setSetting("btnRelay", 2, 2);
  500. setSetting("btnPress", 0, BUTTON_MODE_TOGGLE);
  501. setSetting("btnPress", 1, BUTTON_MODE_TOGGLE);
  502. setSetting("btnPress", 2, BUTTON_MODE_TOGGLE);
  503. setSetting("btnClick", 0, BUTTON_MODE_NONE);
  504. setSetting("btnClick", 1, BUTTON_MODE_NONE);
  505. setSetting("btnClick", 2, BUTTON_MODE_NONE);
  506. setSetting("btnDblClick", 0, BUTTON_MODE_NONE);
  507. setSetting("btnDblClick", 1, BUTTON_MODE_NONE);
  508. setSetting("btnDblClick", 2, BUTTON_MODE_NONE);
  509. setSetting("btnLngClick", 0, BUTTON_MODE_NONE);
  510. setSetting("btnLngClick", 1, BUTTON_MODE_NONE);
  511. setSetting("btnLngClick", 2, BUTTON_MODE_NONE);
  512. setSetting("btnLngLngClick", 0, BUTTON_MODE_RESET);
  513. setSetting("btnLngLngClick", 1, BUTTON_MODE_RESET);
  514. setSetting("btnLngLngClick", 2, BUTTON_MODE_RESET);
  515. setSetting("ledGPIO", 0, 13);
  516. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  517. setSetting("rlyGPIO", 0, 12);
  518. setSetting("rlyGPIO", 1, 5);
  519. setSetting("rlyGPIO", 2, 4);
  520. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  521. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  522. setSetting("rlyType", 2, RELAY_TYPE_NORMAL);
  523. #elif defined(ITEAD_SONOFF_RF)
  524. setSetting("board", BOARD_ITEAD_SONOFF_RF);
  525. setSetting("device", "ITEAD_SONOFF_RF");
  526. setSetting("btnGPIO", 0, 0);
  527. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  528. setSetting("btnRelay", 0, 0);
  529. setSetting("ledGPIO", 0, 13);
  530. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  531. setSetting("rlyGPIO", 0, 12);
  532. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  533. #elif defined(WION_50055)
  534. // WiOn 50055 Indoor Wi-Fi Wall Outlet & Tap
  535. // https://rover.ebay.com/rover/1/711-53200-19255-0/1?icep_id=114&ipn=icep&toolid=20004&campid=5338044841&mpre=http%3A%2F%2Fwww.ebay.com%2Fitm%2FWiOn-50050-Indoor-Wi-Fi-Outlet-Wireless-Switch-Programmable-Timer-%2F263112281551
  536. // https://rover.ebay.com/rover/1/711-53200-19255-0/1?icep_id=114&ipn=icep&toolid=20004&campid=5338044841&mpre=http%3A%2F%2Fwww.ebay.com%2Fitm%2FWiOn-50055-Indoor-Wi-Fi-Wall-Tap-Monitor-Energy-Usage-Wireless-Smart-Switch-%2F263020837777
  537. // Does not support power monitoring yet
  538. setSetting("board", BOARD_WION_50055);
  539. setSetting("device", "WION_50055");
  540. setSetting("btnGPIO", 0, 13);
  541. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  542. setSetting("btnRelay", 0, 0);
  543. setSetting("ledGPIO", 0, 2);
  544. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  545. setSetting("rlyGPIO", 0, 15);
  546. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  547. #elif defined(EXS_WIFI_RELAY_V31)
  548. // EX-Store Wifi Relay v3.1
  549. // https://ex-store.de/ESP8266-WiFi-Relay-V31
  550. setSetting("board", BOARD_EXS_WIFI_RELAY_V31);
  551. setSetting("device", "EXS_WIFI_RELAY_V31");
  552. setSetting("btnGPIO", 0, 0);
  553. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  554. setSetting("btnRelay", 0, 0);
  555. setSetting("rlyGPIO", 0, 13);
  556. setSetting("rlyResetGPIO", 0, 12);
  557. setSetting("rlyType", 0, RELAY_TYPE_LATCHED);
  558. #elif defined(HUACANXING_H802)
  559. setSetting("board", BOARD_HUACANXING_H802);
  560. setSetting("device", "HUACANXING_H802");
  561. setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
  562. setSetting("rlyDummy", 1);
  563. setSetting("dbgPort", 1);
  564. setSetting("litProvider", LIGHT_PROVIDER_DIMMER);
  565. setSetting("litChGPIO", 0, 12);
  566. setSetting("litChGPIO", 1, 14);
  567. setSetting("litChGPIO", 2, 13);
  568. setSetting("litChGPIO", 3, 15);
  569. setSetting("litChLogic", 0, GPIO_LOGIC_DIRECT);
  570. setSetting("litChLogic", 1, GPIO_LOGIC_DIRECT);
  571. setSetting("litChLogic", 2, GPIO_LOGIC_DIRECT);
  572. setSetting("litChLogic", 3, GPIO_LOGIC_DIRECT);
  573. #elif defined(GENERIC_V9261F)
  574. setSetting("board", BOARD_GENERIC_V9261F);
  575. setSetting("device", "GENERIC_V9261F");
  576. setSetting("v92Enabled", 1);
  577. setSetting("v92GPIO", 2);
  578. setSetting("v92Logic", GPIO_LOGIC_INVERSE);
  579. #elif defined(GENERIC_ECH1560)
  580. setSetting("board", BOARD_GENERIC_ECH1560);
  581. setSetting("device", "GENERIC_ECH1560");
  582. setSetting("echEnabled", 1);
  583. setSetting("echCLKGPIO", 4);
  584. setSetting("echMISOGPIO", 5);
  585. setSetting("echLogic", GPIO_LOGIC_INVERSE);
  586. #elif defined(TINKERMAN_ESPURNA_H08)
  587. setSetting("board", BOARD_TINKERMAN_ESPURNA_H08);
  588. setSetting("device", "TINKERMAN_ESPURNA_H08");
  589. setSetting("btnGPIO", 0, 4);
  590. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  591. setSetting("btnRelay", 0, 0);
  592. setSetting("ledGPIO", 0, 2);
  593. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  594. setSetting("rlyGPIO", 0, 12);
  595. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  596. setSetting("hlwEnabled", 1);
  597. setSetting("hlwSELGPIO", 5);
  598. setSetting("hlwCF1GPIO", 13);
  599. setSetting("hlwCFGPIO", 14);
  600. #elif defined(MANCAVEMADE_ESPLIVE)
  601. // ESPLive
  602. // https://github.com/ManCaveMade/ESP-Live
  603. setSetting("board", BOARD_MANCAVEMADE_ESPLIVE);
  604. setSetting("device", "MANCAVEMADE_ESPLIVE");
  605. setSetting("btnGPIO", 0, 4);
  606. setSetting("btnGPIO", 1, 5);
  607. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  608. setSetting("btnMode", 1, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  609. setSetting("btnRelay", 0, 0);
  610. setSetting("btnRelay", 1, 1);
  611. // The ESPLive has an ADC MUX which needs to be enabled
  612. setSetting("ledGPIO", 0, 16);
  613. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  614. setSetting("ledMode", LED_MODE_ON);
  615. setSetting("rlyGPIO", 0, 12);
  616. setSetting("rlyGPIO", 1, 13);
  617. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  618. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  619. setSetting("dsEnabled", 1);
  620. setSetting("dsGPIO", 0, 2);
  621. setSetting("snsDelta", MAGNITUDE_TEMPERATURE, 1.0); // Temperature min change to report
  622. #elif defined(INTERMITTECH_QUINLED)
  623. // QuinLED
  624. // http://blog.quindorian.org/2017/02/esp8266-led-lighting-quinled-v2-6-pcb.html
  625. setSetting("board", BOARD_INTERMITTECH_QUINLED);
  626. setSetting("device", "INTERMITTECH_QUINLED");
  627. setSetting("ledGPIO", 0, 5);
  628. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  629. setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
  630. setSetting("rlyDummy", 1);
  631. setSetting("litProvider", LIGHT_PROVIDER_DIMMER);
  632. setSetting("litChGPIO", 0, 0);
  633. setSetting("litChGPIO", 1, 2);
  634. setSetting("litChLogic", 0, GPIO_LOGIC_DIRECT);
  635. setSetting("litChLogic", 1, GPIO_LOGIC_DIRECT);
  636. #elif defined(MAGICHOME_LED_CONTROLLER_20)
  637. setSetting("board", BOARD_MAGICHOME_LED_CONTROLLER_20);
  638. setSetting("device", "MAGICHOME_LED_CONTROLLER_20");
  639. setSetting("ledGPIO", 0, 2);
  640. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  641. setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
  642. setSetting("rlyDummy", 1);
  643. setSetting("irEnabled", 1);
  644. setSetting("irGPIO", 4);
  645. setSetting("irSet", 1);
  646. setSetting("litProvider", LIGHT_PROVIDER_DIMMER);
  647. setSetting("litChGPIO", 0, 5);
  648. setSetting("litChGPIO", 1, 12);
  649. setSetting("litChGPIO", 2, 13);
  650. setSetting("litChGPIO", 3, 15);
  651. setSetting("litChLogic", 0, GPIO_LOGIC_DIRECT);
  652. setSetting("litChLogic", 1, GPIO_LOGIC_DIRECT);
  653. setSetting("litChLogic", 2, GPIO_LOGIC_DIRECT);
  654. setSetting("litChLogic", 3, GPIO_LOGIC_DIRECT);
  655. #elif defined(ARILUX_AL_LC06)
  656. setSetting("board", BOARD_ARILUX_AL_LC06);
  657. setSetting("device", "ARILUX_AL_LC06");
  658. setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
  659. setSetting("rlyDummy", 1);
  660. setSetting("litProvider", LIGHT_PROVIDER_DIMMER);
  661. setSetting("litChGPIO", 0, 14);
  662. setSetting("litChGPIO", 1, 12);
  663. setSetting("litChGPIO", 2, 13);
  664. setSetting("litChGPIO", 3, 15);
  665. setSetting("litChGPIO", 4, 5);
  666. setSetting("litChLogic", 0, GPIO_LOGIC_DIRECT);
  667. setSetting("litChLogic", 1, GPIO_LOGIC_DIRECT);
  668. setSetting("litChLogic", 2, GPIO_LOGIC_DIRECT);
  669. setSetting("litChLogic", 3, GPIO_LOGIC_DIRECT);
  670. setSetting("litChLogic", 4, GPIO_LOGIC_DIRECT);
  671. #elif defined(XENON_SM_PW702U)
  672. setSetting("board", BOARD_XENON_SM_PW702U);
  673. setSetting("device", "XENON_SM_PW702U");
  674. setSetting("btnGPIO", 0, 13);
  675. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  676. setSetting("btnRelay", 0, 0);
  677. setSetting("ledGPIO", 0, 4);
  678. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  679. setSetting("rlyGPIO", 0, 12);
  680. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  681. #elif defined(AUTHOMETION_LYT8266)
  682. // AUTHOMETION LYT8266
  683. // https://authometion.com/shop/en/home/13-lyt8266.html
  684. setSetting("board", BOARD_AUTHOMETION_LYT8266);
  685. setSetting("device", "AUTHOMETION_LYT8266");
  686. setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
  687. setSetting("rlyDummy", 1);
  688. setSetting("litProvider", LIGHT_PROVIDER_DIMMER);
  689. setSetting("litChGPIO", 0, 13);
  690. setSetting("litChGPIO", 1, 12);
  691. setSetting("litChGPIO", 2, 14);
  692. setSetting("litChGPIO", 3, 2);
  693. setSetting("litChLogic", 0, GPIO_LOGIC_DIRECT);
  694. setSetting("litChLogic", 1, GPIO_LOGIC_DIRECT);
  695. setSetting("litChLogic", 2, GPIO_LOGIC_DIRECT);
  696. setSetting("litChLogic", 3, GPIO_LOGIC_DIRECT);
  697. setSetting("litEnableGPIO", 15);
  698. setSetting("litEnableLogic", GPIO_LOGIC_DIRECT);
  699. #elif defined(ARILUX_E27)
  700. setSetting("board", BOARD_ARILUX_E27);
  701. setSetting("device", "ARILUX_E27");
  702. setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
  703. setSetting("rlyDummy", 1);
  704. setSetting("litProvider", LIGHT_PROVIDER_MY92XX);
  705. setSetting("myModel", 0); // 4 channels per chip
  706. setSetting("myChips", 1);
  707. setSetting("myDIGPIO", 13);
  708. setSetting("myDCKIGPIO", 15);
  709. setSetting("myMapping", "0123");
  710. #elif defined(YJZK_SWITCH_2CH)
  711. setSetting("board", BOARD_YJZK_SWITCH_2CH);
  712. setSetting("device", "YJZK_SWITCH_2CH");
  713. setSetting("btnGPIO", 0, 0);
  714. setSetting("btnGPIO", 1, 9);
  715. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  716. setSetting("btnMode", 1, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  717. setSetting("btnRelay", 0, 0);
  718. setSetting("btnRelay", 1, 1);
  719. setSetting("ledGPIO", 0, 13);
  720. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  721. setSetting("rlyGPIO", 0, 12);
  722. setSetting("rlyGPIO", 1, 5);
  723. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  724. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  725. #elif defined(ITEAD_SONOFF_DUAL_R2)
  726. setSetting("board", BOARD_ITEAD_SONOFF_DUAL_R2);
  727. setSetting("device", "ITEAD_SONOFF_DUAL_R2");
  728. setSetting("btnGPIO", 0, 0);
  729. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  730. setSetting("btnRelay", 0, 0);
  731. setSetting("btnGPIO", 1, 9);
  732. setSetting("btnGPIO", 2, 10);
  733. setSetting("btnMode", 1, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  734. setSetting("btnMode", 2, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  735. setSetting("btnRelay", 1, 1);
  736. setSetting("btnRelay", 2, 0);
  737. setSetting("ledGPIO", 0, 13);
  738. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  739. setSetting("rlyGPIO", 0, 12);
  740. setSetting("rlyGPIO", 1, 5);
  741. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  742. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  743. #elif defined(GENERIC_8CH)
  744. setSetting("board", BOARD_GENERIC_8CH);
  745. setSetting("device", "GENERIC_8CH");
  746. setSetting("rlyGPIO", 0, 0);
  747. setSetting("rlyGPIO", 1, 2);
  748. setSetting("rlyGPIO", 2, 4);
  749. setSetting("rlyGPIO", 3, 5);
  750. setSetting("rlyGPIO", 4, 12);
  751. setSetting("rlyGPIO", 5, 13);
  752. setSetting("rlyGPIO", 6, 14);
  753. setSetting("rlyGPIO", 7, 15);
  754. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  755. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  756. setSetting("rlyType", 2, RELAY_TYPE_NORMAL);
  757. setSetting("rlyType", 3, RELAY_TYPE_NORMAL);
  758. setSetting("rlyType", 4, RELAY_TYPE_NORMAL);
  759. setSetting("rlyType", 5, RELAY_TYPE_NORMAL);
  760. setSetting("rlyType", 6, RELAY_TYPE_NORMAL);
  761. setSetting("rlyType", 7, RELAY_TYPE_NORMAL);
  762. #elif defined(ARILUX_AL_LC01)
  763. setSetting("board", BOARD_ARILUX_AL_LC01);
  764. setSetting("device", "ARILUX_AL_LC01");
  765. setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
  766. setSetting("rlyDummy", 1);
  767. setSetting("litProvider", LIGHT_PROVIDER_DIMMER);
  768. setSetting("litChGPIO", 0, 5);
  769. setSetting("litChGPIO", 1, 12);
  770. setSetting("litChGPIO", 2, 13);
  771. setSetting("litChLogic", 0, GPIO_LOGIC_DIRECT);
  772. setSetting("litChLogic", 1, GPIO_LOGIC_DIRECT);
  773. setSetting("litChLogic", 2, GPIO_LOGIC_DIRECT);
  774. #elif defined(ARILUX_AL_LC11)
  775. setSetting("board", BOARD_ARILUX_AL_LC11);
  776. setSetting("device", "ARILUX_AL_LC11");
  777. setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
  778. setSetting("rlyDummy", 1);
  779. setSetting("litProvider", LIGHT_PROVIDER_DIMMER);
  780. setSetting("litChGPIO", 0, 5);
  781. setSetting("litChGPIO", 1, 4);
  782. setSetting("litChGPIO", 2, 14);
  783. setSetting("litChGPIO", 3, 13);
  784. setSetting("litChGPIO", 4, 12);
  785. setSetting("litChLogic", 0, GPIO_LOGIC_DIRECT);
  786. setSetting("litChLogic", 1, GPIO_LOGIC_DIRECT);
  787. setSetting("litChLogic", 2, GPIO_LOGIC_DIRECT);
  788. setSetting("litChLogic", 3, GPIO_LOGIC_DIRECT);
  789. setSetting("litChLogic", 4, GPIO_LOGIC_DIRECT);
  790. #elif defined(ARILUX_AL_LC02)
  791. setSetting("board", BOARD_ARILUX_AL_LC02);
  792. setSetting("device", "ARILUX_AL_LC02");
  793. setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
  794. setSetting("rlyDummy", 1);
  795. setSetting("litProvider", LIGHT_PROVIDER_DIMMER);
  796. setSetting("litChGPIO", 0, 12);
  797. setSetting("litChGPIO", 1, 5);
  798. setSetting("litChGPIO", 2, 13);
  799. setSetting("litChGPIO", 3, 15);
  800. setSetting("litChLogic", 0, GPIO_LOGIC_DIRECT);
  801. setSetting("litChLogic", 1, GPIO_LOGIC_DIRECT);
  802. setSetting("litChLogic", 2, GPIO_LOGIC_DIRECT);
  803. setSetting("litChLogic", 3, GPIO_LOGIC_DIRECT);
  804. #elif defined(KMC_70011)
  805. // KMC 70011
  806. // https://www.amazon.com/KMC-Monitoring-Required-Control-Compatible/dp/B07313TH7B
  807. setSetting("board", BOARD_KMC_70011);
  808. setSetting("device", "KMC_70011");
  809. setSetting("btnGPIO", 0, 0);
  810. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  811. setSetting("btnRelay", 0, 0);
  812. setSetting("ledGPIO", 0, 13);
  813. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  814. setSetting("rlyGPIO", 0, 14);
  815. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  816. setSetting("hlwEnabled", 1);
  817. setSetting("hlwSELGPIO", 12);
  818. setSetting("hlwCF1GPIO", 5);
  819. setSetting("hlwCFGPIO", 4);
  820. setSetting("hlwVolResUp", 2000000);
  821. #elif defined(GIZWITS_WITTY_CLOUD)
  822. setSetting("board", BOARD_GIZWITS_WITTY_CLOUD);
  823. setSetting("device", "GIZWITS_WITTY_CLOUD");
  824. setSetting("btnGPIO", 0, 4);
  825. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  826. setSetting("btnPress", 0, BUTTON_MODE_TOGGLE);
  827. setSetting("btnClick", 0, BUTTON_MODE_NONE);
  828. setSetting("btnDblClick", 0, BUTTON_MODE_NONE);
  829. setSetting("btnLngClick", 0, BUTTON_MODE_NONE);
  830. setSetting("btnLngLngClick", 0, BUTTON_MODE_RESET);
  831. setSetting("ledGPIO", 0, 2);
  832. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  833. setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
  834. setSetting("rlyDummy", 1);
  835. setSetting("anaEnabled", 1);
  836. setSetting("litProvider", LIGHT_PROVIDER_DIMMER);
  837. setSetting("litChGPIO", 0, 15);
  838. setSetting("litChGPIO", 1, 12);
  839. setSetting("litChGPIO", 2, 13);
  840. setSetting("litChLogic", 0, GPIO_LOGIC_DIRECT);
  841. setSetting("litChLogic", 1, GPIO_LOGIC_DIRECT);
  842. setSetting("litChLogic", 2, GPIO_LOGIC_DIRECT);
  843. #elif defined(EUROMATE_WIFI_STECKER_SCHUKO)
  844. // Euromate (?) Wifi Stecker Shuko
  845. // https://www.obi.de/hausfunksteuerung/wifi-stecker-schuko/p/2291706
  846. // Thanks to @Geitde
  847. // The relay in the device is not a bistable (latched) relay.
  848. // The device is reported to have a flip-flop circuit to drive the relay
  849. // So @Geitde hack is still the only possible
  850. // Hack: drive GPIO12 low and use GPIO5 as normal relay pin:
  851. setSetting("board", BOARD_EUROMATE_WIFI_STECKER_SCHUKO);
  852. setSetting("device", "EUROMATE_WIFI_STECKER_SCHUKO");
  853. setSetting("btnGPIO", 0, 14);
  854. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH | BUTTON_SET_PULLUP);
  855. setSetting("btnRelay", 0, 0);
  856. setSetting("ledGPIO", 0, 4);
  857. setSetting("ledGPIO", 1, 12);
  858. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  859. setSetting("ledLogic", 1, GPIO_LOGIC_DIRECT);
  860. setSetting("rlyGPIO", 0, 5);
  861. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  862. #elif defined(TONBUX_POWERSTRIP02)
  863. setSetting("board", BOARD_TONBUX_POWERSTRIP02);
  864. setSetting("device", "TONBUX_POWERSTRIP02");
  865. setSetting("btnGPIO", 0, 5);
  866. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  867. setSetting("btnRelay", 0, 1);
  868. setSetting("ledGPIO", 0, 0); // 1 blue led
  869. setSetting("ledGPIO", 1, 3); // 3 red leds
  870. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  871. setSetting("ledLogic", 1, GPIO_LOGIC_INVERSE);
  872. setSetting("rlyGPIO", 0, 4);
  873. setSetting("rlyGPIO", 1, 13);
  874. setSetting("rlyGPIO", 2, 12);
  875. setSetting("rlyGPIO", 3, 14);
  876. setSetting("rlyGPIO", 4, 16); // Not a relay. USB ports on/off
  877. setSetting("rlyType", 0, RELAY_TYPE_INVERSE);
  878. setSetting("rlyType", 1, RELAY_TYPE_INVERSE);
  879. setSetting("rlyType", 2, RELAY_TYPE_INVERSE);
  880. setSetting("rlyType", 3, RELAY_TYPE_INVERSE);
  881. setSetting("rlyType", 4, RELAY_TYPE_NORMAL); // Not a relay. USB ports on/off
  882. #elif defined(LINGAN_SWA1)
  883. setSetting("board", BOARD_LINGAN_SWA1);
  884. setSetting("device", "LINGAN_SWA1");
  885. setSetting("btnGPIO", 0, 13);
  886. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH | BUTTON_SET_PULLUP);
  887. setSetting("btnRelay", 0, 0);
  888. setSetting("ledGPIO", 0, 4);
  889. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  890. setSetting("rlyGPIO", 0, 5);
  891. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  892. #elif defined(HEYGO_HY02)
  893. setSetting("board", BOARD_HEYGO_HY02);
  894. setSetting("device", "HEYGO_HY02");
  895. setSetting("btnGPIO", 0, 13);
  896. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  897. setSetting("btnRelay", 0, 0);
  898. setSetting("ledGPIO", 0, 4);
  899. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  900. setSetting("rlyGPIO", 0, 12);
  901. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  902. #elif defined(MAXCIO_WUS002S)
  903. setSetting("board", BOARD_MAXCIO_WUS002S);
  904. setSetting("device", "MAXCIO_WUS002S");
  905. setSetting("btnGPIO", 0, 2);
  906. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  907. setSetting("btnRelay", 0, 0);
  908. setSetting("ledGPIO", 0, 3);
  909. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  910. setSetting("rlyGPIO", 0, 13);
  911. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  912. setSetting("hlwEnabled", 1);
  913. setSetting("hlwSELGPIO", 12);
  914. setSetting("hlwCF1GPIO", 5);
  915. setSetting("hlwCFGPIO", 4);
  916. setSetting("hlwCurRes", 0.002);
  917. setSetting("hlwVolResUp", 2000000);
  918. #elif defined(YIDIAN_XSSSA05)
  919. setSetting("board", BOARD_YIDIAN_XSSSA05);
  920. setSetting("device", "YIDIAN_XSSSA05");
  921. setSetting("btnGPIO", 0, 13);
  922. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  923. setSetting("btnRelay", 0, 0);
  924. setSetting("ledGPIO", 0, 4);
  925. setSetting("ledGPIO", 2, 2);
  926. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  927. setSetting("ledLogic", 2, GPIO_LOGIC_DIRECT);
  928. setSetting("rlyGPIO", 0, 12);
  929. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  930. setSetting("hlwEnabled", 1);
  931. setSetting("hlwSELGPIO", 3);
  932. setSetting("hlwCF1GPIO", 14);
  933. setSetting("hlwCFGPIO", 5);
  934. setSetting("hlwCurRes", 0.001);
  935. setSetting("hlwVolResUp", 2400000);
  936. #elif defined(TONBUX_XSSSA06)
  937. setSetting("board", BOARD_TONBUX_XSSSA06);
  938. setSetting("device", "TONBUX_XSSSA06");
  939. setSetting("btnGPIO", 0, 13);
  940. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  941. setSetting("btnRelay", 0, 0);
  942. setSetting("ledGPIO", 0, 0); // Red
  943. setSetting("ledGPIO", 0, 5); // Green
  944. setSetting("ledGPIO", 0, 2); // Blue
  945. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  946. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  947. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  948. setSetting("rlyGPIO", 0, 15);
  949. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  950. #elif defined(GREEN_ESP8266RELAY)
  951. // GREEN ESP8266 RELAY MODULE
  952. // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180323113846&SearchText=Green+ESP8266
  953. setSetting("board", BOARD_GREEN_ESP8266RELAY);
  954. setSetting("device", "GREEN_ESP8266RELAY");
  955. setSetting("btnGPIO", 0, 5);
  956. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  957. setSetting("btnRelay", 0, 0);
  958. setSetting("ledGPIO", 0, 2);
  959. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  960. setSetting("rlyGPIO", 0, 4);
  961. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  962. #elif defined(IKE_ESPIKE)
  963. // Henrique Gravina ESPIKE
  964. // https://github.com/Henriquegravina/Espike
  965. setSetting("board", BOARD_IKE_ESPIKE);
  966. setSetting("device", "IKE_ESPIKE");
  967. setSetting("btnGPIO", 0, 13);
  968. setSetting("btnGPIO", 1, 12);
  969. setSetting("btnGPIO", 2, 14);
  970. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  971. setSetting("btnMode", 1, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  972. setSetting("btnMode", 2, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  973. setSetting("btnRelay", 0, 0);
  974. setSetting("btnRelay", 1, 1);
  975. setSetting("btnRelay", 2, 2);
  976. setSetting("btnDblClick", 0, BUTTON_MODE_NONE);
  977. setSetting("btnLngClick", 0, BUTTON_MODE_NONE);
  978. setSetting("btnLngLngClick", 0, BUTTON_MODE_NONE);
  979. setSetting("ledGPIO", 0, 2);
  980. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  981. setSetting("rlyGPIO", 0, 4);
  982. setSetting("rlyGPIO", 1, 5);
  983. setSetting("rlyGPIO", 2, 16);
  984. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  985. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  986. setSetting("rlyType", 2, RELAY_TYPE_NORMAL);
  987. #elif defined(ARNIEX_SWIFITCH)
  988. // SWIFITCH
  989. // https://github.com/ArnieX/swifitch
  990. setSetting("board", BOARD_ARNIEX_SWIFITCH);
  991. setSetting("device", "ARNIEX_SWIFITCH");
  992. setSetting("btnGPIO", 0, 4);
  993. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH | BUTTON_SET_PULLUP);
  994. setSetting("btnRelay", 0, 1);
  995. setSetting("btnPress", 0, BUTTON_MODE_NONE);
  996. setSetting("btnClick", 0, BUTTON_MODE_TOGGLE);
  997. setSetting("btnDblClick", 0, BUTTON_MODE_NONE);
  998. setSetting("btnLngClick", 0, BUTTON_MODE_NONE);
  999. setSetting("btnLngLngClick", 0, BUTTON_MODE_NONE);
  1000. setSetting("ledGPIO", 0, 12);
  1001. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  1002. setSetting("rlyGPIO", 0, 5);
  1003. setSetting("rlyType", 0, RELAY_TYPE_INVERSE);
  1004. #elif defined(GENERIC_ESP01S_RELAY_V40)
  1005. // ESP-01S RELAY v4.0
  1006. // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180404024035&SearchText=esp-01s+relay
  1007. setSetting("board", BOARD_GENERIC_ESP01S_RELAY_V40);
  1008. setSetting("device", "GENERIC_ESP01S_RELAY_V40");
  1009. setSetting("ledGPIO", 0, 2);
  1010. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  1011. setSetting("rlyGPIO", 0, 0);
  1012. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1013. #elif defined(GENERIC_ESP01S_RGBLED_V10)
  1014. // ESP-01S RGB LED v1.0 (some sold with ws2818)
  1015. // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180404023816&SearchText=esp-01s+led+controller
  1016. setSetting("board", BOARD_GENERIC_ESP01S_RGBLED_V10);
  1017. setSetting("device", "GENERIC_ESP01S_RGBLED_V10");
  1018. setSetting("ledGPIO", 0, 2);
  1019. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  1020. #elif defined(HELTEC_TOUCHRELAY)
  1021. // Heltec Touch Relay
  1022. // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180408043114&SearchText=esp8266+touch+relay
  1023. setSetting("board", BOARD_HELTEC_TOUCHRELAY);
  1024. setSetting("device", "HELTEC_TOUCHRELAY");
  1025. setSetting("btnGPIO", 0, 14);
  1026. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1027. setSetting("btnRelay", 0, 1);
  1028. setSetting("rlyGPIO", 0, 12);
  1029. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1030. #elif defined(GENERIC_ESP01S_DHT11_V10)
  1031. // ESP-01S DHT11 v1.0
  1032. // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180410105907&SearchText=esp-01s+dht11
  1033. setSetting("board", BOARD_GENERIC_ESP01S_DHT11_V10);
  1034. setSetting("device", "GENERIC_ESP01S_DHT11_V10");
  1035. setSetting("dhtEnabled", 1);
  1036. setSetting("dhtGPIO", 0, 2);
  1037. setSetting("dhtType", 0, DHT_CHIP_DHT11);
  1038. #elif defined(GENERIC_ESP01S_DS18B20_V10)
  1039. // ESP-01S DS18B20 v1.0
  1040. // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180410105933&SearchText=esp-01s+ds18b20
  1041. setSetting("board", BOARD_GENERIC_ESP01S_DS18B20_V10);
  1042. setSetting("device", "GENERIC_ESP01S_DS18B20_V10");
  1043. setSetting("dsEnabled", 1);
  1044. setSetting("dsGPIO", 0, 2);
  1045. #elif defined(ZHILDE_EU44_W)
  1046. // Zhilde ZLD-EU44-W
  1047. // http://www.zhilde.com/product/60705150109-805652505/EU_WiFi_Surge_Protector_Extension_Socket_4_Outlets_works_with_Amazon_Echo_Smart_Power_Strip.html
  1048. setSetting("board", BOARD_ZHILDE_EU44_W);
  1049. setSetting("device", "ZHILDE_EU44_W");
  1050. setSetting("btnGPIO", 0, 3);
  1051. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1052. setSetting("btnRelay", 0, 0);
  1053. setSetting("ledGPIO", 0, 1);
  1054. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  1055. setSetting("rlyGPIO", 0, 5);
  1056. setSetting("rlyGPIO", 1, 4);
  1057. setSetting("rlyGPIO", 2, 12);
  1058. setSetting("rlyGPIO", 3, 13);
  1059. setSetting("rlyGPIO", 4, 14);
  1060. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1061. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  1062. setSetting("rlyType", 2, RELAY_TYPE_NORMAL);
  1063. setSetting("rlyType", 3, RELAY_TYPE_NORMAL);
  1064. setSetting("rlyType", 4, RELAY_TYPE_NORMAL);
  1065. // Based on the reporter, this product uses GPIO1 and 3 for the button
  1066. // and onboard LED, so hardware serial should be disabled...
  1067. setSetting("dbgSerial", 0);
  1068. #elif defined(ITEAD_SONOFF_POW_R2)
  1069. setSetting("board", BOARD_ITEAD_SONOFF_POW_R2);
  1070. setSetting("device", "ITEAD_SONOFF_POW_R2");
  1071. setSetting("btnGPIO", 0, 0);
  1072. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1073. setSetting("btnRelay", 0, 0);
  1074. setSetting("ledGPIO", 0, 13);
  1075. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  1076. setSetting("rlyGPIO", 0, 12);
  1077. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1078. setSetting("cseEnabled", 1);
  1079. setSetting("cseGPIO", 1);
  1080. setSetting("dbgSerial", 0);
  1081. #elif defined(LUANI_HVIO)
  1082. // Luani HVIO
  1083. // https://luani.de/projekte/esp8266-hvio/
  1084. // https://luani.de/blog/esp8266-230v-io-modul/
  1085. setSetting("board", BOARD_LUANI_HVIO);
  1086. setSetting("device", "LUANI_HVIO");
  1087. setSetting("ledGPIO", 0, 15);
  1088. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  1089. setSetting("btnGPIO", 0, 12);
  1090. setSetting("btnGPIO", 1, 13);
  1091. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1092. setSetting("btnMode", 1, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1093. setSetting("btnRelay", 0, 0);
  1094. setSetting("btnRelay", 1, 1);
  1095. setSetting("btnDblClick", 0, BUTTON_MODE_NONE);
  1096. setSetting("rlyGPIO", 0, 4);
  1097. setSetting("rlyGPIO", 1, 5);
  1098. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1099. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  1100. #elif defined(ALLNET_4DUINO_IOT_WLAN_RELAIS)
  1101. // Allnet 4duino ESP8266-UP-Relais
  1102. // http://www.allnet.de/de/allnet-brand/produkte/neuheiten/p/allnet-4duino-iot-wlan-relais-unterputz-esp8266-up-relais/
  1103. // https://shop.allnet.de/fileadmin/transfer/products/148814.pdf
  1104. setSetting("board", BOARD_ALLNET_4DUINO_IOT_WLAN_RELAIS);
  1105. setSetting("device", "ALLNET_4DUINO_IOT_WLAN_RELAIS");
  1106. setSetting("ledGPIO", 0, 0);
  1107. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  1108. setSetting("rlyGPIO", 0, 14);
  1109. setSetting("rlyResetGPIO", 0, 12);
  1110. setSetting("rlyType", 0, RELAY_TYPE_LATCHED);
  1111. #elif defined(TONBUX_MOSQUITO_KILLER)
  1112. // Tonbux 50-100M Smart Mosquito Killer USB
  1113. // https://www.aliexpress.com/item/Original-Tonbux-50-100M-Smart-Mosquito-Killer-USB-Plug-No-Noise-Repellent-App-Smart-Module/32859330820.html
  1114. setSetting("board", BOARD_TONBUX_MOSQUITO_KILLER);
  1115. setSetting("device", "TONBUX_MOSQUITO_KILLER");
  1116. setSetting("btnGPIO", 0, 2);
  1117. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1118. setSetting("btnRelay", 0, 0);
  1119. setSetting("ledGPIO", 0, 15);
  1120. setSetting("ledGPIO", 1, 14);
  1121. setSetting("ledGPIO", 2, 12);
  1122. setSetting("ledGPIO", 3, 16);
  1123. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  1124. setSetting("ledLogic", 1, GPIO_LOGIC_INVERSE);
  1125. setSetting("ledLogic", 2, GPIO_LOGIC_DIRECT);
  1126. setSetting("ledLogic", 3, GPIO_LOGIC_DIRECT);
  1127. setSetting("ledMode", 0, LED_MODE_WIFI);
  1128. setSetting("ledMode", 1, LED_MODE_RELAY);
  1129. setSetting("ledRelay", 1, 0);
  1130. setSetting("rlyGPIO", 0, 5); // Fan
  1131. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1132. #elif defined(NEO_COOLCAM_NAS_WR01W)
  1133. // NEO Coolcam NAS-WR01W Wifi Smart Power Plug
  1134. // https://es.aliexpress.com/item/-/32854589733.html?spm=a219c.12010608.0.0.6d084e68xX0y5N
  1135. // https://www.fasttech.com/product/9649426-neo-coolcam-nas-wr01w-wifi-smart-power-plug-eu
  1136. setSetting("board", BOARD_NEO_COOLCAM_NAS_WR01W);
  1137. setSetting("device", "NEO_COOLCAM_NAS_WR01W");
  1138. setSetting("btnGPIO", 0, 13);
  1139. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1140. setSetting("btnRelay", 0, 0);
  1141. setSetting("ledGPIO", 0, 4);
  1142. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  1143. setSetting("rlyGPIO", 0, 12);
  1144. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1145. #elif defined(PILOTAK_ESP_DIN_V1)
  1146. // ESP-DIN relay board V1
  1147. // https://github.com/pilotak/esp_din
  1148. setSetting("board", BOARD_PILOTAK_ESP_DIN_V1);
  1149. setSetting("device", "PILOTAK_ESP_DIN_V1");
  1150. setSetting("btnGPIO", 0, 0);
  1151. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1152. setSetting("btnRelay", 0, 0);
  1153. setSetting("ledGPIO", 0, 15);
  1154. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  1155. setSetting("rlyGPIO", 0, 4);
  1156. setSetting("rlyGPIO", 1, 5);
  1157. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1158. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  1159. setSetting("digEnabled", 1);
  1160. setSetting("digGPIO", 0, 16);
  1161. setSetting("digMode", 0, INPUT);
  1162. setSetting("dsEnabled", 1);
  1163. setSetting("dsGPIO", 0, 2);
  1164. setSetting("i2cEnable", 1);
  1165. setSetting("i2cSDAGPIO", 12);
  1166. setSetting("i2cSCLGPIO", 13);
  1167. setSetting("rfEnabled", 1);
  1168. setSetting("rfGPIO", 14);
  1169. #elif defined(ESTINK_WIFI_POWER_STRIP)
  1170. // Estink Wifi Power Strip
  1171. // https://www.amazon.de/Steckdosenleiste-Ladeger%C3%A4t-Sprachsteuerung-SmartphonesTablets-Android/dp/B0796W5FZY
  1172. // Fornorm Wi-Fi USB Extension Socket (ZLD-34EU)
  1173. // https://www.aliexpress.com/item/Fornorm-WiFi-Extension-Socket-with-Surge-Protector-Smart-Power-Strip-3-Outlets-and-4-USB-Charging/32849743948.html
  1174. setSetting("board", BOARD_ESTINK_WIFI_POWER_STRIP);
  1175. setSetting("device", "ESTINK_WIFI_POWER_STRIP");
  1176. setSetting("btnGPIO", 0, 16);
  1177. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1178. setSetting("btnRelay", 0, 3);
  1179. setSetting("ledGPIO", 0, 0);
  1180. setSetting("ledGPIO", 1, 12);
  1181. setSetting("ledGPIO", 2, 3);
  1182. setSetting("ledGPIO", 3, 5);
  1183. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  1184. setSetting("ledLogic", 1, GPIO_LOGIC_INVERSE);
  1185. setSetting("ledLogic", 2, GPIO_LOGIC_INVERSE);
  1186. setSetting("ledLogic", 3, GPIO_LOGIC_INVERSE);
  1187. setSetting("ledMode", 0, LED_MODE_FINDME);
  1188. setSetting("ledMode", 1, LED_MODE_FOLLOW);
  1189. setSetting("ledMode", 2, LED_MODE_FOLLOW);
  1190. setSetting("ledMode", 3, LED_MODE_FOLLOW);
  1191. setSetting("ledRelay", 1, 1);
  1192. setSetting("ledRelay", 2, 2);
  1193. setSetting("ledRelay", 3, 3);
  1194. setSetting("rlyGPIO", 0, 14); // USB power
  1195. setSetting("rlyGPIO", 1, 13); // power plug 1
  1196. setSetting("rlyGPIO", 2, 4); // power plug 2
  1197. setSetting("rlyGPIO", 3, 15); // power plug 3
  1198. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1199. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  1200. setSetting("rlyType", 2, RELAY_TYPE_NORMAL);
  1201. setSetting("rlyType", 3, RELAY_TYPE_NORMAL);
  1202. // Disable UART noise since this board uses GPIO3
  1203. setSetting("dbgSerial", 0);
  1204. #elif defined(BH_ONOFRE)
  1205. // Bruno Horta's OnOfre
  1206. // https://www.bhonofre.pt/
  1207. // https://github.com/brunohorta82/BH_OnOfre/
  1208. setSetting("board", BOARD_BH_ONOFRE);
  1209. setSetting("device", "BH_ONOFRE");
  1210. setSetting("btnGPIO", 0, 12);
  1211. setSetting("btnGPIO", 1, 13);
  1212. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH | BUTTON_SET_PULLUP);
  1213. setSetting("btnMode", 1, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH | BUTTON_SET_PULLUP);
  1214. setSetting("btnRelay", 0, 0);
  1215. setSetting("btnRelay", 1, 1);
  1216. setSetting("rlyGPIO", 0, 4);
  1217. setSetting("rlyGPIO", 1, 5);
  1218. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1219. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  1220. #elif defined(BLITZWOLF_BWSHP2)
  1221. // Several boards under different names uing a power chip labelled BL0937 or HJL-01
  1222. // * Blitzwolf (https://www.amazon.es/Inteligente-Temporización-Dispositivos-Cualquier-BlitzWolf/dp/B07BMQP142)
  1223. // * HomeCube (https://www.amazon.de/Steckdose-Homecube-intelligente-Verbrauchsanzeige-funktioniert/dp/B076Q2LKHG)
  1224. // * Coosa (https://www.amazon.com/COOSA-Monitoring-Function-Campatible-Assiatant/dp/B0788W9TDR)
  1225. // * Goosund (http://www.gosund.com/?m=content&c=index&a=show&catid=6&id=5)
  1226. // * Ablue (https://www.amazon.de/Intelligente-Steckdose-Ablue-Funktioniert-Assistant/dp/B076DRFRZC)
  1227. setSetting("board", BOARD_BLITZWOLF_BWSHP2);
  1228. setSetting("device", "BLITZWOLF_BWSHP2");
  1229. setSetting("btnGPIO", 0, 13);
  1230. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1231. setSetting("btnRelay", 0, 0);
  1232. setSetting("ledGPIO", 0, 2);
  1233. setSetting("ledGPIO", 1, 0);
  1234. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  1235. setSetting("ledLogic", 1, GPIO_LOGIC_INVERSE);
  1236. setSetting("ledMode", 0, LED_MODE_WIFI);
  1237. setSetting("ledMode", 1, LED_MODE_FINDME);
  1238. setSetting("ledRelay", 1, 0);
  1239. setSetting("rlyGPIO", 0, 15);
  1240. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1241. setSetting("hlwSELGPIO", 12);
  1242. setSetting("hlwCF1GPIO", 14);
  1243. setSetting("hlwCFGPIO", 5);
  1244. setSetting("hlwCurSel", LOW);
  1245. setSetting("hlwIntMode", FALLING);
  1246. setSetting("curRatio", 25740);
  1247. setSetting("volRatio", 313400);
  1248. setSetting("pwrRatio", 3414290);
  1249. #elif defined(HOMECUBE_16A)
  1250. // Homecube 16A is similar to BLITZWOLF_BWSHP2 but some pins differ and it also has RGB LEDs
  1251. // https://www.amazon.de/gp/product/B07D7RVF56/ref=oh_aui_detailpage_o00_s01?ie=UTF8&psc=1
  1252. setSetting("board", BOARD_HOMECUBE_16A);
  1253. setSetting("device", "HOMECUBE_16A");
  1254. setSetting("btnGPIO", 0, 13);
  1255. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1256. setSetting("btnRelay", 0, 0);
  1257. setSetting("ledGPIO", 0, 2);
  1258. setSetting("ledGPIO", 1, 12);
  1259. setSetting("ledGPIO", 2, 0);
  1260. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  1261. setSetting("ledLogic", 1, GPIO_LOGIC_DIRECT);
  1262. setSetting("ledLogic", 2, GPIO_LOGIC_DIRECT);
  1263. setSetting("ledMode", 0, LED_MODE_WIFI);
  1264. setSetting("ledMode", 1, LED_MODE_FINDME);
  1265. setSetting("ledMode", 2, LED_MODE_OFF);
  1266. setSetting("ledRelay", 1, 0);
  1267. setSetting("rlyGPIO", 0, 15);
  1268. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1269. setSetting("hlwSELGPIO", 16);
  1270. setSetting("hlwCF1GPIO", 14);
  1271. setSetting("hlwCFGPIO", 5);
  1272. setSetting("hlwCurSel", LOW);
  1273. setSetting("hlwIntMode", FALLING);
  1274. setSetting("curRatio", 25740);
  1275. setSetting("volRatio", 313400);
  1276. setSetting("pwrRatio", 3414290);
  1277. #elif defined(TINKERMAN_ESPURNA_SWITCH)
  1278. setSetting("board", BOARD_TINKERMAN_ESPURNA_SWITCH);
  1279. setSetting("device", "TINKERMAN_ESPURNA_SWITCH");
  1280. setSetting("btnGPIO", 0, 4);
  1281. setSetting("btnMode", 0, BUTTON_PUSHBUTTON);
  1282. setSetting("btnPress", 0, BUTTON_MODE_TOGGLE);
  1283. setSetting("btnClick", 0, BUTTON_MODE_NONE);
  1284. setSetting("btnDblClick", 0, BUTTON_MODE_NONE);
  1285. setSetting("btnLngClick", 0, BUTTON_MODE_NONE);
  1286. setSetting("btnLngLngClick", 0, BUTTON_MODE_NONE);
  1287. setSetting("btnRelay", 0, 0);
  1288. setSetting("ledGPIO", 0, 2);
  1289. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  1290. setSetting("rlyGPIO", 0, 12);
  1291. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1292. #elif defined(ITEAD_SONOFF_S31)
  1293. setSetting("board", BOARD_ITEAD_SONOFF_S31);
  1294. setSetting("device", "ITEAD_SONOFF_S31");
  1295. setSetting("btnGPIO", 0, 0);
  1296. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1297. setSetting("btnRelay", 0, 0);
  1298. setSetting("ledGPIO", 0, 13);
  1299. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  1300. setSetting("rlyGPIO", 0, 12);
  1301. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1302. setSetting("cseEnabled", 1);
  1303. setSetting("cseGPIO", 1);
  1304. setSetting("dbgSerial", 0);
  1305. #elif defined(STM_RELAY)
  1306. setSetting("board", BOARD_STM_RELAY);
  1307. setSetting("device", "STM_RELAY");
  1308. setSetting("rlyDummy", 2);
  1309. setSetting("rlyProvider", RELAY_PROVIDER_STM);
  1310. setSetting("dbgSerial", 0);
  1311. #elif defined(VANZAVANZU_SMART_WIFI_PLUG_MINI)
  1312. // VANZAVANZU Smart Outlet Socket (based on BL0937 or HJL-01)
  1313. // https://www.amazon.com/Smart-Plug-Wifi-Mini-VANZAVANZU/dp/B078PHD6S5
  1314. setSetting("board", BOARD_VANZAVANZU_SMART_WIFI_PLUG_MINI);
  1315. setSetting("device", "VANZAVANZU_SMART_WIFI_PLUG_MINI");
  1316. setSetting("btnGPIO", 0, 13);
  1317. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1318. setSetting("btnRelay", 0, 0);
  1319. setSetting("ledGPIO", 0, 2);
  1320. setSetting("ledGPIO", 1, 0);
  1321. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  1322. setSetting("ledLogic", 1, GPIO_LOGIC_INVERSE);
  1323. setSetting("ledMode", 0, LED_MODE_WIFI);
  1324. setSetting("ledMode", 1, LED_MODE_FINDME);
  1325. setSetting("ledRelay", 1, 0);
  1326. setSetting("rlyGPIO", 0, 15);
  1327. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1328. setSetting("hlwSELGPIO", 3);
  1329. setSetting("hlwCF1GPIO", 14);
  1330. setSetting("hlwCFGPIO", 5);
  1331. setSetting("hlwCurSel", LOW);
  1332. setSetting("hlwIntMode", FALLING);
  1333. setSetting("curRatio", 25740);
  1334. setSetting("volRatio", 313400);
  1335. setSetting("pwrRatio", 3414290);
  1336. setSetting("dbgSerial", 0);
  1337. #elif defined(GENERIC_GEIGER_COUNTER)
  1338. setSetting("board", BOARD_GENERIC_GEIGER_COUNTER);
  1339. setSetting("device", "GENERIC_GEIGER_COUNTER");
  1340. setSetting("geiEnabled", 1);
  1341. setSetting("geiGPIO", 5);
  1342. #elif defined(TINKERMAN_RFM69GW)
  1343. // Check http://tinkerman.cat/rfm69-wifi-gateway/
  1344. setSetting("board", BOARD_TINKERMAN_RFM69GW);
  1345. setSetting("device", "TINKERMAN_RFM69GW");
  1346. setSetting("btnGPIO", 0, 0);
  1347. setSetting("rfm69Enabled", 1);
  1348. setSetting("rfm69CSGPIO", 15);
  1349. setSetting("rfm69IRQGPIO", 5);
  1350. setSetting("rfm69ResetGPIO", 7);
  1351. setSetting("rfm69HW", 0);
  1352. #elif defined(ITEAD_SONOFF_IFAN02)
  1353. setSetting("board", BOARD_ITEAD_SONOFF_IFAN02);
  1354. setSetting("btnGPIO", 0, 0);
  1355. setSetting("btnGPIO", 1, 9);
  1356. setSetting("btnGPIO", 2, 10);
  1357. setSetting("btnGPIO", 3, 14);
  1358. setSetting("ledGPIO", 0, 13);
  1359. setSetting("ledLogic", 0, 1);
  1360. setSetting("ledMode", 0, LED_MODE_WIFI);
  1361. setSetting("rlyGPIO", 0, 12);
  1362. setSetting("rlyGPIO", 1, 5);
  1363. setSetting("rlyGPIO", 2, 4);
  1364. setSetting("rlyGPIO", 3, 15);
  1365. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1366. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  1367. setSetting("rlyType", 2, RELAY_TYPE_NORMAL);
  1368. setSetting("rlyType", 3, RELAY_TYPE_NORMAL);
  1369. #elif defined(GENERIC_AG_L4)
  1370. setSetting("board", BOARD_GENERIC_AG_L4);
  1371. setSetting("btnGPIO", 0, 4);
  1372. setSetting("btnGPIO", 1, 2);
  1373. setSetting("btnRelay", 0, 0);
  1374. setSetting("btnMode", 0, BUTTON_PUSHBUTTON);
  1375. setSetting("btnPress", 0, BUTTON_MODE_TOGGLE);
  1376. setSetting("btnClick", 0, BUTTON_MODE_NONE);
  1377. setSetting("btnDblClick", 0, BUTTON_MODE_NONE);
  1378. setSetting("btnLngClick", 0, BUTTON_MODE_NONE);
  1379. setSetting("btnLngLngClick", 0, BUTTON_MODE_NONE);
  1380. setSetting("ledGPIO", 0, 5);
  1381. setSetting("ledGPIO", 1, 16);
  1382. setSetting("ledLogic", 0, 0);
  1383. setSetting("ledLogic", 1, 1);
  1384. setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
  1385. setSetting("rlyDummy", 1);
  1386. setSetting("litProvider", LIGHT_PROVIDER_DIMMER);
  1387. setSetting("litChGPIO", 0, 14);
  1388. setSetting("litChGPIO", 1, 13);
  1389. setSetting("litChGPIO", 2, 12);
  1390. setSetting("litChLogic", 0, 0);
  1391. setSetting("litChLogic", 1, 0);
  1392. setSetting("litChLogic", 2, 0);
  1393. #endif
  1394. }
  1395. void _hardwareMigrateMoveIndexDown(const char * key, int offset = 0) {
  1396. if (hasSetting(key, 0)) return;
  1397. for (unsigned char index = 1; index < SETTINGS_MAX_LIST_COUNT; index++) {
  1398. if (hasSetting(key, index)) {
  1399. setSetting(key, index - 1, getSetting(key, index).toInt() + offset);
  1400. } else {
  1401. delSetting(key, index - 1);
  1402. }
  1403. }
  1404. }
  1405. // Configuration versions
  1406. //
  1407. // 1: based on Embedis, no board definitions
  1408. // 2: based on Embedis, with board definitions 1-based
  1409. // 3: based on Embedis, with board definitions 0-based
  1410. // 4: based on Embedis, added sensors and force resetting
  1411. void _hardwareMigrate() {
  1412. moveSetting("boardName", "device");
  1413. moveSettings("relayGPIO", "rlyGPIO");
  1414. moveSettings("relayResetGPIO", "rlyResetGPIO");
  1415. moveSettings("relayType", "rlyType");
  1416. moveSetting("selGPIO", "hlwSELGPIO");
  1417. moveSetting("cfGPIO", "hlwCFGPIO");
  1418. moveSetting("cf1GPIO", "hlwCF1GPIO");
  1419. moveSetting("relayProvider", "rlyProvider");
  1420. moveSetting("lightProvider", "litProvider");
  1421. moveSetting("relays", "rlyDummy");
  1422. moveSettings("chGPIO", "litChGPIO");
  1423. moveSettings("chLogic", "litChLogic");
  1424. moveSetting("enGPIO", "litEnableGPIO");
  1425. moveSetting("hlwSelC", "hlwCurLevel");
  1426. moveSetting("hlwIntM", "hlwInt");
  1427. delSetting("ledWifi");
  1428. // Get config version
  1429. unsigned int board = getSetting("board", 0).toInt();
  1430. unsigned int config_version = getSetting("cfg", board > 0 ? 2 : 1).toInt();
  1431. setSetting("cfg", CFG_VERSION);
  1432. if (config_version == 2) {
  1433. _hardwareMigrateMoveIndexDown("ledGPIO");
  1434. _hardwareMigrateMoveIndexDown("ledLogic");
  1435. _hardwareMigrateMoveIndexDown("btnGPIO");
  1436. _hardwareMigrateMoveIndexDown("btnRelay", -1);
  1437. _hardwareMigrateMoveIndexDown("rlyGPIO");
  1438. _hardwareMigrateMoveIndexDown("rlyType");
  1439. }
  1440. }
  1441. void _hardwareSpecific() {
  1442. // These devices use the hardware UART
  1443. // to communicate to secondary microcontrollers
  1444. #if defined(ITEAD_SONOFF_RFBRIDGE) || defined(ITEAD_SONOFF_DUAL) || (RELAY_PROVIDER == RELAY_PROVIDER_STM)
  1445. Serial.begin(DEBUG_SERIAL_SPEED);
  1446. #endif
  1447. }
  1448. // -----------------------------------------------------------------------------
  1449. void hardwareSetup() {
  1450. _hardwareMigrate();
  1451. if (getSetting("board", 1).toInt() != 1) {
  1452. _hardwareLoad();
  1453. }
  1454. _hardwareSpecific();
  1455. }