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.

1513 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("ledGPIO", 0, 2);
  57. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  58. setSetting("btnGPIO", 0, 0);
  59. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  60. setSetting("btnRelay", 0, 0);
  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("ledGPIO", 0, 2);
  66. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  67. setSetting("btnGPIO", 0, 0);
  68. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  69. setSetting("btnRelay", 0, 0);
  70. setSetting("rlyGPIO", 0, 5);
  71. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  72. #elif defined(ITEAD_SONOFF_BASIC)
  73. setSetting("board", 4);
  74. setSetting("ledGPIO", 0, 13);
  75. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  76. setSetting("btnGPIO", 0, 0);
  77. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  78. setSetting("btnRelay", 0, 0);
  79. setSetting("rlyGPIO", 0, 12);
  80. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  81. #elif defined(ITEAD_SONOFF_TH)
  82. setSetting("board", 5);
  83. setSetting("ledGPIO", 0, 13);
  84. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  85. setSetting("btnGPIO", 0, 0);
  86. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  87. setSetting("btnRelay", 0, 0);
  88. setSetting("rlyGPIO", 0, 12);
  89. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  90. #elif defined(ITEAD_SONOFF_SV)
  91. setSetting("board", 6);
  92. setSetting("ledGPIO", 0, 13);
  93. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  94. setSetting("btnGPIO", 0, 0);
  95. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  96. setSetting("btnRelay", 0, 0);
  97. setSetting("rlyGPIO", 0, 12);
  98. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  99. #elif defined(ITEAD_SONOFF_TOUCH)
  100. setSetting("board", 7);
  101. setSetting("ledGPIO", 0, 13);
  102. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  103. setSetting("btnGPIO", 0, 0);
  104. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  105. setSetting("btnRelay", 0, 0);
  106. setSetting("btnPress", 0, BUTTON_MODE_TOGGLE);
  107. setSetting("btnClick", 0, BUTTON_MODE_NONE);
  108. setSetting("btnDblClick", 0, BUTTON_MODE_NONE);
  109. setSetting("btnLngClick", 0, BUTTON_MODE_NONE);
  110. setSetting("btnLngLngClick", 0, BUTTON_MODE_RESET);
  111. setSetting("rlyGPIO", 0, 12);
  112. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  113. #elif defined(ITEAD_SONOFF_POW)
  114. setSetting("board", 8);
  115. setSetting("ledGPIO", 0, 15);
  116. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  117. setSetting("btnGPIO", 0, 0);
  118. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  119. setSetting("btnRelay", 0, 0);
  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("ledGPIO", 0, 13);
  129. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  130. setSetting("btnRelay", 0, GPIO_INVALID);
  131. setSetting("btnRelay", 1, GPIO_INVALID);
  132. setSetting("btnRelay", 2, 0);
  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("ledGPIO", 0, 13);
  148. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  149. setSetting("btnGPIO", 0, 0);
  150. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  151. setSetting("btnRelay", 0, 0);
  152. setSetting("rlyGPIO", 0, 12);
  153. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  154. #elif defined(ITEAD_SONOFF_4CH)
  155. setSetting("board", 11);
  156. setSetting("ledGPIO", 0, 13);
  157. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  158. setSetting("btnGPIO", 0, 0);
  159. setSetting("btnGPIO", 1, 9);
  160. setSetting("btnGPIO", 2, 10);
  161. setSetting("btnGPIO", 3, 14);
  162. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  163. setSetting("btnMode", 1, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  164. setSetting("btnMode", 2, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  165. setSetting("btnMode", 3, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  166. setSetting("btnRelay", 0, 0);
  167. setSetting("btnRelay", 1, 1);
  168. setSetting("btnRelay", 2, 2);
  169. setSetting("btnRelay", 3, 3);
  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("ledGPIO", 0, 13);
  181. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  182. setSetting("btnGPIO", 0, 0);
  183. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  184. setSetting("btnRelay", 0, 0);
  185. setSetting("rlyGPIO", 0, 12);
  186. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  187. #elif defined(ITEAD_S20)
  188. setSetting("board", 13);
  189. setSetting("ledGPIO", 0, 13);
  190. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  191. setSetting("btnGPIO", 0, 0);
  192. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  193. setSetting("btnRelay", 0, 0);
  194. setSetting("rlyGPIO", 0, 12);
  195. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  196. #elif defined(ELECTRODRAGON_WIFI_IOT)
  197. setSetting("board", 14);
  198. setSetting("ledGPIO", 0, 16);
  199. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  200. setSetting("btnGPIO", 0, 0);
  201. setSetting("btnGPIO", 1, 2);
  202. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  203. setSetting("btnMode", 1, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  204. setSetting("btnRelay", 0, 0);
  205. setSetting("btnRelay", 1, 1);
  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("ledGPIO", 0, 2);
  213. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  214. setSetting("btnGPIO", 0, 13);
  215. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  216. setSetting("btnRelay", 0, 0);
  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("ledGPIO", 0, 16);
  248. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  249. setSetting("btnGPIO", 0, 0);
  250. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  251. setSetting("btnRelay", 0, 0);
  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("litProvider", LIGHT_PROVIDER_MY92XX);
  267. setSetting("myModel", MY92XX_MODEL_MY9291); // 4 channels per chip
  268. setSetting("myChips", 1);
  269. setSetting("myDIGPIO", 13);
  270. setSetting("myDCKIGPIO", 15);
  271. setSetting("myMapping", "0123");
  272. setSetting("rlyCount", 1);
  273. #elif defined(MAGICHOME_LED_CONTROLLER)
  274. setSetting("board", 21);
  275. setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
  276. setSetting("litProvider", LIGHT_PROVIDER_DIMMER);
  277. setSetting("ledGPIO", 0, 2);
  278. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  279. setSetting("litChGPIO", 0, 14);
  280. setSetting("litChGPIO", 1, 5);
  281. setSetting("litChGPIO", 2, 12);
  282. setSetting("litChGPIO", 3, 13);
  283. setSetting("litChLogic", 0, GPIO_LOGIC_DIRECT);
  284. setSetting("litChLogic", 1, GPIO_LOGIC_DIRECT);
  285. setSetting("litChLogic", 2, GPIO_LOGIC_DIRECT);
  286. setSetting("litChLogic", 3, GPIO_LOGIC_DIRECT);
  287. setSetting("rlyCount", 1);
  288. setSetting("irEnabled", 1);
  289. setSetting("irGPIO", 4);
  290. setSetting("irSet", 1);
  291. #elif defined(ITEAD_MOTOR)
  292. setSetting("board", 22);
  293. setSetting("ledGPIO", 0, 13);
  294. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  295. setSetting("btnGPIO", 0, 0);
  296. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  297. setSetting("btnRelay", 0, 0);
  298. setSetting("rlyGPIO", 0, 12);
  299. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  300. #elif defined(TINKERMAN_ESPURNA_H06)
  301. setSetting("board", 23);
  302. setSetting("ledGPIO", 0, 5);
  303. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  304. setSetting("btnGPIO", 0, 4);
  305. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  306. setSetting("btnRelay", 0, 0);
  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("rlyProvider", RELAY_PROVIDER_LIGHT);
  316. setSetting("litProvider", LIGHT_PROVIDER_DIMMER);
  317. setSetting("ledGPIO", 0, 5);
  318. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  319. setSetting("litChGPIO", 0, 15);
  320. setSetting("litChGPIO", 1, 13);
  321. setSetting("litChGPIO", 2, 12);
  322. setSetting("litChGPIO", 3, 14);
  323. setSetting("litChGPIO", 4, 4);
  324. setSetting("litChLogic", 0, GPIO_LOGIC_DIRECT);
  325. setSetting("litChLogic", 1, GPIO_LOGIC_DIRECT);
  326. setSetting("litChLogic", 2, GPIO_LOGIC_DIRECT);
  327. setSetting("litChLogic", 3, GPIO_LOGIC_DIRECT);
  328. setSetting("litChLogic", 4, GPIO_LOGIC_DIRECT);
  329. setSetting("rlyCount", 1);
  330. setSetting("dbgPort", 1);
  331. setSetting("dbgRXEnabled", 1);
  332. #elif defined(ITEAD_BNSZ01)
  333. setSetting("board", 25);
  334. setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
  335. setSetting("litProvider", LIGHT_PROVIDER_DIMMER);
  336. setSetting("ledGPIO", 0, 13);
  337. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  338. setSetting("litChGPIO", 0, 12);
  339. setSetting("litChLogic", 0, GPIO_LOGIC_DIRECT);
  340. setSetting("rlyCount", 1);
  341. #elif defined(ITEAD_SONOFF_RFBRIDGE)
  342. setSetting("board", 26);
  343. setSetting("ledGPIO", 0, 13);
  344. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  345. setSetting("btnGPIO", 0, 0);
  346. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  347. setSetting("rlyProvider", RELAY_PROVIDER_RFBRIDGE);
  348. setSetting("rlyCount", 8);
  349. setSetting("rfbDirect", 0);
  350. setSetting("rfbRXGPIO", 4);
  351. setSetting("rfbTXGPIO", 5);
  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. #elif defined(ITEAD_SONOFF_4CH_PRO)
  358. setSetting("board", 27);
  359. setSetting("ledGPIO", 0, 13);
  360. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  361. setSetting("btnGPIO", 0, 0);
  362. setSetting("btnGPIO", 1, 9);
  363. setSetting("btnGPIO", 2, 10);
  364. setSetting("btnGPIO", 3, 14);
  365. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  366. setSetting("btnMode", 1, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  367. setSetting("btnMode", 2, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  368. setSetting("btnMode", 3, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  369. setSetting("btnRelay", 0, 0);
  370. setSetting("btnRelay", 1, 1);
  371. setSetting("btnRelay", 2, 2);
  372. setSetting("btnRelay", 3, 3);
  373. setSetting("rlyGPIO", 0, 12);
  374. setSetting("rlyGPIO", 1, 5);
  375. setSetting("rlyGPIO", 2, 4);
  376. setSetting("rlyGPIO", 3, 15);
  377. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  378. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  379. setSetting("rlyType", 2, RELAY_TYPE_NORMAL);
  380. setSetting("rlyType", 3, RELAY_TYPE_NORMAL);
  381. // Sonoff 4CH Pro uses a secondary STM32 microcontroller to handle
  382. // buttons and relays, but it also forwards button presses to the ESP8285.
  383. // This allows ESPurna to handle button presses -almost- the same way
  384. // as with other devices except:
  385. // * Double click seems to break/disable the button on the STM32 side
  386. // * With S6 switch to 1 (self-locking and inching modes) everything's OK
  387. // * With S6 switch to 0 (interlock mode) if there is a relay ON
  388. // and you click on another relay button, the STM32 sends a "press"
  389. // event for the button of the first relay (to turn it OFF) but it
  390. // does not send a "release" event. It's like it's holding the
  391. // button down since you can see it is still LOW.
  392. // Whatever reason the result is that it may actually perform a
  393. // long click or long-long click.
  394. // The configuration below make the button toggle the relay on press events
  395. // and disables any possibly harmful combination with S6 set to 0.
  396. // If you are sure you will only use S6 to 1 you can comment the
  397. // btnLngClick(0) and btnLngLngClick(0) options below to recover the
  398. // reset mode and factory reset functionalities, or link other actions like
  399. // AP mode in the commented line below.
  400. setSetting("btnPress", 0, BUTTON_MODE_TOGGLE);
  401. setSetting("btnClick", 0, BUTTON_MODE_NONE);
  402. setSetting("btnDblClick", 0, BUTTON_MODE_NONE);
  403. setSetting("btnLngClick", 0, BUTTON_MODE_NONE); // or BUTTON_MODE_AP
  404. setSetting("btnLngLngClick", 0, BUTTON_MODE_NONE); // or BUTTON_MODE_FACTORY
  405. setSetting("btnPress", 1, BUTTON_MODE_TOGGLE);
  406. setSetting("btnClick", 1, BUTTON_MODE_NONE);
  407. setSetting("btnPress", 2, BUTTON_MODE_TOGGLE);
  408. setSetting("btnClick", 2, BUTTON_MODE_NONE);
  409. setSetting("btnPress", 3, BUTTON_MODE_TOGGLE);
  410. setSetting("btnClick", 3, BUTTON_MODE_NONE);
  411. #elif defined(ITEAD_SONOFF_B1)
  412. setSetting("board", 28);
  413. setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
  414. setSetting("litProvider", LIGHT_PROVIDER_MY92XX);
  415. setSetting("myModel", MY92XX_MODEL_MY9231); // 3 channels per chip
  416. setSetting("myChips", 2);
  417. setSetting("myDIGPIO", 12);
  418. setSetting("myDCKIGPIO", 14);
  419. setSetting("myMapping", "43501"); // TODO
  420. setSetting("litChFactor", 4, 0.1); // White LEDs are way more bright in the B1
  421. setSetting("litChFactor", 5, 0.1); // White LEDs are way more bright in the B1
  422. setSetting("rlyCount", 1);
  423. #elif defined(ITEAD_SONOFF_LED)
  424. setSetting("board", 29);
  425. setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
  426. setSetting("litProvider", LIGHT_PROVIDER_DIMMER);
  427. setSetting("ledGPIO", 0, 13);
  428. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  429. setSetting("litChGPIO", 0, 12); // Cold white
  430. setSetting("litChGPIO", 1, 14); // Warm white
  431. setSetting("litChLogic", 0, GPIO_LOGIC_DIRECT);
  432. setSetting("litChLogic", 1, GPIO_LOGIC_DIRECT);
  433. setSetting("rlyCount", 1);
  434. #elif defined(ITEAD_SONOFF_T1_1CH)
  435. setSetting("board", 30);
  436. setSetting("ledGPIO", 0, 13);
  437. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  438. setSetting("btnGPIO", 0, 0);
  439. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  440. setSetting("btnRelay", 0, 0);
  441. setSetting("rlyGPIO", 0, 12);
  442. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  443. setSetting("btnPress", 0, BUTTON_MODE_TOGGLE);
  444. setSetting("btnClick", 0, BUTTON_MODE_NONE);
  445. setSetting("btnDblClick", 0, BUTTON_MODE_NONE);
  446. setSetting("btnLngClick", 0, BUTTON_MODE_NONE);
  447. setSetting("btnLngLngClick", 0, BUTTON_MODE_RESET);
  448. #elif defined(ITEAD_SONOFF_T1_2CH)
  449. setSetting("board", 31);
  450. setSetting("ledGPIO", 0, 13);
  451. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  452. setSetting("btnGPIO", 0, 0);
  453. setSetting("btnGPIO", 1, 9);
  454. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  455. setSetting("btnMode", 1, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  456. setSetting("btnRelay", 0, 0);
  457. setSetting("btnRelay", 1, 1);
  458. setSetting("rlyGPIO", 0, 12);
  459. setSetting("rlyGPIO", 1, 5);
  460. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  461. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  462. setSetting("btnPress", 0, BUTTON_MODE_TOGGLE);
  463. setSetting("btnClick", 0, BUTTON_MODE_NONE);
  464. setSetting("btnDblClick", 0, BUTTON_MODE_NONE);
  465. setSetting("btnLngClick", 0, BUTTON_MODE_NONE);
  466. setSetting("btnLngLngClick", 0, BUTTON_MODE_RESET);
  467. setSetting("btnPress", 1, BUTTON_MODE_TOGGLE);
  468. setSetting("btnClick", 1, BUTTON_MODE_NONE);
  469. setSetting("btnDblClick", 1, BUTTON_MODE_NONE);
  470. setSetting("btnLngClick", 1, BUTTON_MODE_NONE);
  471. setSetting("btnLngLngClick", 1, BUTTON_MODE_RESET);
  472. #elif defined(ITEAD_SONOFF_T1_3CH)
  473. setSetting("board", 32);
  474. setSetting("ledGPIO", 0, 13);
  475. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  476. setSetting("btnGPIO", 0, 0);
  477. setSetting("btnGPIO", 1, 9);
  478. setSetting("btnGPIO", 2, 10);
  479. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  480. setSetting("btnMode", 1, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  481. setSetting("btnMode", 2, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  482. setSetting("btnRelay", 0, 0);
  483. setSetting("btnRelay", 1, 1);
  484. setSetting("btnRelay", 2, 2);
  485. setSetting("rlyGPIO", 0, 12);
  486. setSetting("rlyGPIO", 1, 5);
  487. setSetting("rlyGPIO", 2, 4);
  488. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  489. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  490. setSetting("rlyType", 2, RELAY_TYPE_NORMAL);
  491. setSetting("btnPress", 0, BUTTON_MODE_TOGGLE);
  492. setSetting("btnClick", 0, BUTTON_MODE_NONE);
  493. setSetting("btnDblClick", 0, BUTTON_MODE_NONE);
  494. setSetting("btnLngClick", 0, BUTTON_MODE_NONE);
  495. setSetting("btnLngLngClick", 0, BUTTON_MODE_RESET);
  496. setSetting("btnPress", 1, BUTTON_MODE_TOGGLE);
  497. setSetting("btnClick", 1, BUTTON_MODE_NONE);
  498. setSetting("btnDblClick", 1, BUTTON_MODE_NONE);
  499. setSetting("btnLngClick", 1, BUTTON_MODE_NONE);
  500. setSetting("btnLngLngClick", 1, BUTTON_MODE_RESET);
  501. setSetting("btnPress", 2, BUTTON_MODE_TOGGLE);
  502. setSetting("btnClick", 2, BUTTON_MODE_NONE);
  503. setSetting("btnDblClick", 2, BUTTON_MODE_NONE);
  504. setSetting("btnLngClick", 2, BUTTON_MODE_NONE);
  505. setSetting("btnLngLngClick", 2, BUTTON_MODE_RESET);
  506. #elif defined(ITEAD_SONOFF_RF)
  507. setSetting("board", 33);
  508. setSetting("ledGPIO", 0, 13);
  509. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  510. setSetting("btnGPIO", 0, 0);
  511. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  512. setSetting("btnRelay", 0, 0);
  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("ledGPIO", 0, 2);
  522. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  523. setSetting("btnGPIO", 0, 13);
  524. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  525. setSetting("btnRelay", 0, 0);
  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("litProvider", LIGHT_PROVIDER_DIMMER);
  542. setSetting("litChGPIO", 0, 12);
  543. setSetting("litChGPIO", 1, 14);
  544. setSetting("litChGPIO", 2, 13);
  545. setSetting("litChGPIO", 3, 15);
  546. setSetting("litChLogic", 0, GPIO_LOGIC_DIRECT);
  547. setSetting("litChLogic", 1, GPIO_LOGIC_DIRECT);
  548. setSetting("litChLogic", 2, GPIO_LOGIC_DIRECT);
  549. setSetting("litChLogic", 3, GPIO_LOGIC_DIRECT);
  550. setSetting("rlyCount", 1);
  551. setSetting("dbgPort", 1);
  552. setSetting("dbgRXEnabled", 1);
  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("ledGPIO", 0, 2);
  567. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  568. setSetting("btnGPIO", 0, 4);
  569. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  570. setSetting("btnRelay", 0, 0);
  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("rlyProvider", RELAY_PROVIDER_LIGHT);
  598. setSetting("litProvider", LIGHT_PROVIDER_DIMMER);
  599. setSetting("ledGPIO", 0, 5);
  600. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  601. setSetting("litChGPIO", 0, 0);
  602. setSetting("litChGPIO", 1, 2);
  603. setSetting("litChLogic", 0, GPIO_LOGIC_DIRECT);
  604. setSetting("litChLogic", 1, GPIO_LOGIC_DIRECT);
  605. setSetting("rlyCount", 1);
  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("litProvider", LIGHT_PROVIDER_DIMMER);
  612. setSetting("litChGPIO", 0, 5);
  613. setSetting("litChGPIO", 1, 12);
  614. setSetting("litChGPIO", 2, 13);
  615. setSetting("litChGPIO", 3, 15);
  616. setSetting("litChLogic", 0, GPIO_LOGIC_DIRECT);
  617. setSetting("litChLogic", 1, GPIO_LOGIC_DIRECT);
  618. setSetting("litChLogic", 2, GPIO_LOGIC_DIRECT);
  619. setSetting("litChLogic", 3, GPIO_LOGIC_DIRECT);
  620. setSetting("rlyCount", 1);
  621. setSetting("irEnabled", 1);
  622. setSetting("irGPIO", 4);
  623. setSetting("irSet", 1);
  624. #elif defined(ARILUX_AL_LC06)
  625. setSetting("board", 43);
  626. setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
  627. setSetting("litProvider", LIGHT_PROVIDER_DIMMER);
  628. setSetting("litChGPIO", 0, 14);
  629. setSetting("litChGPIO", 1, 12);
  630. setSetting("litChGPIO", 2, 13);
  631. setSetting("litChGPIO", 3, 15);
  632. setSetting("litChGPIO", 4, 5);
  633. setSetting("litChLogic", 0, GPIO_LOGIC_DIRECT);
  634. setSetting("litChLogic", 1, GPIO_LOGIC_DIRECT);
  635. setSetting("litChLogic", 2, GPIO_LOGIC_DIRECT);
  636. setSetting("litChLogic", 3, GPIO_LOGIC_DIRECT);
  637. setSetting("litChLogic", 4, GPIO_LOGIC_DIRECT);
  638. setSetting("rlyCount", 1);
  639. #elif defined(XENON_SM_PW702U)
  640. setSetting("board", 44);
  641. setSetting("ledGPIO", 0, 4);
  642. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  643. setSetting("btnGPIO", 0, 13);
  644. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  645. setSetting("btnRelay", 0, 0);
  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("litProvider", LIGHT_PROVIDER_DIMMER);
  654. setSetting("litChGPIO", 0, 13);
  655. setSetting("litChGPIO", 1, 12);
  656. setSetting("litChGPIO", 2, 14);
  657. setSetting("litChGPIO", 3, 2);
  658. setSetting("litChLogic", 0, GPIO_LOGIC_DIRECT);
  659. setSetting("litChLogic", 1, GPIO_LOGIC_DIRECT);
  660. setSetting("litChLogic", 2, GPIO_LOGIC_DIRECT);
  661. setSetting("litChLogic", 3, GPIO_LOGIC_DIRECT);
  662. setSetting("rlyCount", 1);
  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("litProvider", LIGHT_PROVIDER_MY92XX);
  669. setSetting("myModel", MY92XX_MODEL_MY9291); // 4 channels per chip
  670. setSetting("myChips", 1);
  671. setSetting("myDIGPIO", 13);
  672. setSetting("myDCKIGPIO", 15);
  673. setSetting("myMapping", "0123");
  674. setSetting("rlyCount", 1);
  675. #elif defined(YJZK_SWITCH_2CH)
  676. setSetting("board", 47);
  677. setSetting("ledGPIO", 0, 13);
  678. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  679. setSetting("btnGPIO", 0, 0);
  680. setSetting("btnGPIO", 1, 9);
  681. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  682. setSetting("btnMode", 1, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  683. setSetting("btnRelay", 0, 0);
  684. setSetting("btnRelay", 1, 1);
  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("ledGPIO", 0, 13);
  692. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  693. setSetting("btnGPIO", 0, 0);
  694. setSetting("btnGPIO", 1, 9);
  695. setSetting("btnGPIO", 2, 10);
  696. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH | BUTTON_SET_PULLUP);
  697. setSetting("btnMode", 1, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH | BUTTON_SET_PULLUP);
  698. setSetting("btnMode", 2, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  699. setSetting("btnRelay", 0, 0);
  700. setSetting("btnRelay", 1, 1);
  701. setSetting("btnRelay", 2, 0);
  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("litProvider", LIGHT_PROVIDER_DIMMER);
  728. setSetting("litChGPIO", 0, 5);
  729. setSetting("litChGPIO", 1, 12);
  730. setSetting("litChGPIO", 2, 13);
  731. setSetting("litChLogic", 0, GPIO_LOGIC_DIRECT);
  732. setSetting("litChLogic", 1, GPIO_LOGIC_DIRECT);
  733. setSetting("litChLogic", 2, GPIO_LOGIC_DIRECT);
  734. setSetting("rlyCount", 1);
  735. #elif defined(ARILUX_AL_LC11)
  736. setSetting("board", 51);
  737. setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
  738. setSetting("litProvider", LIGHT_PROVIDER_DIMMER);
  739. setSetting("litChGPIO", 0, 5);
  740. setSetting("litChGPIO", 1, 4);
  741. setSetting("litChGPIO", 2, 14);
  742. setSetting("litChGPIO", 3, 13);
  743. setSetting("litChGPIO", 4, 12);
  744. setSetting("litChLogic", 0, GPIO_LOGIC_DIRECT);
  745. setSetting("litChLogic", 1, GPIO_LOGIC_DIRECT);
  746. setSetting("litChLogic", 2, GPIO_LOGIC_DIRECT);
  747. setSetting("litChLogic", 3, GPIO_LOGIC_DIRECT);
  748. setSetting("litChLogic", 4, GPIO_LOGIC_DIRECT);
  749. setSetting("rlyCount", 1);
  750. #elif defined(ARILUX_AL_LC02)
  751. setSetting("board", 52);
  752. setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
  753. setSetting("litProvider", LIGHT_PROVIDER_DIMMER);
  754. setSetting("litChGPIO", 0, 12);
  755. setSetting("litChGPIO", 1, 5);
  756. setSetting("litChGPIO", 2, 13);
  757. setSetting("litChGPIO", 3, 15);
  758. setSetting("litChLogic", 0, GPIO_LOGIC_DIRECT);
  759. setSetting("litChLogic", 1, GPIO_LOGIC_DIRECT);
  760. setSetting("litChLogic", 2, GPIO_LOGIC_DIRECT);
  761. setSetting("litChLogic", 3, GPIO_LOGIC_DIRECT);
  762. setSetting("rlyCount", 1);
  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("ledGPIO", 0, 13);
  768. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  769. setSetting("btnGPIO", 0, 0);
  770. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  771. setSetting("btnRelay", 0, 0);
  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("ledGPIO", 0, 2);
  782. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  783. setSetting("btnGPIO", 0, 4);
  784. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  785. setSetting("btnPress", 0, BUTTON_MODE_TOGGLE);
  786. setSetting("btnClick", 0, BUTTON_MODE_NONE);
  787. setSetting("btnDblClick", 0, BUTTON_MODE_NONE);
  788. setSetting("btnLngClick", 0, BUTTON_MODE_NONE);
  789. setSetting("btnLngLngClick", 0, BUTTON_MODE_RESET);
  790. setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
  791. setSetting("litProvider", LIGHT_PROVIDER_DIMMER);
  792. setSetting("litChGPIO", 0, 15);
  793. setSetting("litChGPIO", 1, 12);
  794. setSetting("litChGPIO", 2, 13);
  795. setSetting("litChLogic", 0, GPIO_LOGIC_DIRECT);
  796. setSetting("litChLogic", 1, GPIO_LOGIC_DIRECT);
  797. setSetting("litChLogic", 2, GPIO_LOGIC_DIRECT);
  798. setSetting("rlyCount", 1);
  799. #elif defined(EUROMATE_WIFI_STECKER_SCHUKO)
  800. // Euromate (?) Wifi Stecker Shuko
  801. // https://www.obi.de/hausfunksteuerung/wifi-stecker-schuko/p/2291706
  802. // Thanks to @Geitde
  803. setSetting("board", 55);
  804. setSetting("ledGPIO", 0, 4);
  805. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  806. setSetting("btnGPIO", 0, 14);
  807. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH | BUTTON_SET_PULLUP);
  808. setSetting("btnRelay", 0, 0);
  809. // The relay in the device is not a bistable (latched) relay.
  810. // The device is reported to have a flip-flop circuit to drive the relay
  811. // So @Geitde hack is still the only possible
  812. // Hack: drive GPIO12 low and use GPIO5 as normal relay pin:
  813. setSetting("rlyGPIO", 0, 5);
  814. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  815. setSetting("ledGPIO", 1, 12);
  816. setSetting("ledLogic", 1, GPIO_LOGIC_DIRECT);
  817. #elif defined(TONBUX_POWERSTRIP02)
  818. setSetting("board", 56);
  819. setSetting("rlyGPIO", 0, 4);
  820. setSetting("rlyGPIO", 1, 13);
  821. setSetting("rlyGPIO", 2, 12);
  822. setSetting("rlyGPIO", 3, 14);
  823. setSetting("rlyGPIO", 4, 16); // Not a relay. USB ports on/off
  824. setSetting("rlyType", 0, RELAY_TYPE_INVERSE);
  825. setSetting("rlyType", 1, RELAY_TYPE_INVERSE);
  826. setSetting("rlyType", 2, RELAY_TYPE_INVERSE);
  827. setSetting("rlyType", 3, RELAY_TYPE_INVERSE);
  828. setSetting("rlyType", 4, RELAY_TYPE_NORMAL); // Not a relay. USB ports on/off
  829. setSetting("ledGPIO", 0, 0); // 1 blue led
  830. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  831. setSetting("ledGPIO", 1, 3); // 3 red leds
  832. setSetting("ledLogic", 1, GPIO_LOGIC_INVERSE);
  833. setSetting("btnGPIO", 0, 5);
  834. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  835. setSetting("btnRelay", 0, 1);
  836. #elif defined(LINGAN_SWA1)
  837. setSetting("board", 57);
  838. setSetting("ledGPIO", 0, 4);
  839. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  840. setSetting("btnGPIO", 0, 13);
  841. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH | BUTTON_SET_PULLUP);
  842. setSetting("btnRelay", 0, 0);
  843. setSetting("rlyGPIO", 0, 5);
  844. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  845. #elif defined(HEYGO_HY02)
  846. setSetting("board", 58);
  847. setSetting("ledGPIO", 0, 4);
  848. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  849. setSetting("btnGPIO", 0, 13);
  850. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  851. setSetting("btnRelay", 0, 0);
  852. setSetting("rlyGPIO", 0, 12);
  853. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  854. #elif defined(MAXCIO_WUS002S)
  855. setSetting("board", 59);
  856. setSetting("ledGPIO", 0, 3);
  857. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  858. setSetting("btnGPIO", 0, 2);
  859. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  860. setSetting("btnRelay", 0, 0);
  861. setSetting("rlyGPIO", 0, 13);
  862. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  863. setSetting("hlwEnabled", 1);
  864. setSetting("hlwSELGPIO", 12);
  865. setSetting("hlwCF1GPIO", 5);
  866. setSetting("hlwCFGPIO", 4);
  867. setSetting("hlwCurRes", 0.002);
  868. setSetting("hlwVolResUp", 2000000);
  869. #elif defined(YIDIAN_XSSSA05)
  870. setSetting("board", 60);
  871. setSetting("ledGPIO", 0, 4);
  872. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  873. setSetting("ledGPIO", 2, 2);
  874. setSetting("ledLogic", 2, 0);
  875. setSetting("btnGPIO", 0, 13);
  876. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  877. setSetting("btnRelay", 0, 0);
  878. setSetting("rlyGPIO", 0, 12);
  879. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  880. setSetting("hlwEnabled", 1);
  881. setSetting("hlwSELGPIO", 3);
  882. setSetting("hlwCF1GPIO", 14);
  883. setSetting("hlwCFGPIO", 5);
  884. setSetting("hlwVolResUp", 2400000);
  885. #elif defined(TONBUX_XSSSA06)
  886. setSetting("board", 61);
  887. setSetting("ledGPIO", 0, 0); // Red
  888. setSetting("ledGPIO", 0, 5); // Green
  889. setSetting("ledGPIO", 0, 2); // Blue
  890. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  891. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  892. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  893. setSetting("btnGPIO", 0, 13);
  894. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  895. setSetting("btnRelay", 0, 0);
  896. setSetting("rlyGPIO", 0, 15);
  897. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  898. #elif defined(GREEN_ESP8266RELAY)
  899. // GREEN ESP8266 RELAY MODULE
  900. // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180323113846&SearchText=Green+ESP8266
  901. setSetting("board", 62);
  902. setSetting("ledGPIO", 0, 2);
  903. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  904. setSetting("btnGPIO", 0, 5);
  905. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  906. setSetting("btnRelay", 0, 0);
  907. setSetting("rlyGPIO", 0, 4);
  908. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  909. #elif defined(IKE_ESPIKE)
  910. // Henrique Gravina ESPIKE
  911. // https://github.com/Henriquegravina/Espike
  912. setSetting("board", 63);
  913. setSetting("ledGPIO", 0, 2);
  914. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  915. setSetting("btnGPIO", 0, 13);
  916. setSetting("btnGPIO", 1, 12);
  917. setSetting("btnGPIO", 2, 14);
  918. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  919. setSetting("btnMode", 1, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  920. setSetting("btnMode", 2, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  921. setSetting("btnRelay", 0, 0);
  922. setSetting("btnRelay", 1, 1);
  923. setSetting("btnRelay", 2, 2);
  924. setSetting("btnDblClick", 0, BUTTON_MODE_NONE);
  925. setSetting("btnLngClick", 0, BUTTON_MODE_NONE);
  926. setSetting("btnLngLngClick", 0, BUTTON_MODE_NONE);
  927. setSetting("rlyGPIO", 0, 4);
  928. setSetting("rlyGPIO", 1, 5);
  929. setSetting("rlyGPIO", 2, 16);
  930. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  931. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  932. setSetting("rlyType", 2, RELAY_TYPE_NORMAL);
  933. #elif defined(ARNIEX_SWIFITCH)
  934. // SWIFITCH
  935. // https://github.com/ArnieX/swifitch
  936. setSetting("board", 64);
  937. setSetting("ledGPIO", 0, 12);
  938. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  939. setSetting("btnGPIO", 0, 4);
  940. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH | BUTTON_SET_PULLUP);
  941. setSetting("btnRelay", 0, 1);
  942. setSetting("btnPress", 0, BUTTON_MODE_NONE);
  943. setSetting("btnClick", 0, BUTTON_MODE_TOGGLE);
  944. setSetting("btnDblClick", 0, BUTTON_MODE_NONE);
  945. setSetting("btnLngClick", 0, BUTTON_MODE_NONE);
  946. setSetting("btnLngLngClick", 0, BUTTON_MODE_NONE);
  947. setSetting("rlyGPIO", 0, 5);
  948. setSetting("rlyType", 0, RELAY_TYPE_INVERSE);
  949. #elif defined(GENERIC_ESP01S_RELAY_V40)
  950. // ESP-01S RELAY v4.0
  951. // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180404024035&SearchText=esp-01s+relay
  952. setSetting("board", 65);
  953. setSetting("ledGPIO", 0, 2);
  954. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  955. setSetting("rlyGPIO", 0, 0);
  956. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  957. #elif defined(GENERIC_ESP01S_RGBLED_V10)
  958. // ESP-01S RGB LED v1.0 (some sold with ws2818)
  959. // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180404023816&SearchText=esp-01s+led+controller
  960. setSetting("board", 66);
  961. setSetting("ledGPIO", 0, 2);
  962. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  963. #elif defined(HELTEC_TOUCHRELAY)
  964. // Heltec Touch Relay
  965. // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180408043114&SearchText=esp8266+touch+relay
  966. setSetting("board", 67);
  967. setSetting("btnGPIO", 0, 14);
  968. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  969. setSetting("btnRelay", 0, 1);
  970. setSetting("rlyGPIO", 0, 12);
  971. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  972. #elif defined(GENERIC_ESP01S_DHT11_V10)
  973. // ESP-01S DHT11 v1.0
  974. // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180410105907&SearchText=esp-01s+dht11
  975. setSetting("board", 68);
  976. setSetting("dhtEnabled", 1);
  977. setSetting("dhtGPIO", 0, 2);
  978. setSetting("dhtType", 0, DHT_CHIP_DHT11);
  979. #elif defined(GENERIC_ESP01S_DS18B20_V10)
  980. // ESP-01S DS18B20 v1.0
  981. // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180410105933&SearchText=esp-01s+ds18b20
  982. setSetting("board", 69);
  983. setSetting("dsEnabled", 1);
  984. setSetting("dsGPIO", 0, 2);
  985. #elif defined(ZHILDE_EU44_W)
  986. // Zhilde ZLD-EU44-W
  987. // http://www.zhilde.com/product/60705150109-805652505/EU_WiFi_Surge_Protector_Extension_Socket_4_Outlets_works_with_Amazon_Echo_Smart_Power_Strip.html
  988. setSetting("board", 70);
  989. setSetting("btnGPIO", 0, 3);
  990. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  991. setSetting("btnRelay", 0, 0);
  992. setSetting("ledGPIO", 0, 1);
  993. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  994. setSetting("rlyGPIO", 0, 5);
  995. setSetting("rlyGPIO", 1, 4);
  996. setSetting("rlyGPIO", 2, 12);
  997. setSetting("rlyGPIO", 3, 13);
  998. setSetting("rlyGPIO", 4, 14);
  999. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1000. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  1001. setSetting("rlyType", 2, RELAY_TYPE_NORMAL);
  1002. setSetting("rlyType", 3, RELAY_TYPE_NORMAL);
  1003. setSetting("rlyType", 4, RELAY_TYPE_NORMAL);
  1004. // Based on the reporter, this product uses GPIO1 and 3 for the button
  1005. // and onboard LED, so hardware serial should be disabled...
  1006. setSetting("dbgSerial", 0);
  1007. #elif defined(ITEAD_SONOFF_POW_R2)
  1008. setSetting("board", 71);
  1009. setSetting("ledGPIO", 0, 13);
  1010. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  1011. setSetting("btnGPIO", 0, 0);
  1012. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1013. setSetting("btnRelay", 0, 0);
  1014. setSetting("rlyGPIO", 0, 12);
  1015. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1016. setSetting("dbgSerial", 0);
  1017. setSetting("cseEnabled", 1);
  1018. setSetting("cseGPIO", 1);
  1019. #elif defined(LUANI_HVIO)
  1020. // Luani HVIO
  1021. // https://luani.de/projekte/esp8266-hvio/
  1022. // https://luani.de/blog/esp8266-230v-io-modul/
  1023. setSetting("board", 72);
  1024. setSetting("ledGPIO", 0, 15);
  1025. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  1026. setSetting("btnGPIO", 0, 12);
  1027. setSetting("btnGPIO", 1, 13);
  1028. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1029. setSetting("btnMode", 1, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1030. setSetting("btnRelay", 0, 0);
  1031. setSetting("btnRelay", 1, 1);
  1032. setSetting("btnDblClick", 0, BUTTON_MODE_NONE);
  1033. setSetting("rlyGPIO", 0, 4);
  1034. setSetting("rlyGPIO", 1, 5);
  1035. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1036. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  1037. #elif defined(ALLNET_4DUINO_IOT_WLAN_RELAIS)
  1038. // Allnet 4duino ESP8266-UP-Relais
  1039. // http://www.allnet.de/de/allnet-brand/produkte/neuheiten/p/allnet-4duino-iot-wlan-relais-unterputz-esp8266-up-relais/
  1040. // https://shop.allnet.de/fileadmin/transfer/products/148814.pdf
  1041. setSetting("board", 73);
  1042. setSetting("ledGPIO", 0, 0);
  1043. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  1044. setSetting("rlyGPIO", 0, 14);
  1045. setSetting("rlyResetGPIO", 0, 12);
  1046. setSetting("rlyType", 0, RELAY_TYPE_LATCHED);
  1047. #elif defined(TONBUX_MOSQUITO_KILLER)
  1048. // Tonbux 50-100M Smart Mosquito Killer USB
  1049. // https://www.aliexpress.com/item/Original-Tonbux-50-100M-Smart-Mosquito-Killer-USB-Plug-No-Noise-Repellent-App-Smart-Module/32859330820.html
  1050. setSetting("board", 74);
  1051. setSetting("ledGPIO", 0, 15);
  1052. setSetting("ledGPIO", 1, 14);
  1053. setSetting("ledGPIO", 2, 12);
  1054. setSetting("ledGPIO", 3, 16);
  1055. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  1056. setSetting("ledLogic", 1, GPIO_LOGIC_INVERSE);
  1057. setSetting("ledLogic", 2, GPIO_LOGIC_DIRECT);
  1058. setSetting("ledLogic", 3, GPIO_LOGIC_DIRECT);
  1059. setSetting("ledMode", 0, LED_MODE_WIFI);
  1060. setSetting("ledMode", 1, LED_MODE_RELAY);
  1061. setSetting("ledRelay", 1, 0);
  1062. setSetting("btnGPIO", 0, 2);
  1063. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1064. setSetting("btnRelay", 0, 0);
  1065. setSetting("rlyGPIO", 0, 5); // Fan
  1066. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1067. #elif defined(NEO_COOLCAM_NAS_WR01W)
  1068. // NEO Coolcam NAS-WR01W Wifi Smart Power Plug
  1069. // https://es.aliexpress.com/item/-/32854589733.html?spm=a219c.12010608.0.0.6d084e68xX0y5N
  1070. // https://www.fasttech.com/product/9649426-neo-coolcam-nas-wr01w-wifi-smart-power-plug-eu
  1071. setSetting("board", 75);
  1072. setSetting("ledGPIO", 0, 4);
  1073. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  1074. setSetting("btnGPIO", 0, 13);
  1075. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1076. setSetting("btnRelay", 0, 0);
  1077. setSetting("rlyGPIO", 0, 12);
  1078. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1079. #elif defined(PILOTAK_ESP_DIN_V1)
  1080. // ESP-DIN relay board V1
  1081. // https://github.com/pilotak/esp_din
  1082. setSetting("board", 76);
  1083. setSetting("ledGPIO", 0, 15);
  1084. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  1085. setSetting("btnGPIO", 0, 0);
  1086. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1087. setSetting("btnRelay", 0, 0);
  1088. setSetting("rlyGPIO", 0, 4);
  1089. setSetting("rlyGPIO", 1, 5);
  1090. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1091. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  1092. setSetting("i2cEnable", 1);
  1093. setSetting("i2cSDAGPIO", 12);
  1094. setSetting("i2cSCLGPIO", 13);
  1095. setSetting("dsEnabled", 1);
  1096. setSetting("dsGPIO", 0, 2);
  1097. setSetting("rfEnabled", 1);
  1098. setSetting("rfGPIO", 14);
  1099. setSetting("digEnabled", 1);
  1100. setSetting("digGPIO", 0, 16);
  1101. setSetting("digMode", 0, INPUT);
  1102. #elif defined(ESTINK_WIFI_POWER_STRIP)
  1103. // Estink Wifi Power Strip
  1104. // https://www.amazon.de/Steckdosenleiste-Ladeger%C3%A4t-Sprachsteuerung-SmartphonesTablets-Android/dp/B0796W5FZY
  1105. // Fornorm Wi-Fi USB Extension Socket (ZLD-34EU)
  1106. // https://www.aliexpress.com/item/Fornorm-WiFi-Extension-Socket-with-Surge-Protector-Smart-Power-Strip-3-Outlets-and-4-USB-Charging/32849743948.html
  1107. setSetting("board", 77);
  1108. setSetting("btnGPIO", 0, 16);
  1109. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1110. setSetting("btnRelay", 0, 3);
  1111. setSetting("ledGPIO", 0, 0);
  1112. setSetting("ledGPIO", 1, 12);
  1113. setSetting("ledGPIO", 2, 3);
  1114. setSetting("ledGPIO", 3, 5);
  1115. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  1116. setSetting("ledLogic", 1, GPIO_LOGIC_INVERSE);
  1117. setSetting("ledLogic", 2, GPIO_LOGIC_INVERSE);
  1118. setSetting("ledLogic", 3, GPIO_LOGIC_INVERSE);
  1119. setSetting("ledMode", 0, LED_MODE_FINDME);
  1120. setSetting("ledMode", 1, LED_MODE_FOLLOW);
  1121. setSetting("ledMode", 2, LED_MODE_FOLLOW);
  1122. setSetting("ledMode", 3, LED_MODE_FOLLOW);
  1123. setSetting("ledRelay", 1, 1);
  1124. setSetting("ledRelay", 2, 2);
  1125. setSetting("ledRelay", 3, 3);
  1126. setSetting("rlyGPIO", 0, 14); // USB power
  1127. setSetting("rlyGPIO", 1, 13); // power plug 1
  1128. setSetting("rlyGPIO", 2, 4); // power plug 2
  1129. setSetting("rlyGPIO", 3, 15); // power plug 3
  1130. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1131. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  1132. setSetting("rlyType", 2, RELAY_TYPE_NORMAL);
  1133. setSetting("rlyType", 3, RELAY_TYPE_NORMAL);
  1134. setSetting("dbgSerial", 0);
  1135. #elif defined(BH_ONOFRE)
  1136. // Bruno Horta's OnOfre
  1137. // https://www.bhonofre.pt/
  1138. // https://github.com/brunohorta82/BH_OnOfre/
  1139. setSetting("board", 78);
  1140. setSetting("btnGPIO", 0, 12);
  1141. setSetting("btnGPIO", 1, 13);
  1142. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH | BUTTON_SET_PULLUP);
  1143. setSetting("btnMode", 1, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH | BUTTON_SET_PULLUP);
  1144. setSetting("btnRelay", 0, 0);
  1145. setSetting("btnRelay", 1, 1);
  1146. setSetting("rlyGPIO", 0, 4);
  1147. setSetting("rlyGPIO", 1, 5);
  1148. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1149. setSetting("rlyType", 1, RELAY_TYPE_NORMAL);
  1150. #elif defined(BLITZWOLF_BWSHP2)
  1151. // Several boards under different names uing a power chip labelled BL0937 or HJL-01
  1152. // * Blitzwolf (https://www.amazon.es/Inteligente-Temporización-Dispositivos-Cualquier-BlitzWolf/dp/B07BMQP142)
  1153. // * HomeCube (https://www.amazon.de/Steckdose-Homecube-intelligente-Verbrauchsanzeige-funktioniert/dp/B076Q2LKHG)
  1154. // * Coosa (https://www.amazon.com/COOSA-Monitoring-Function-Campatible-Assiatant/dp/B0788W9TDR)
  1155. // * Goosund (http://www.gosund.com/?m=content&c=index&a=show&catid=6&id=5)
  1156. // * Ablue (https://www.amazon.de/Intelligente-Steckdose-Ablue-Funktioniert-Assistant/dp/B076DRFRZC)
  1157. setSetting("board", 79);
  1158. setSetting("btnGPIO", 0, 13);
  1159. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1160. setSetting("btnRelay", 0, 0);
  1161. setSetting("ledGPIO", 0, 2);
  1162. setSetting("ledGPIO", 1, 0);
  1163. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  1164. setSetting("ledLogic", 1, GPIO_LOGIC_INVERSE);
  1165. setSetting("ledMode", 0, LED_MODE_WIFI);
  1166. setSetting("ledMode", 1, LED_MODE_FINDME);
  1167. setSetting("ledRelay", 1, 0);
  1168. setSetting("rlyGPIO", 0, 15);
  1169. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1170. setSetting("hlwSELGPIO", 12);
  1171. setSetting("hlwCF1GPIO", 14);
  1172. setSetting("hlwCFGPIO", 5);
  1173. setSetting("hlwCurLevel", LOW);
  1174. setSetting("hlwInt", FALLING);
  1175. setSetting("curRatio", 25740);
  1176. setSetting("volRatio", 313400);
  1177. setSetting("pwrRatio", 3414290);
  1178. #elif defined(TINKERMAN_ESPURNA_SWITCH)
  1179. setSetting("board", 80);
  1180. setSetting("ledGPIO", 0, 2);
  1181. setSetting("ledLogic", 0, GPIO_LOGIC_DIRECT);
  1182. setSetting("btnGPIO", 0, 4);
  1183. setSetting("btnMode", 0, BUTTON_PUSHBUTTON);
  1184. setSetting("btnPress", 0, BUTTON_MODE_TOGGLE);
  1185. setSetting("btnClick", 0, BUTTON_MODE_NONE);
  1186. setSetting("btnDblClick", 0, BUTTON_MODE_NONE);
  1187. setSetting("btnLngClick", 0, BUTTON_MODE_NONE);
  1188. setSetting("btnLngLngClick", 0, BUTTON_MODE_NONE);
  1189. setSetting("btnRelay", 0, 0);
  1190. setSetting("rlyGPIO", 0, 12);
  1191. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1192. #elif defined(ITEAD_SONOFF_S31)
  1193. setSetting("board", 81);
  1194. setSetting("ledGPIO", 0, 13);
  1195. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  1196. setSetting("btnGPIO", 0, 0);
  1197. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1198. setSetting("btnRelay", 0, 0);
  1199. setSetting("rlyGPIO", 0, 12);
  1200. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1201. setSetting("dbgSerial", 0);
  1202. setSetting("cseEnabled", 1);
  1203. setSetting("cseGPIO", 1);
  1204. #elif defined(STM_RELAY)
  1205. setSetting("board", 82);
  1206. setSetting("rlyCount", 2);
  1207. setSetting("rlyProvider", RELAY_PROVIDER_STM)
  1208. setSetting("dbgSerial", 0);
  1209. #elif defined(VANZAVANZU_SMART_WIFI_PLUG_MINI)
  1210. // VANZAVANZU Smart Outlet Socket (based on BL0937 or HJL-01)
  1211. // https://www.amazon.com/Smart-Plug-Wifi-Mini-VANZAVANZU/dp/B078PHD6S5
  1212. setSetting("board", 83);
  1213. setSetting("btnGPIO", 0, 13);
  1214. setSetting("btnMode", 0, BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH);
  1215. setSetting("btnRelay", 0, 0);
  1216. setSetting("ledGPIO", 0, 2);
  1217. setSetting("ledGPIO", 1, 0);
  1218. setSetting("ledLogic", 0, GPIO_LOGIC_INVERSE);
  1219. setSetting("ledLogic", 1, GPIO_LOGIC_INVERSE);
  1220. setSetting("ledMode", 0, LED_MODE_WIFI);
  1221. setSetting("ledMode", 1, LED_MODE_FINDME);
  1222. setSetting("ledRelay", 1, 0);
  1223. setSetting("rlyGPIO", 0, 15);
  1224. setSetting("rlyType", 0, RELAY_TYPE_NORMAL);
  1225. setSetting("hlwSELGPIO", 3);
  1226. setSetting("hlwCF1GPIO", 14);
  1227. setSetting("hlwCFGPIO", 5);
  1228. setSetting("hlwCurLevel", LOW);
  1229. setSetting("hlwInt", FALLING);
  1230. setSetting("curRatio", 25740);
  1231. setSetting("volRatio", 313400);
  1232. setSetting("pwrRatio", 3414290);
  1233. #elif defined(GENERIC_GEIGER_COUNTER)
  1234. setSetting("board", 83);
  1235. setSetting("geiEnabled", 1);
  1236. #else
  1237. // Allow users to define new settings without migration config
  1238. //#error "UNSUPPORTED HARDWARE!"
  1239. #endif
  1240. saveSettings();
  1241. }