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.

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