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.

1701 lines
58 KiB

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