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.

1822 lines
63 KiB

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