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.

1947 lines
70 KiB

6 years ago
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", MY92XX_MODEL_MY9291); // 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", MY92XX_MODEL_MY9231); // 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. #elif defined(INTERMITTECH_QUINLED)
  622. // QuinLED
  623. // http://blog.quindorian.org/2017/02/esp8266-led-lighting-quinled-v2-6-pcb.html
  624. setSetting("board", BOARD_INTERMITTECH_QUINLED);
  625. setSetting("device", "INTERMITTECH_QUINLED");
  626. setSetting("ledGPIO", 0, 5);
  627. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  628. setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
  629. setSetting("rlyDummy", 1);
  630. setSetting("litProvider", LIGHT_PROVIDER_DIMMER);
  631. setSetting("litChGPIO", 0, 0);
  632. setSetting("litChGPIO", 1, 2);
  633. setSetting("litChLogic", 0, GPIO_LOGIC_DIRECT);
  634. setSetting("litChLogic", 1, GPIO_LOGIC_DIRECT);
  635. #elif defined(MAGICHOME_LED_CONTROLLER_20)
  636. setSetting("board", BOARD_MAGICHOME_LED_CONTROLLER_20);
  637. setSetting("device", "MAGICHOME_LED_CONTROLLER_20");
  638. setSetting("ledGPIO", 0, 2);
  639. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  640. setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
  641. setSetting("rlyDummy", 1);
  642. setSetting("irEnabled", 1);
  643. setSetting("irGPIO", 4);
  644. setSetting("irSet", 1);
  645. setSetting("litProvider", LIGHT_PROVIDER_DIMMER);
  646. setSetting("litChGPIO", 0, 5);
  647. setSetting("litChGPIO", 1, 12);
  648. setSetting("litChGPIO", 2, 13);
  649. setSetting("litChGPIO", 3, 15);
  650. setSetting("litChLogic", 0, GPIO_LOGIC_DIRECT);
  651. setSetting("litChLogic", 1, GPIO_LOGIC_DIRECT);
  652. setSetting("litChLogic", 2, GPIO_LOGIC_DIRECT);
  653. setSetting("litChLogic", 3, GPIO_LOGIC_DIRECT);
  654. #elif defined(ARILUX_AL_LC06)
  655. setSetting("board", BOARD_ARILUX_AL_LC06);
  656. setSetting("device", "ARILUX_AL_LC06");
  657. setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
  658. setSetting("rlyDummy", 1);
  659. setSetting("litProvider", LIGHT_PROVIDER_DIMMER);
  660. setSetting("litChGPIO", 0, 14);
  661. setSetting("litChGPIO", 1, 12);
  662. setSetting("litChGPIO", 2, 13);
  663. setSetting("litChGPIO", 3, 15);
  664. setSetting("litChGPIO", 4, 5);
  665. setSetting("litChLogic", 0, GPIO_LOGIC_DIRECT);
  666. setSetting("litChLogic", 1, GPIO_LOGIC_DIRECT);
  667. setSetting("litChLogic", 2, GPIO_LOGIC_DIRECT);
  668. setSetting("litChLogic", 3, GPIO_LOGIC_DIRECT);
  669. setSetting("litChLogic", 4, GPIO_LOGIC_DIRECT);
  670. #elif defined(XENON_SM_PW702U)
  671. setSetting("board", BOARD_XENON_SM_PW702U);
  672. setSetting("device", "XENON_SM_PW702U");
  673. setSetting("btnGPIO", 0, 13);
  674. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  675. setSetting("btnRelay", 0, 0);
  676. setSetting("ledGPIO", 0, 4);
  677. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  678. setSetting("rlyGPIO", 0, 12);
  679. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  680. #elif defined(AUTHOMETION_LYT8266)
  681. // AUTHOMETION LYT8266
  682. // https://authometion.com/shop/en/home/13-lyt8266.html
  683. setSetting("board", BOARD_AUTHOMETION_LYT8266);
  684. setSetting("device", "AUTHOMETION_LYT8266");
  685. setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
  686. setSetting("rlyDummy", 1);
  687. setSetting("litProvider", LIGHT_PROVIDER_DIMMER);
  688. setSetting("litChGPIO", 0, 13);
  689. setSetting("litChGPIO", 1, 12);
  690. setSetting("litChGPIO", 2, 14);
  691. setSetting("litChGPIO", 3, 2);
  692. setSetting("litChLogic", 0, GPIO_LOGIC_DIRECT);
  693. setSetting("litChLogic", 1, GPIO_LOGIC_DIRECT);
  694. setSetting("litChLogic", 2, GPIO_LOGIC_DIRECT);
  695. setSetting("litChLogic", 3, GPIO_LOGIC_DIRECT);
  696. setSetting("litEnableGPIO", 15);
  697. setSetting("litEnableLogic", GPIO_LOGIC_DIRECT);
  698. #elif defined(ARILUX_E27)
  699. setSetting("board", BOARD_ARILUX_E27);
  700. setSetting("device", "ARILUX_E27");
  701. setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
  702. setSetting("rlyDummy", 1);
  703. setSetting("litProvider", LIGHT_PROVIDER_MY92XX);
  704. setSetting("myModel", MY92XX_MODEL_MY9291); // 4 channels per chip
  705. setSetting("myChips", 1);
  706. setSetting("myDIGPIO", 13);
  707. setSetting("myDCKIGPIO", 15);
  708. setSetting("myMapping", "0123");
  709. #elif defined(YJZK_SWITCH_2CH)
  710. setSetting("board", BOARD_YJZK_SWITCH_2CH);
  711. setSetting("device", "YJZK_SWITCH_2CH");
  712. setSetting("btnGPIO", 0, 0);
  713. setSetting("btnGPIO", 1, 9);
  714. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  715. setSetting("btnMode", 1, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  716. setSetting("btnRelay", 0, 0);
  717. setSetting("btnRelay", 1, 1);
  718. setSetting("ledGPIO", 0, 13);
  719. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  720. setSetting("rlyGPIO", 0, 12);
  721. setSetting("rlyGPIO", 1, 5);
  722. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  723. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  724. #elif defined(ITEAD_SONOFF_DUAL_R2)
  725. setSetting("board", BOARD_ITEAD_SONOFF_DUAL_R2);
  726. setSetting("device", "ITEAD_SONOFF_DUAL_R2");
  727. setSetting("btnGPIO", 0, 0);
  728. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  729. setSetting("btnRelay", 0, 0);
  730. setSetting("btnGPIO", 1, 9);
  731. setSetting("btnGPIO", 2, 10);
  732. setSetting("btnMode", 1, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  733. setSetting("btnMode", 2, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  734. setSetting("btnRelay", 1, 1);
  735. setSetting("btnRelay", 2, 0);
  736. setSetting("ledGPIO", 0, 13);
  737. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  738. setSetting("rlyGPIO", 0, 12);
  739. setSetting("rlyGPIO", 1, 5);
  740. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  741. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  742. #elif defined(GENERIC_8CH)
  743. setSetting("board", BOARD_GENERIC_8CH);
  744. setSetting("device", "GENERIC_8CH");
  745. setSetting("rlyGPIO", 0, 0);
  746. setSetting("rlyGPIO", 1, 2);
  747. setSetting("rlyGPIO", 2, 4);
  748. setSetting("rlyGPIO", 3, 5);
  749. setSetting("rlyGPIO", 4, 12);
  750. setSetting("rlyGPIO", 5, 13);
  751. setSetting("rlyGPIO", 6, 14);
  752. setSetting("rlyGPIO", 7, 15);
  753. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  754. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  755. setSetting("rlyType", 2, RELAY_TYPE_NORMAL);
  756. setSetting("rlyType", 3, RELAY_TYPE_NORMAL);
  757. setSetting("rlyType", 4, RELAY_TYPE_NORMAL);
  758. setSetting("rlyType", 5, RELAY_TYPE_NORMAL);
  759. setSetting("rlyType", 6, RELAY_TYPE_NORMAL);
  760. setSetting("rlyType", 7, RELAY_TYPE_NORMAL);
  761. #elif defined(ARILUX_AL_LC01)
  762. setSetting("board", BOARD_ARILUX_AL_LC01);
  763. setSetting("device", "ARILUX_AL_LC01");
  764. setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
  765. setSetting("rlyDummy", 1);
  766. setSetting("litProvider", LIGHT_PROVIDER_DIMMER);
  767. setSetting("litChGPIO", 0, 5);
  768. setSetting("litChGPIO", 1, 12);
  769. setSetting("litChGPIO", 2, 13);
  770. setSetting("litChLogic", 0, GPIO_LOGIC_DIRECT);
  771. setSetting("litChLogic", 1, GPIO_LOGIC_DIRECT);
  772. setSetting("litChLogic", 2, GPIO_LOGIC_DIRECT);
  773. #elif defined(ARILUX_AL_LC11)
  774. setSetting("board", BOARD_ARILUX_AL_LC11);
  775. setSetting("device", "ARILUX_AL_LC11");
  776. setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
  777. setSetting("rlyDummy", 1);
  778. setSetting("litProvider", LIGHT_PROVIDER_DIMMER);
  779. setSetting("litChGPIO", 0, 5);
  780. setSetting("litChGPIO", 1, 4);
  781. setSetting("litChGPIO", 2, 14);
  782. setSetting("litChGPIO", 3, 13);
  783. setSetting("litChGPIO", 4, 12);
  784. setSetting("litChLogic", 0, GPIO_LOGIC_DIRECT);
  785. setSetting("litChLogic", 1, GPIO_LOGIC_DIRECT);
  786. setSetting("litChLogic", 2, GPIO_LOGIC_DIRECT);
  787. setSetting("litChLogic", 3, GPIO_LOGIC_DIRECT);
  788. setSetting("litChLogic", 4, GPIO_LOGIC_DIRECT);
  789. #elif defined(ARILUX_AL_LC02)
  790. setSetting("board", BOARD_ARILUX_AL_LC02);
  791. setSetting("device", "ARILUX_AL_LC02");
  792. setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
  793. setSetting("rlyDummy", 1);
  794. setSetting("litProvider", LIGHT_PROVIDER_DIMMER);
  795. setSetting("litChGPIO", 0, 12);
  796. setSetting("litChGPIO", 1, 5);
  797. setSetting("litChGPIO", 2, 13);
  798. setSetting("litChGPIO", 3, 15);
  799. setSetting("litChLogic", 0, GPIO_LOGIC_DIRECT);
  800. setSetting("litChLogic", 1, GPIO_LOGIC_DIRECT);
  801. setSetting("litChLogic", 2, GPIO_LOGIC_DIRECT);
  802. setSetting("litChLogic", 3, GPIO_LOGIC_DIRECT);
  803. #elif defined(KMC_70011)
  804. // KMC 70011
  805. // https://www.amazon.com/KMC-Monitoring-Required-Control-Compatible/dp/B07313TH7B
  806. setSetting("board", BOARD_KMC_70011);
  807. setSetting("device", "KMC_70011");
  808. setSetting("btnGPIO", 0, 0);
  809. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  810. setSetting("btnRelay", 0, 0);
  811. setSetting("ledGPIO", 0, 13);
  812. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  813. setSetting("rlyGPIO", 0, 14);
  814. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  815. setSetting("hlwEnabled", 1);
  816. setSetting("hlwSELGPIO", 12);
  817. setSetting("hlwCF1GPIO", 5);
  818. setSetting("hlwCFGPIO", 4);
  819. setSetting("hlwVolResUp", 2000000);
  820. #elif defined(GIZWITS_WITTY_CLOUD)
  821. setSetting("board", BOARD_GIZWITS_WITTY_CLOUD);
  822. setSetting("device", "GIZWITS_WITTY_CLOUD");
  823. setSetting("btnGPIO", 0, 4);
  824. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  825. setSetting("btnPress", 0, BUTTON_MODE_TOGGLE);
  826. setSetting("btnClick", 0, BUTTON_MODE_NONE);
  827. setSetting("btnDblClick", 0, BUTTON_MODE_NONE);
  828. setSetting("btnLngClick", 0, BUTTON_MODE_NONE);
  829. setSetting("btnLngLngClick", 0, BUTTON_MODE_RESET);
  830. setSetting("ledGPIO", 0, 2);
  831. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  832. setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
  833. setSetting("rlyDummy", 1);
  834. setSetting("anaEnabled", 1);
  835. setSetting("litProvider", LIGHT_PROVIDER_DIMMER);
  836. setSetting("litChGPIO", 0, 15);
  837. setSetting("litChGPIO", 1, 12);
  838. setSetting("litChGPIO", 2, 13);
  839. setSetting("litChLogic", 0, GPIO_LOGIC_DIRECT);
  840. setSetting("litChLogic", 1, GPIO_LOGIC_DIRECT);
  841. setSetting("litChLogic", 2, GPIO_LOGIC_DIRECT);
  842. #elif defined(EUROMATE_WIFI_STECKER_SCHUKO)
  843. // Euromate (?) Wifi Stecker Shuko
  844. // https://www.obi.de/hausfunksteuerung/wifi-stecker-schuko/p/2291706
  845. // Thanks to @Geitde
  846. // The relay in the device is not a bistable (latched) relay.
  847. // The device is reported to have a flip-flop circuit to drive the relay
  848. // So @Geitde hack is still the only possible
  849. // Hack: drive GPIO12 low and use GPIO5 as normal relay pin:
  850. setSetting("board", BOARD_EUROMATE_WIFI_STECKER_SCHUKO);
  851. setSetting("device", "EUROMATE_WIFI_STECKER_SCHUKO");
  852. setSetting("btnGPIO", 0, 14);
  853. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH | BUTTON_SET_PULLUP);
  854. setSetting("btnRelay", 0, 0);
  855. setSetting("ledGPIO", 0, 4);
  856. setSetting("ledGPIO", 1, 12);
  857. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  858. setSetting("ledLogic", 1, GPIO_LOGIC_DIRECT);
  859. setSetting("rlyGPIO", 0, 5);
  860. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  861. #elif defined(TONBUX_POWERSTRIP02)
  862. setSetting("board", BOARD_TONBUX_POWERSTRIP02);
  863. setSetting("device", "TONBUX_POWERSTRIP02");
  864. setSetting("btnGPIO", 0, 5);
  865. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  866. setSetting("btnRelay", 0, 1);
  867. setSetting("ledGPIO", 0, 0); // 1 blue led
  868. setSetting("ledGPIO", 1, 3); // 3 red leds
  869. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  870. setSetting("ledLogic", 1, GPIO_LOGIC_INVERSE);
  871. setSetting("rlyGPIO", 0, 4);
  872. setSetting("rlyGPIO", 1, 13);
  873. setSetting("rlyGPIO", 2, 12);
  874. setSetting("rlyGPIO", 3, 14);
  875. setSetting("rlyGPIO", 4, 16); // Not a relay. USB ports on/off
  876. setSetting("rlyType", 0, RELAY_TYPE_INVERSE);
  877. setSetting("rlyType", 1, RELAY_TYPE_INVERSE);
  878. setSetting("rlyType", 2, RELAY_TYPE_INVERSE);
  879. setSetting("rlyType", 3, RELAY_TYPE_INVERSE);
  880. setSetting("rlyType", 4, RELAY_TYPE_NORMAL); // Not a relay. USB ports on/off
  881. #elif defined(LINGAN_SWA1)
  882. setSetting("board", BOARD_LINGAN_SWA1);
  883. setSetting("device", "LINGAN_SWA1");
  884. setSetting("btnGPIO", 0, 13);
  885. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH | BUTTON_SET_PULLUP);
  886. setSetting("btnRelay", 0, 0);
  887. setSetting("ledGPIO", 0, 4);
  888. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  889. setSetting("rlyGPIO", 0, 5);
  890. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  891. #elif defined(HEYGO_HY02)
  892. setSetting("board", BOARD_HEYGO_HY02);
  893. setSetting("device", "HEYGO_HY02");
  894. setSetting("btnGPIO", 0, 13);
  895. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  896. setSetting("btnRelay", 0, 0);
  897. setSetting("ledGPIO", 0, 4);
  898. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  899. setSetting("rlyGPIO", 0, 12);
  900. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  901. #elif defined(MAXCIO_WUS002S)
  902. setSetting("board", BOARD_MAXCIO_WUS002S);
  903. setSetting("device", "MAXCIO_WUS002S");
  904. setSetting("btnGPIO", 0, 2);
  905. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  906. setSetting("btnRelay", 0, 0);
  907. setSetting("ledGPIO", 0, 3);
  908. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  909. setSetting("rlyGPIO", 0, 13);
  910. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  911. setSetting("hlwEnabled", 1);
  912. setSetting("hlwSELGPIO", 12);
  913. setSetting("hlwCF1GPIO", 5);
  914. setSetting("hlwCFGPIO", 4);
  915. setSetting("hlwCurRes", 0.002);
  916. setSetting("hlwVolResUp", 2000000);
  917. #elif defined(YIDIAN_XSSSA05)
  918. setSetting("board", BOARD_YIDIAN_XSSSA05);
  919. setSetting("device", "YIDIAN_XSSSA05");
  920. setSetting("btnGPIO", 0, 13);
  921. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  922. setSetting("btnRelay", 0, 0);
  923. setSetting("ledGPIO", 0, 4);
  924. setSetting("ledGPIO", 2, 2);
  925. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  926. setSetting("ledLogic", 2, GPIO_LOGIC_DIRECT);
  927. setSetting("rlyGPIO", 0, 12);
  928. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  929. setSetting("hlwEnabled", 1);
  930. setSetting("hlwSELGPIO", 3);
  931. setSetting("hlwCF1GPIO", 14);
  932. setSetting("hlwCFGPIO", 5);
  933. setSetting("hlwCurRes", 0.001);
  934. setSetting("hlwVolResUp", 2400000);
  935. #elif defined(TONBUX_XSSSA06)
  936. setSetting("board", BOARD_TONBUX_XSSSA06);
  937. setSetting("device", "TONBUX_XSSSA06");
  938. setSetting("btnGPIO", 0, 13);
  939. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  940. setSetting("btnRelay", 0, 0);
  941. setSetting("ledGPIO", 0, 0); // Red
  942. setSetting("ledGPIO", 0, 5); // Green
  943. setSetting("ledGPIO", 0, 2); // Blue
  944. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  945. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  946. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  947. setSetting("rlyGPIO", 0, 15);
  948. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  949. #elif defined(GREEN_ESP8266RELAY)
  950. // GREEN ESP8266 RELAY MODULE
  951. // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180323113846&SearchText=Green+ESP8266
  952. setSetting("board", BOARD_GREEN_ESP8266RELAY);
  953. setSetting("device", "GREEN_ESP8266RELAY");
  954. setSetting("btnGPIO", 0, 5);
  955. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  956. setSetting("btnRelay", 0, 0);
  957. setSetting("ledGPIO", 0, 2);
  958. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  959. setSetting("rlyGPIO", 0, 4);
  960. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  961. #elif defined(IKE_ESPIKE)
  962. // Henrique Gravina ESPIKE
  963. // https://github.com/Henriquegravina/Espike
  964. setSetting("board", BOARD_IKE_ESPIKE);
  965. setSetting("device", "IKE_ESPIKE");
  966. setSetting("btnGPIO", 0, 13);
  967. setSetting("btnGPIO", 1, 12);
  968. setSetting("btnGPIO", 2, 14);
  969. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  970. setSetting("btnMode", 1, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  971. setSetting("btnMode", 2, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  972. setSetting("btnRelay", 0, 0);
  973. setSetting("btnRelay", 1, 1);
  974. setSetting("btnRelay", 2, 2);
  975. setSetting("btnDblClick", 0, BUTTON_MODE_NONE);
  976. setSetting("btnLngClick", 0, BUTTON_MODE_NONE);
  977. setSetting("btnLngLngClick", 0, BUTTON_MODE_NONE);
  978. setSetting("ledGPIO", 0, 2);
  979. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  980. setSetting("rlyGPIO", 0, 4);
  981. setSetting("rlyGPIO", 1, 5);
  982. setSetting("rlyGPIO", 2, 16);
  983. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  984. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  985. setSetting("rlyType", 2, RELAY_TYPE_NORMAL);
  986. #elif defined(ARNIEX_SWIFITCH)
  987. // SWIFITCH
  988. // https://github.com/ArnieX/swifitch
  989. setSetting("board", BOARD_ARNIEX_SWIFITCH);
  990. setSetting("device", "ARNIEX_SWIFITCH");
  991. setSetting("btnGPIO", 0, 4);
  992. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH | BUTTON_SET_PULLUP);
  993. setSetting("btnRelay", 0, 1);
  994. setSetting("btnPress", 0, BUTTON_MODE_NONE);
  995. setSetting("btnClick", 0, BUTTON_MODE_TOGGLE);
  996. setSetting("btnDblClick", 0, BUTTON_MODE_NONE);
  997. setSetting("btnLngClick", 0, BUTTON_MODE_NONE);
  998. setSetting("btnLngLngClick", 0, BUTTON_MODE_NONE);
  999. setSetting("ledGPIO", 0, 12);
  1000. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  1001. setSetting("rlyGPIO", 0, 5);
  1002. setSetting("rlyType", 0, RELAY_TYPE_INVERSE);
  1003. #elif defined(GENERIC_ESP01S_RELAY_V40)
  1004. // ESP-01S RELAY v4.0
  1005. // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180404024035&SearchText=esp-01s+relay
  1006. setSetting("board", BOARD_GENERIC_ESP01S_RELAY_V40);
  1007. setSetting("device", "GENERIC_ESP01S_RELAY_V40");
  1008. setSetting("ledGPIO", 0, 2);
  1009. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  1010. setSetting("rlyGPIO", 0, 0);
  1011. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1012. #elif defined(GENERIC_ESP01S_RGBLED_V10)
  1013. // ESP-01S RGB LED v1.0 (some sold with ws2818)
  1014. // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180404023816&SearchText=esp-01s+led+controller
  1015. setSetting("board", BOARD_GENERIC_ESP01S_RGBLED_V10);
  1016. setSetting("device", "GENERIC_ESP01S_RGBLED_V10");
  1017. setSetting("ledGPIO", 0, 2);
  1018. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  1019. #elif defined(HELTEC_TOUCHRELAY)
  1020. // Heltec Touch Relay
  1021. // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180408043114&SearchText=esp8266+touch+relay
  1022. setSetting("board", BOARD_HELTEC_TOUCHRELAY);
  1023. setSetting("device", "HELTEC_TOUCHRELAY");
  1024. setSetting("btnGPIO", 0, 14);
  1025. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1026. setSetting("btnRelay", 0, 1);
  1027. setSetting("rlyGPIO", 0, 12);
  1028. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1029. #elif defined(GENERIC_ESP01S_DHT11_V10)
  1030. // ESP-01S DHT11 v1.0
  1031. // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180410105907&SearchText=esp-01s+dht11
  1032. setSetting("board", BOARD_GENERIC_ESP01S_DHT11_V10);
  1033. setSetting("device", "GENERIC_ESP01S_DHT11_V10");
  1034. setSetting("dhtEnabled", 1);
  1035. setSetting("dhtGPIO", 0, 2);
  1036. setSetting("dhtType", 0, DHT_CHIP_DHT11);
  1037. #elif defined(GENERIC_ESP01S_DS18B20_V10)
  1038. // ESP-01S DS18B20 v1.0
  1039. // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180410105933&SearchText=esp-01s+ds18b20
  1040. setSetting("board", BOARD_GENERIC_ESP01S_DS18B20_V10);
  1041. setSetting("device", "GENERIC_ESP01S_DS18B20_V10");
  1042. setSetting("dsEnabled", 1);
  1043. setSetting("dsGPIO", 0, 2);
  1044. #elif defined(ZHILDE_EU44_W)
  1045. // Zhilde ZLD-EU44-W
  1046. // http://www.zhilde.com/product/60705150109-805652505/EU_WiFi_Surge_Protector_Extension_Socket_4_Outlets_works_with_Amazon_Echo_Smart_Power_Strip.html
  1047. setSetting("board", BOARD_ZHILDE_EU44_W);
  1048. setSetting("device", "ZHILDE_EU44_W");
  1049. setSetting("btnGPIO", 0, 3);
  1050. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1051. setSetting("btnRelay", 0, 0);
  1052. setSetting("ledGPIO", 0, 1);
  1053. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  1054. setSetting("rlyGPIO", 0, 5);
  1055. setSetting("rlyGPIO", 1, 4);
  1056. setSetting("rlyGPIO", 2, 12);
  1057. setSetting("rlyGPIO", 3, 13);
  1058. setSetting("rlyGPIO", 4, 14);
  1059. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1060. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  1061. setSetting("rlyType", 2, RELAY_TYPE_NORMAL);
  1062. setSetting("rlyType", 3, RELAY_TYPE_NORMAL);
  1063. setSetting("rlyType", 4, RELAY_TYPE_NORMAL);
  1064. // Based on the reporter, this product uses GPIO1 and 3 for the button
  1065. // and onboard LED, so hardware serial should be disabled...
  1066. setSetting("dbgSerial", 0);
  1067. #elif defined(ITEAD_SONOFF_POW_R2)
  1068. setSetting("board", BOARD_ITEAD_SONOFF_POW_R2);
  1069. setSetting("device", "ITEAD_SONOFF_POW_R2");
  1070. setSetting("btnGPIO", 0, 0);
  1071. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1072. setSetting("btnRelay", 0, 0);
  1073. setSetting("ledGPIO", 0, 13);
  1074. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  1075. setSetting("rlyGPIO", 0, 12);
  1076. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1077. setSetting("cseEnabled", 1);
  1078. setSetting("cseGPIO", 1);
  1079. setSetting("dbgSerial", 0);
  1080. #elif defined(LUANI_HVIO)
  1081. // Luani HVIO
  1082. // https://luani.de/projekte/esp8266-hvio/
  1083. // https://luani.de/blog/esp8266-230v-io-modul/
  1084. setSetting("board", BOARD_LUANI_HVIO);
  1085. setSetting("device", "LUANI_HVIO");
  1086. setSetting("ledGPIO", 0, 15);
  1087. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  1088. setSetting("btnGPIO", 0, 12);
  1089. setSetting("btnGPIO", 1, 13);
  1090. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1091. setSetting("btnMode", 1, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1092. setSetting("btnRelay", 0, 0);
  1093. setSetting("btnRelay", 1, 1);
  1094. setSetting("btnDblClick", 0, BUTTON_MODE_NONE);
  1095. setSetting("rlyGPIO", 0, 4);
  1096. setSetting("rlyGPIO", 1, 5);
  1097. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1098. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  1099. #elif defined(ALLNET_4DUINO_IOT_WLAN_RELAIS)
  1100. // Allnet 4duino ESP8266-UP-Relais
  1101. // http://www.allnet.de/de/allnet-brand/produkte/neuheiten/p/allnet-4duino-iot-wlan-relais-unterputz-esp8266-up-relais/
  1102. // https://shop.allnet.de/fileadmin/transfer/products/148814.pdf
  1103. setSetting("board", BOARD_ALLNET_4DUINO_IOT_WLAN_RELAIS);
  1104. setSetting("device", "ALLNET_4DUINO_IOT_WLAN_RELAIS");
  1105. setSetting("ledGPIO", 0, 0);
  1106. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  1107. setSetting("rlyGPIO", 0, 14);
  1108. setSetting("rlyResetGPIO", 0, 12);
  1109. setSetting("rlyType", 0, RELAY_TYPE_LATCHED);
  1110. #elif defined(TONBUX_MOSQUITO_KILLER)
  1111. // Tonbux 50-100M Smart Mosquito Killer USB
  1112. // https://www.aliexpress.com/item/Original-Tonbux-50-100M-Smart-Mosquito-Killer-USB-Plug-No-Noise-Repellent-App-Smart-Module/32859330820.html
  1113. setSetting("board", BOARD_TONBUX_MOSQUITO_KILLER);
  1114. setSetting("device", "TONBUX_MOSQUITO_KILLER");
  1115. setSetting("btnGPIO", 0, 2);
  1116. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1117. setSetting("btnRelay", 0, 0);
  1118. setSetting("ledGPIO", 0, 15);
  1119. setSetting("ledGPIO", 1, 14);
  1120. setSetting("ledGPIO", 2, 12);
  1121. setSetting("ledGPIO", 3, 16);
  1122. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  1123. setSetting("ledLogic", 1, GPIO_LOGIC_INVERSE);
  1124. setSetting("ledLogic", 2, GPIO_LOGIC_DIRECT);
  1125. setSetting("ledLogic", 3, GPIO_LOGIC_DIRECT);
  1126. setSetting("ledMode", 0, LED_MODE_WIFI);
  1127. setSetting("ledMode", 1, LED_MODE_RELAY);
  1128. setSetting("ledRelay", 1, 0);
  1129. setSetting("rlyGPIO", 0, 5); // Fan
  1130. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1131. #elif defined(NEO_COOLCAM_NAS_WR01W)
  1132. // NEO Coolcam NAS-WR01W Wifi Smart Power Plug
  1133. // https://es.aliexpress.com/item/-/32854589733.html?spm=a219c.12010608.0.0.6d084e68xX0y5N
  1134. // https://www.fasttech.com/product/9649426-neo-coolcam-nas-wr01w-wifi-smart-power-plug-eu
  1135. setSetting("board", BOARD_NEO_COOLCAM_NAS_WR01W);
  1136. setSetting("device", "NEO_COOLCAM_NAS_WR01W");
  1137. setSetting("btnGPIO", 0, 13);
  1138. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1139. setSetting("btnRelay", 0, 0);
  1140. setSetting("ledGPIO", 0, 4);
  1141. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  1142. setSetting("rlyGPIO", 0, 12);
  1143. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1144. #elif defined(PILOTAK_ESP_DIN_V1)
  1145. // ESP-DIN relay board V1
  1146. // https://github.com/pilotak/esp_din
  1147. setSetting("board", BOARD_PILOTAK_ESP_DIN_V1);
  1148. setSetting("device", "PILOTAK_ESP_DIN_V1");
  1149. setSetting("btnGPIO", 0, 0);
  1150. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1151. setSetting("btnRelay", 0, 0);
  1152. setSetting("ledGPIO", 0, 15);
  1153. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  1154. setSetting("rlyGPIO", 0, 4);
  1155. setSetting("rlyGPIO", 1, 5);
  1156. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1157. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  1158. setSetting("digEnabled", 1);
  1159. setSetting("digGPIO", 0, 16);
  1160. setSetting("digMode", 0, INPUT);
  1161. setSetting("dsEnabled", 1);
  1162. setSetting("dsGPIO", 0, 2);
  1163. setSetting("i2cEnable", 1);
  1164. setSetting("i2cSDAGPIO", 12);
  1165. setSetting("i2cSCLGPIO", 13);
  1166. setSetting("rfEnabled", 1);
  1167. setSetting("rfGPIO", 14);
  1168. #elif defined(ESTINK_WIFI_POWER_STRIP)
  1169. // Estink Wifi Power Strip
  1170. // https://www.amazon.de/Steckdosenleiste-Ladeger%C3%A4t-Sprachsteuerung-SmartphonesTablets-Android/dp/B0796W5FZY
  1171. // Fornorm Wi-Fi USB Extension Socket (ZLD-34EU)
  1172. // https://www.aliexpress.com/item/Fornorm-WiFi-Extension-Socket-with-Surge-Protector-Smart-Power-Strip-3-Outlets-and-4-USB-Charging/32849743948.html
  1173. setSetting("board", BOARD_ESTINK_WIFI_POWER_STRIP);
  1174. setSetting("device", "ESTINK_WIFI_POWER_STRIP");
  1175. setSetting("btnGPIO", 0, 16);
  1176. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1177. setSetting("btnRelay", 0, 3);
  1178. setSetting("ledGPIO", 0, 0);
  1179. setSetting("ledGPIO", 1, 12);
  1180. setSetting("ledGPIO", 2, 3);
  1181. setSetting("ledGPIO", 3, 5);
  1182. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  1183. setSetting("ledLogic", 1, GPIO_LOGIC_INVERSE);
  1184. setSetting("ledLogic", 2, GPIO_LOGIC_INVERSE);
  1185. setSetting("ledLogic", 3, GPIO_LOGIC_INVERSE);
  1186. setSetting("ledMode", 0, LED_MODE_FINDME);
  1187. setSetting("ledMode", 1, LED_MODE_FOLLOW);
  1188. setSetting("ledMode", 2, LED_MODE_FOLLOW);
  1189. setSetting("ledMode", 3, LED_MODE_FOLLOW);
  1190. setSetting("ledRelay", 1, 1);
  1191. setSetting("ledRelay", 2, 2);
  1192. setSetting("ledRelay", 3, 3);
  1193. setSetting("rlyGPIO", 0, 14); // USB power
  1194. setSetting("rlyGPIO", 1, 13); // power plug 1
  1195. setSetting("rlyGPIO", 2, 4); // power plug 2
  1196. setSetting("rlyGPIO", 3, 15); // power plug 3
  1197. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1198. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  1199. setSetting("rlyType", 2, RELAY_TYPE_NORMAL);
  1200. setSetting("rlyType", 3, RELAY_TYPE_NORMAL);
  1201. // Disable UART noise since this board uses GPIO3
  1202. setSetting("dbgSerial", 0);
  1203. #elif defined(BH_ONOFRE)
  1204. // Bruno Horta's OnOfre
  1205. // https://www.bhonofre.pt/
  1206. // https://github.com/brunohorta82/BH_OnOfre/
  1207. setSetting("board", BOARD_BH_ONOFRE);
  1208. setSetting("device", "BH_ONOFRE");
  1209. setSetting("btnGPIO", 0, 12);
  1210. setSetting("btnGPIO", 1, 13);
  1211. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH | BUTTON_SET_PULLUP);
  1212. setSetting("btnMode", 1, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH | BUTTON_SET_PULLUP);
  1213. setSetting("btnRelay", 0, 0);
  1214. setSetting("btnRelay", 1, 1);
  1215. setSetting("rlyGPIO", 0, 4);
  1216. setSetting("rlyGPIO", 1, 5);
  1217. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1218. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  1219. #elif defined(BLITZWOLF_BWSHP2)
  1220. // Several boards under different names uing a power chip labelled BL0937 or HJL-01
  1221. // * Blitzwolf (https://www.amazon.es/Inteligente-Temporización-Dispositivos-Cualquier-BlitzWolf/dp/B07BMQP142)
  1222. // * HomeCube (https://www.amazon.de/Steckdose-Homecube-intelligente-Verbrauchsanzeige-funktioniert/dp/B076Q2LKHG)
  1223. // * Coosa (https://www.amazon.com/COOSA-Monitoring-Function-Campatible-Assiatant/dp/B0788W9TDR)
  1224. // * Goosund (http://www.gosund.com/?m=content&c=index&a=show&catid=6&id=5)
  1225. // * Ablue (https://www.amazon.de/Intelligente-Steckdose-Ablue-Funktioniert-Assistant/dp/B076DRFRZC)
  1226. setSetting("board", BOARD_BLITZWOLF_BWSHP2);
  1227. setSetting("device", "BLITZWOLF_BWSHP2");
  1228. setSetting("btnGPIO", 0, 13);
  1229. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1230. setSetting("btnRelay", 0, 0);
  1231. setSetting("ledGPIO", 0, 2);
  1232. setSetting("ledGPIO", 1, 0);
  1233. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  1234. setSetting("ledLogic", 1, GPIO_LOGIC_INVERSE);
  1235. setSetting("ledMode", 0, LED_MODE_WIFI);
  1236. setSetting("ledMode", 1, LED_MODE_FINDME);
  1237. setSetting("ledRelay", 1, 0);
  1238. setSetting("rlyGPIO", 0, 15);
  1239. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1240. setSetting("hlwSELGPIO", 12);
  1241. setSetting("hlwCF1GPIO", 14);
  1242. setSetting("hlwCFGPIO", 5);
  1243. setSetting("hlwCurSel", LOW);
  1244. setSetting("hlwIntMode", FALLING);
  1245. setSetting("curRatio", 25740);
  1246. setSetting("volRatio", 313400);
  1247. setSetting("pwrRatio", 3414290);
  1248. #elif defined(HOMECUBE_16A)
  1249. // Homecube 16A is similar to BLITZWOLF_BWSHP2 but some pins differ and it also has RGB LEDs
  1250. // https://www.amazon.de/gp/product/B07D7RVF56/ref=oh_aui_detailpage_o00_s01?ie=UTF8&psc=1
  1251. setSetting("board", BOARD_HOMECUBE_16A);
  1252. setSetting("device", "HOMECUBE_16A");
  1253. setSetting("btnGPIO", 0, 13);
  1254. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1255. setSetting("btnRelay", 0, 0);
  1256. setSetting("ledGPIO", 0, 2);
  1257. setSetting("ledGPIO", 1, 12);
  1258. setSetting("ledGPIO", 2, 0);
  1259. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  1260. setSetting("ledLogic", 1, GPIO_LOGIC_DIRECT);
  1261. setSetting("ledLogic", 2, GPIO_LOGIC_DIRECT);
  1262. setSetting("ledMode", 0, LED_MODE_WIFI);
  1263. setSetting("ledMode", 1, LED_MODE_FINDME);
  1264. setSetting("ledMode", 2, LED_MODE_OFF);
  1265. setSetting("ledRelay", 1, 0);
  1266. setSetting("rlyGPIO", 0, 15);
  1267. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1268. setSetting("hlwSELGPIO", 16);
  1269. setSetting("hlwCF1GPIO", 14);
  1270. setSetting("hlwCFGPIO", 5);
  1271. setSetting("hlwCurSel", LOW);
  1272. setSetting("hlwIntMode", FALLING);
  1273. setSetting("curRatio", 25740);
  1274. setSetting("volRatio", 313400);
  1275. setSetting("pwrRatio", 3414290);
  1276. #elif defined(TINKERMAN_ESPURNA_SWITCH)
  1277. setSetting("board", BOARD_TINKERMAN_ESPURNA_SWITCH);
  1278. setSetting("device", "TINKERMAN_ESPURNA_SWITCH");
  1279. setSetting("btnGPIO", 0, 4);
  1280. setSetting("btnMode", 0, BUTTON_PUSHBUTTON);
  1281. setSetting("btnPress", 0, BUTTON_MODE_TOGGLE);
  1282. setSetting("btnClick", 0, BUTTON_MODE_NONE);
  1283. setSetting("btnDblClick", 0, BUTTON_MODE_NONE);
  1284. setSetting("btnLngClick", 0, BUTTON_MODE_NONE);
  1285. setSetting("btnLngLngClick", 0, BUTTON_MODE_NONE);
  1286. setSetting("btnRelay", 0, 0);
  1287. setSetting("ledGPIO", 0, 2);
  1288. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  1289. setSetting("rlyGPIO", 0, 12);
  1290. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1291. #elif defined(ITEAD_SONOFF_S31)
  1292. setSetting("board", BOARD_ITEAD_SONOFF_S31);
  1293. setSetting("device", "ITEAD_SONOFF_S31");
  1294. setSetting("btnGPIO", 0, 0);
  1295. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1296. setSetting("btnRelay", 0, 0);
  1297. setSetting("ledGPIO", 0, 13);
  1298. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  1299. setSetting("rlyGPIO", 0, 12);
  1300. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1301. setSetting("cseEnabled", 1);
  1302. setSetting("cseGPIO", 1);
  1303. setSetting("dbgSerial", 0);
  1304. #elif defined(STM_RELAY)
  1305. setSetting("board", BOARD_STM_RELAY);
  1306. setSetting("device", "STM_RELAY");
  1307. setSetting("rlyDummy", 2);
  1308. setSetting("rlyProvider", RELAY_PROVIDER_STM);
  1309. setSetting("dbgSerial", 0);
  1310. #elif defined(VANZAVANZU_SMART_WIFI_PLUG_MINI)
  1311. // VANZAVANZU Smart Outlet Socket (based on BL0937 or HJL-01)
  1312. // https://www.amazon.com/Smart-Plug-Wifi-Mini-VANZAVANZU/dp/B078PHD6S5
  1313. setSetting("board", BOARD_VANZAVANZU_SMART_WIFI_PLUG_MINI);
  1314. setSetting("device", "VANZAVANZU_SMART_WIFI_PLUG_MINI");
  1315. setSetting("btnGPIO", 0, 13);
  1316. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1317. setSetting("btnRelay", 0, 0);
  1318. setSetting("ledGPIO", 0, 2);
  1319. setSetting("ledGPIO", 1, 0);
  1320. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  1321. setSetting("ledLogic", 1, GPIO_LOGIC_INVERSE);
  1322. setSetting("ledMode", 0, LED_MODE_WIFI);
  1323. setSetting("ledMode", 1, LED_MODE_FINDME);
  1324. setSetting("ledRelay", 1, 0);
  1325. setSetting("rlyGPIO", 0, 15);
  1326. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1327. setSetting("hlwSELGPIO", 3);
  1328. setSetting("hlwCF1GPIO", 14);
  1329. setSetting("hlwCFGPIO", 5);
  1330. setSetting("hlwCurSel", LOW);
  1331. setSetting("hlwIntMode", FALLING);
  1332. setSetting("curRatio", 25740);
  1333. setSetting("volRatio", 313400);
  1334. setSetting("pwrRatio", 3414290);
  1335. setSetting("dbgSerial", 0);
  1336. #elif defined(GENERIC_GEIGER_COUNTER)
  1337. setSetting("board", BOARD_GENERIC_GEIGER_COUNTER);
  1338. setSetting("device", "GENERIC_GEIGER_COUNTER");
  1339. setSetting("geiEnabled", 1);
  1340. setSetting("geiGPIO", 5);
  1341. #elif defined(TINKERMAN_RFM69GW)
  1342. // Check http://tinkerman.cat/rfm69-wifi-gateway/
  1343. setSetting("board", BOARD_TINKERMAN_RFM69GW);
  1344. setSetting("device", "TINKERMAN_RFM69GW");
  1345. setSetting("btnGPIO", 0, 0);
  1346. setSetting("rfm69Enabled", 1);
  1347. setSetting("rfm69CSGPIO", 15);
  1348. setSetting("rfm69IRQGPIO", 5);
  1349. setSetting("rfm69ResetGPIO", 7);
  1350. setSetting("rfm69HW", 0);
  1351. #elif defined(ITEAD_SONOFF_IFAN02)
  1352. setSetting("board", BOARD_ITEAD_SONOFF_IFAN02);
  1353. setSetting("btnGPIO", 0, 0);
  1354. setSetting("btnGPIO", 1, 9);
  1355. setSetting("btnGPIO", 2, 10);
  1356. setSetting("btnGPIO", 3, 14);
  1357. setSetting("ledGPIO", 0, 13);
  1358. setSetting("ledLogic", 0, 1);
  1359. setSetting("ledMode", 0, LED_MODE_WIFI);
  1360. setSetting("rlyGPIO", 0, 12);
  1361. setSetting("rlyGPIO", 1, 5);
  1362. setSetting("rlyGPIO", 2, 4);
  1363. setSetting("rlyGPIO", 3, 15);
  1364. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1365. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  1366. setSetting("rlyType", 2, RELAY_TYPE_NORMAL);
  1367. setSetting("rlyType", 3, RELAY_TYPE_NORMAL);
  1368. #elif defined(GENERIC_AG_L4)
  1369. setSetting("board", BOARD_GENERIC_AG_L4);
  1370. setSetting("btnGPIO", 0, 4);
  1371. setSetting("btnGPIO", 1, 2);
  1372. setSetting("btnRelay", 0, 0);
  1373. setSetting("btnMode", 0, BUTTON_PUSHBUTTON);
  1374. setSetting("btnPress", 0, BUTTON_MODE_TOGGLE);
  1375. setSetting("btnClick", 0, BUTTON_MODE_NONE);
  1376. setSetting("btnDblClick", 0, BUTTON_MODE_NONE);
  1377. setSetting("btnLngClick", 0, BUTTON_MODE_NONE);
  1378. setSetting("btnLngLngClick", 0, BUTTON_MODE_NONE);
  1379. setSetting("ledGPIO", 0, 5);
  1380. setSetting("ledGPIO", 1, 16);
  1381. setSetting("ledLogic", 0, 0);
  1382. setSetting("ledLogic", 1, 1);
  1383. setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
  1384. setSetting("rlyDummy", 1);
  1385. setSetting("litProvider", LIGHT_PROVIDER_DIMMER);
  1386. setSetting("litChGPIO", 0, 14);
  1387. setSetting("litChGPIO", 1, 13);
  1388. setSetting("litChGPIO", 2, 12);
  1389. setSetting("litChLogic", 0, 0);
  1390. setSetting("litChLogic", 1, 0);
  1391. setSetting("litChLogic", 2, 0);
  1392. #endif
  1393. }
  1394. void _hardwareMigrateMoveIndexDown(const char * key, int offset = 0) {
  1395. if (hasSetting(key, 0)) return;
  1396. for (unsigned char index = 1; index < SETTINGS_MAX_LIST_COUNT; index++) {
  1397. if (hasSetting(key, index)) {
  1398. setSetting(key, index - 1, getSetting(key, index).toInt() + offset);
  1399. } else {
  1400. delSetting(key, index - 1);
  1401. }
  1402. }
  1403. }
  1404. // Configuration versions
  1405. //
  1406. // 1: based on Embedis, no board definitions
  1407. // 2: based on Embedis, with board definitions 1-based
  1408. // 3: based on Embedis, with board definitions 0-based
  1409. // 4: based on Embedis, added sensors and force resetting
  1410. void _hardwareMigrate() {
  1411. moveSetting("boardName", "device");
  1412. moveSettings("relayGPIO", "rlyGPIO");
  1413. moveSettings("relayResetGPIO", "rlyResetGPIO");
  1414. moveSettings("relayType", "rlyType");
  1415. moveSetting("selGPIO", "hlwSELGPIO");
  1416. moveSetting("cfGPIO", "hlwCFGPIO");
  1417. moveSetting("cf1GPIO", "hlwCF1GPIO");
  1418. moveSetting("relayProvider", "rlyProvider");
  1419. moveSetting("lightProvider", "litProvider");
  1420. moveSetting("relays", "rlyDummy");
  1421. moveSettings("chGPIO", "litChGPIO");
  1422. moveSettings("chLogic", "litChLogic");
  1423. moveSetting("enGPIO", "litEnableGPIO");
  1424. moveSetting("hlwSelC", "hlwCurLevel");
  1425. moveSetting("hlwIntM", "hlwInt");
  1426. delSetting("ledWifi");
  1427. // Get config version
  1428. unsigned int board = getSetting("board", 0).toInt();
  1429. unsigned int config_version = getSetting("cfg", board > 0 ? 2 : 1).toInt();
  1430. setSetting("cfg", CFG_VERSION);
  1431. if (config_version == 2) {
  1432. _hardwareMigrateMoveIndexDown("ledGPIO");
  1433. _hardwareMigrateMoveIndexDown("ledLogic");
  1434. _hardwareMigrateMoveIndexDown("btnGPIO");
  1435. _hardwareMigrateMoveIndexDown("btnRelay", -1);
  1436. _hardwareMigrateMoveIndexDown("rlyGPIO");
  1437. _hardwareMigrateMoveIndexDown("rlyType");
  1438. }
  1439. }
  1440. void _hardwareSpecific() {
  1441. // These devices use the hardware UART
  1442. // to communicate to secondary microcontrollers
  1443. #if defined(ITEAD_SONOFF_RFBRIDGE) || defined(ITEAD_SONOFF_DUAL) || (RELAY_PROVIDER == RELAY_PROVIDER_STM)
  1444. Serial.begin(DEBUG_SERIAL_SPEED);
  1445. #endif
  1446. }
  1447. // -----------------------------------------------------------------------------
  1448. void hardwareSetup() {
  1449. _hardwareMigrate();
  1450. if (getSetting("board", 1).toInt() != 1) {
  1451. _hardwareLoad();
  1452. }
  1453. _hardwareSpecific();
  1454. }