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.

1363 lines
49 KiB

7 years ago
6 years ago
6 years ago
  1. /*
  2. MIGRATE MODULE
  3. Copyright (C) 2016-2019 by Xose Pérez <xose dot perez at gmail dot com>
  4. */
  5. void _cmpMoveIndexDown(const char * key, int offset = 0) {
  6. if (hasSetting(key, 0)) return;
  7. for (unsigned char index = 1; index < SETTINGS_MAX_LIST_COUNT; index++) {
  8. if (hasSetting(key, index)) {
  9. setSetting(key, index - 1, getSetting(key, index).toInt() + offset);
  10. } else {
  11. delSetting(key, index - 1);
  12. }
  13. }
  14. }
  15. // Configuration versions
  16. //
  17. // 1: based on Embedis, no board definitions
  18. // 2: based on Embedis, with board definitions 1-based
  19. // 3: based on Embedis, with board definitions 0-based
  20. void migrate() {
  21. // Get config version
  22. unsigned int board = getSetting("board", 0).toInt();
  23. unsigned int config_version = getSetting("cfg", board > 0 ? 2 : 1).toInt();
  24. // Update if not on latest version
  25. if (config_version == CFG_VERSION) return;
  26. setSetting("cfg", CFG_VERSION);
  27. if (config_version == 2) {
  28. _cmpMoveIndexDown("ledGPIO");
  29. _cmpMoveIndexDown("ledLogic");
  30. _cmpMoveIndexDown("btnGPIO");
  31. _cmpMoveIndexDown("btnRelay", -1);
  32. _cmpMoveIndexDown("relayGPIO");
  33. _cmpMoveIndexDown("relayType");
  34. }
  35. if (config_version == 1) {
  36. #if defined(NODEMCU_LOLIN)
  37. setSetting("board", 2);
  38. setSetting("ledGPIO", 0, 2);
  39. setSetting("ledLogic", 0, 1);
  40. setSetting("btnGPIO", 0, 0);
  41. setSetting("btnRelay", 0, 0);
  42. setSetting("relayGPIO", 0, 12);
  43. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  44. #elif defined(WEMOS_D1_MINI_RELAYSHIELD)
  45. setSetting("board", 3);
  46. setSetting("ledGPIO", 0, 2);
  47. setSetting("ledLogic", 0, 1);
  48. setSetting("btnGPIO", 0, 0);
  49. setSetting("btnRelay", 0, 0);
  50. setSetting("relayGPIO", 0, 5);
  51. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  52. #elif defined(ITEAD_SONOFF_BASIC)
  53. setSetting("board", 4);
  54. setSetting("ledGPIO", 0, 13);
  55. setSetting("ledLogic", 0, 1);
  56. setSetting("btnGPIO", 0, 0);
  57. setSetting("btnRelay", 0, 0);
  58. setSetting("relayGPIO", 0, 12);
  59. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  60. #elif defined(ITEAD_SONOFF_TH)
  61. setSetting("board", 5);
  62. setSetting("ledGPIO", 0, 13);
  63. setSetting("ledLogic", 0, 1);
  64. setSetting("btnGPIO", 0, 0);
  65. setSetting("btnRelay", 0, 0);
  66. setSetting("relayGPIO", 0, 12);
  67. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  68. #elif defined(ITEAD_SONOFF_SV)
  69. setSetting("board", 6);
  70. setSetting("ledGPIO", 0, 13);
  71. setSetting("ledLogic", 0, 1);
  72. setSetting("btnGPIO", 0, 0);
  73. setSetting("btnRelay", 0, 0);
  74. setSetting("relayGPIO", 0, 12);
  75. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  76. #elif defined(ITEAD_SONOFF_TOUCH)
  77. setSetting("board", 7);
  78. setSetting("ledGPIO", 0, 13);
  79. setSetting("ledLogic", 0, 1);
  80. setSetting("btnGPIO", 0, 0);
  81. setSetting("btnRelay", 0, 0);
  82. setSetting("relayGPIO", 0, 12);
  83. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  84. #elif defined(ITEAD_SONOFF_POW)
  85. setSetting("board", 8);
  86. setSetting("ledGPIO", 0, 15);
  87. setSetting("ledLogic", 0, 1);
  88. setSetting("btnGPIO", 0, 0);
  89. setSetting("btnRelay", 0, 0);
  90. setSetting("relayGPIO", 0, 12);
  91. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  92. setSetting("selGPIO", 5);
  93. setSetting("cf1GPIO", 13);
  94. setSetting("cfGPIO", 14);
  95. #elif defined(ITEAD_SONOFF_DUAL)
  96. setSetting("board", 9);
  97. setSetting("ledGPIO", 0, 13);
  98. setSetting("ledLogic", 0, 1);
  99. setSetting("btnRelay", 0, 0xFF);
  100. setSetting("btnRelay", 1, 0xFF);
  101. setSetting("btnRelay", 2, 0);
  102. setSetting("relayProvider", RELAY_PROVIDER_DUAL);
  103. setSetting("relays", 2);
  104. #elif defined(ITEAD_1CH_INCHING)
  105. setSetting("board", 10);
  106. setSetting("ledGPIO", 0, 13);
  107. setSetting("ledLogic", 0, 1);
  108. setSetting("btnGPIO", 0, 0);
  109. setSetting("btnRelay", 0, 0);
  110. setSetting("relayGPIO", 0, 12);
  111. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  112. #elif defined(ITEAD_SONOFF_4CH)
  113. setSetting("board", 11);
  114. setSetting("ledGPIO", 0, 13);
  115. setSetting("ledLogic", 0, 1);
  116. setSetting("btnGPIO", 0, 0);
  117. setSetting("btnGPIO", 1, 9);
  118. setSetting("btnGPIO", 2, 10);
  119. setSetting("btnGPIO", 3, 14);
  120. setSetting("btnRelay", 0, 0);
  121. setSetting("btnRelay", 1, 1);
  122. setSetting("btnRelay", 2, 2);
  123. setSetting("btnRelay", 3, 3);
  124. setSetting("relayGPIO", 0, 12);
  125. setSetting("relayGPIO", 1, 5);
  126. setSetting("relayGPIO", 2, 4);
  127. setSetting("relayGPIO", 3, 15);
  128. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  129. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  130. setSetting("relayType", 2, RELAY_TYPE_NORMAL);
  131. setSetting("relayType", 3, RELAY_TYPE_NORMAL);
  132. #elif defined(ITEAD_SLAMPHER)
  133. setSetting("board", 12);
  134. setSetting("ledGPIO", 0, 13);
  135. setSetting("ledLogic", 0, 1);
  136. setSetting("btnGPIO", 0, 0);
  137. setSetting("btnRelay", 0, 0);
  138. setSetting("relayGPIO", 0, 12);
  139. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  140. #elif defined(ITEAD_S20)
  141. setSetting("board", 13);
  142. setSetting("ledGPIO", 0, 13);
  143. setSetting("ledLogic", 0, 1);
  144. setSetting("btnGPIO", 0, 0);
  145. setSetting("btnRelay", 0, 0);
  146. setSetting("relayGPIO", 0, 12);
  147. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  148. #elif defined(ELECTRODRAGON_WIFI_IOT)
  149. setSetting("board", 14);
  150. setSetting("ledGPIO", 0, 16);
  151. setSetting("ledLogic", 0, 0);
  152. setSetting("btnGPIO", 0, 0);
  153. setSetting("btnGPIO", 1, 2);
  154. setSetting("btnRelay", 0, 0);
  155. setSetting("btnRelay", 1, 1);
  156. setSetting("relayGPIO", 0, 12);
  157. setSetting("relayGPIO", 1, 13);
  158. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  159. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  160. #elif defined(WORKCHOICE_ECOPLUG)
  161. setSetting("board", 15);
  162. setSetting("ledGPIO", 0, 2);
  163. setSetting("ledLogic", 0, 0);
  164. setSetting("btnGPIO", 0, 13);
  165. setSetting("btnRelay", 0, 0);
  166. setSetting("relayGPIO", 0, 15);
  167. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  168. #elif defined(JANGOE_WIFI_RELAY_NC)
  169. setSetting("board", 16);
  170. setSetting("btnGPIO", 0, 12);
  171. setSetting("btnGPIO", 1, 13);
  172. setSetting("btnRelay", 0, 0);
  173. setSetting("btnRelay", 1, 1);
  174. setSetting("relayGPIO", 0, 2);
  175. setSetting("relayGPIO", 1, 14);
  176. setSetting("relayType", 0, RELAY_TYPE_INVERSE);
  177. setSetting("relayType", 1, RELAY_TYPE_INVERSE);
  178. #elif defined(JANGOE_WIFI_RELAY_NO)
  179. setSetting("board", 17);
  180. setSetting("btnGPIO", 0, 12);
  181. setSetting("btnGPIO", 1, 13);
  182. setSetting("btnRelay", 0, 0);
  183. setSetting("btnRelay", 1, 1);
  184. setSetting("relayGPIO", 0, 2);
  185. setSetting("relayGPIO", 1, 14);
  186. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  187. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  188. #elif defined(OPENENERGYMONITOR_MQTT_RELAY)
  189. setSetting("board", 18);
  190. setSetting("ledGPIO", 0, 16);
  191. setSetting("ledLogic", 0, 1);
  192. setSetting("btnGPIO", 0, 0);
  193. setSetting("btnRelay", 0, 0);
  194. setSetting("relayGPIO", 0, 12);
  195. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  196. #elif defined(JORGEGARCIA_WIFI_RELAYS)
  197. setSetting("board", 19);
  198. setSetting("relayGPIO", 0, 0);
  199. setSetting("relayGPIO", 1, 2);
  200. setSetting("relayType", 0, RELAY_TYPE_INVERSE);
  201. setSetting("relayType", 1, RELAY_TYPE_INVERSE);
  202. #elif defined(AITHINKER_AI_LIGHT)
  203. setSetting("board", 20);
  204. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  205. setSetting("lightProvider", LIGHT_PROVIDER_MY92XX);
  206. setSetting("myModel", MY92XX_MODEL_MY9291);
  207. setSetting("myChips", 1);
  208. setSetting("myDIGPIO", 13);
  209. setSetting("myDCKIGPIO", 15);
  210. setSetting("relays", 1);
  211. #elif defined(LYASI_LIGHT)
  212. setSetting("board", 20);
  213. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  214. setSetting("lightProvider", LIGHT_PROVIDER_MY92XX);
  215. setSetting("myModel", MY92XX_MODEL_MY9291);
  216. setSetting("myChips", 1);
  217. setSetting("myDIGPIO", 4);
  218. setSetting("myDCKIGPIO", 5);
  219. setSetting("relays", 1);
  220. #elif defined(MAGICHOME_LED_CONTROLLER)
  221. setSetting("board", 21);
  222. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  223. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  224. setSetting("ledGPIO", 0, 2);
  225. setSetting("ledLogic", 0, 1);
  226. setSetting("chGPIO", 0, 14);
  227. setSetting("chGPIO", 1, 5);
  228. setSetting("chGPIO", 2, 12);
  229. setSetting("chGPIO", 3, 13);
  230. setSetting("chLogic", 0, 0);
  231. setSetting("chLogic", 1, 0);
  232. setSetting("chLogic", 2, 0);
  233. setSetting("chLogic", 3, 0);
  234. setSetting("relays", 1);
  235. #elif defined(MAGICHOME_LED_CONTROLLER_IR)
  236. setSetting("board", 21);
  237. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  238. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  239. setSetting("ledGPIO", 0, 2);
  240. setSetting("ledLogic", 0, 1);
  241. setSetting("chGPIO", 0, 5);
  242. setSetting("chGPIO", 1, 12);
  243. setSetting("chGPIO", 2, 13);
  244. setSetting("chGPIO", 3, 14);
  245. setSetting("chLogic", 0, 0);
  246. setSetting("chLogic", 1, 0);
  247. setSetting("chLogic", 2, 0);
  248. setSetting("chLogic", 3, 0);
  249. setSetting("relays", 1);
  250. #elif defined(ITEAD_MOTOR)
  251. setSetting("board", 22);
  252. setSetting("ledGPIO", 0, 13);
  253. setSetting("ledLogic", 0, 1);
  254. setSetting("btnGPIO", 0, 0);
  255. setSetting("btnRelay", 0, 0);
  256. setSetting("relayGPIO", 0, 12);
  257. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  258. #elif defined(TINKERMAN_ESPURNA_H06)
  259. setSetting("board", 23);
  260. setSetting("ledGPIO", 0, 5);
  261. setSetting("ledLogic", 0, 0);
  262. setSetting("btnGPIO", 0, 4);
  263. setSetting("btnRelay", 0, 0);
  264. setSetting("relayGPIO", 0, 12);
  265. setSetting("relayType", 0, RELAY_TYPE_INVERSE);
  266. setSetting("selGPIO", 2);
  267. setSetting("cf1GPIO", 13);
  268. setSetting("cfGPIO", 14);
  269. #elif defined(HUACANXING_H801)
  270. setSetting("board", 24);
  271. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  272. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  273. setSetting("ledGPIO", 0, 5);
  274. setSetting("ledLogic", 0, 1);
  275. setSetting("chGPIO", 0, 15);
  276. setSetting("chGPIO", 1, 13);
  277. setSetting("chGPIO", 2, 12);
  278. setSetting("chGPIO", 3, 14);
  279. setSetting("chGPIO", 4, 4);
  280. setSetting("chLogic", 0, 0);
  281. setSetting("chLogic", 1, 0);
  282. setSetting("chLogic", 2, 0);
  283. setSetting("chLogic", 3, 0);
  284. setSetting("chLogic", 4, 0);
  285. setSetting("relays", 1);
  286. #elif defined(ITEAD_BNSZ01)
  287. setSetting("board", 25);
  288. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  289. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  290. setSetting("ledGPIO", 0, 13);
  291. setSetting("ledLogic", 0, 1);
  292. setSetting("chGPIO", 0, 12);
  293. setSetting("chLogic", 0, 0);
  294. setSetting("relays", 1);
  295. #elif defined(ITEAD_SONOFF_RFBRIDGE)
  296. setSetting("board", 26);
  297. setSetting("ledGPIO", 0, 13);
  298. setSetting("ledLogic", 0, 1);
  299. setSetting("btnGPIO", 0, 0);
  300. setSetting("relayProvider", RELAY_PROVIDER_RFBRIDGE);
  301. setSetting("relays", 6);
  302. #elif defined(ITEAD_SONOFF_4CH_PRO)
  303. setSetting("board", 27);
  304. setSetting("ledGPIO", 0, 13);
  305. setSetting("ledLogic", 0, 1);
  306. setSetting("btnGPIO", 0, 0);
  307. setSetting("btnGPIO", 1, 9);
  308. setSetting("btnGPIO", 2, 10);
  309. setSetting("btnGPIO", 3, 14);
  310. setSetting("btnRelay", 0, 0);
  311. setSetting("btnRelay", 1, 1);
  312. setSetting("btnRelay", 2, 2);
  313. setSetting("btnRelay", 3, 3);
  314. setSetting("relayGPIO", 0, 12);
  315. setSetting("relayGPIO", 1, 5);
  316. setSetting("relayGPIO", 2, 4);
  317. setSetting("relayGPIO", 3, 15);
  318. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  319. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  320. setSetting("relayType", 2, RELAY_TYPE_NORMAL);
  321. setSetting("relayType", 3, RELAY_TYPE_NORMAL);
  322. #elif defined(ITEAD_SONOFF_B1)
  323. setSetting("board", 28);
  324. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  325. setSetting("lightProvider", LIGHT_PROVIDER_MY92XX);
  326. setSetting("myModel", MY92XX_MODEL_MY9231);
  327. setSetting("myChips", 2);
  328. setSetting("myDIGPIO", 12);
  329. setSetting("myDCKIGPIO", 14);
  330. setSetting("relays", 1);
  331. #elif defined(ITEAD_SONOFF_LED)
  332. setSetting("board", 29);
  333. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  334. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  335. setSetting("ledGPIO", 0, 13);
  336. setSetting("ledLogic", 0, 1);
  337. setSetting("chGPIO", 0, 12);
  338. setSetting("chLogic", 0, 0);
  339. setSetting("chGPIO", 1, 14);
  340. setSetting("chLogic", 1, 0);
  341. setSetting("relays", 1);
  342. #elif defined(ITEAD_SONOFF_T1_1CH)
  343. setSetting("board", 30);
  344. setSetting("ledGPIO", 0, 13);
  345. setSetting("ledLogic", 0, 1);
  346. setSetting("btnGPIO", 0, 9);
  347. setSetting("btnRelay", 0, 0);
  348. setSetting("relayGPIO", 0, 5);
  349. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  350. #elif defined(ITEAD_SONOFF_T1_2CH)
  351. setSetting("board", 31);
  352. setSetting("ledGPIO", 0, 13);
  353. setSetting("ledLogic", 0, 1);
  354. setSetting("btnGPIO", 0, 0);
  355. setSetting("btnGPIO", 1, 10);
  356. setSetting("btnRelay", 0, 0);
  357. setSetting("btnRelay", 1, 1);
  358. setSetting("relayGPIO", 0, 12);
  359. setSetting("relayGPIO", 1, 4);
  360. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  361. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  362. #elif defined(ITEAD_SONOFF_T1_3CH)
  363. setSetting("board", 32);
  364. setSetting("ledGPIO", 0, 13);
  365. setSetting("ledLogic", 0, 1);
  366. setSetting("btnGPIO", 0, 0);
  367. setSetting("btnGPIO", 1, 9);
  368. setSetting("btnGPIO", 2, 10);
  369. setSetting("btnRelay", 0, 0);
  370. setSetting("btnRelay", 1, 1);
  371. setSetting("btnRelay", 2, 2);
  372. setSetting("relayGPIO", 0, 12);
  373. setSetting("relayGPIO", 1, 5);
  374. setSetting("relayGPIO", 2, 4);
  375. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  376. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  377. setSetting("relayType", 2, RELAY_TYPE_NORMAL);
  378. #elif defined(ITEAD_SONOFF_RF)
  379. setSetting("board", 33);
  380. setSetting("ledGPIO", 0, 13);
  381. setSetting("ledLogic", 0, 1);
  382. setSetting("btnGPIO", 0, 0);
  383. setSetting("btnRelay", 0, 0);
  384. setSetting("relayGPIO", 0, 12);
  385. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  386. #elif defined(WION_50055)
  387. setSetting("board", 34);
  388. setSetting("ledGPIO", 0, 2);
  389. setSetting("ledLogic", 0, 0);
  390. setSetting("btnGPIO", 0, 13);
  391. setSetting("btnRelay", 0, 0);
  392. setSetting("relayGPIO", 0, 15);
  393. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  394. #elif defined(EXS_WIFI_RELAY_V31)
  395. setSetting("board", 35);
  396. setSetting("btnGPIO", 0, 0);
  397. setSetting("btnRelay", 0, 0);
  398. setSetting("relayGPIO", 0, 13);
  399. setSetting("relayResetGPIO", 0, 12);
  400. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  401. #elif defined(HUACANXING_H802)
  402. setSetting("board", 36);
  403. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  404. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  405. setSetting("chGPIO", 0, 12);
  406. setSetting("chGPIO", 1, 14);
  407. setSetting("chGPIO", 2, 13);
  408. setSetting("chGPIO", 3, 15);
  409. setSetting("chLogic", 0, 0);
  410. setSetting("chLogic", 1, 0);
  411. setSetting("chLogic", 2, 0);
  412. setSetting("chLogic", 3, 0);
  413. setSetting("relays", 1);
  414. #elif defined(GENERIC_V9261F)
  415. setSetting("board", 37);
  416. #elif defined(GENERIC_ECH1560)
  417. setSetting("board", 38);
  418. #elif defined(TINKERMAN_ESPURNA_H08)
  419. setSetting("board", 39);
  420. setSetting("ledGPIO", 0, 2);
  421. setSetting("ledLogic", 0, 0);
  422. setSetting("btnGPIO", 0, 4);
  423. setSetting("btnRelay", 0, 0);
  424. setSetting("relayGPIO", 0, 12);
  425. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  426. setSetting("selGPIO", 5);
  427. setSetting("cf1GPIO", 13);
  428. setSetting("cfGPIO", 14);
  429. #elif defined(MANCAVEMADE_ESPLIVE)
  430. setSetting("board", 40);
  431. setSetting("btnGPIO", 0, 4);
  432. setSetting("btnGPIO", 1, 5);
  433. setSetting("btnRelay", 0, 0);
  434. setSetting("btnRelay", 1, 1);
  435. setSetting("relayGPIO", 0, 12);
  436. setSetting("relayGPIO", 1, 13);
  437. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  438. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  439. #elif defined(INTERMITTECH_QUINLED)
  440. setSetting("board", 41);
  441. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  442. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  443. setSetting("ledGPIO", 0, 1);
  444. setSetting("ledLogic", 0, 1);
  445. setSetting("chGPIO", 0, 0);
  446. setSetting("chGPIO", 1, 2);
  447. setSetting("chLogic", 0, 0);
  448. setSetting("chLogic", 1, 0);
  449. setSetting("relays", 1);
  450. #elif defined(MAGICHOME_LED_CONTROLLER_20)
  451. setSetting("board", 42);
  452. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  453. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  454. setSetting("chGPIO", 0, 5);
  455. setSetting("chGPIO", 1, 12);
  456. setSetting("chGPIO", 2, 13);
  457. setSetting("chGPIO", 3, 15);
  458. setSetting("chLogic", 0, 0);
  459. setSetting("chLogic", 1, 0);
  460. setSetting("chLogic", 2, 0);
  461. setSetting("chLogic", 3, 0);
  462. setSetting("relays", 1);
  463. #elif defined(ARILUX_AL_LC06)
  464. setSetting("board", 43);
  465. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  466. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  467. setSetting("chGPIO", 0, 12);
  468. setSetting("chGPIO", 1, 14);
  469. setSetting("chGPIO", 2, 13);
  470. setSetting("chGPIO", 3, 15);
  471. setSetting("chGPIO", 4, 5);
  472. setSetting("chLogic", 0, 0);
  473. setSetting("chLogic", 1, 0);
  474. setSetting("chLogic", 2, 0);
  475. setSetting("chLogic", 3, 0);
  476. setSetting("chLogic", 4, 0);
  477. setSetting("relays", 1);
  478. #elif defined(XENON_SM_PW702U)
  479. setSetting("board", 44);
  480. setSetting("ledGPIO", 0, 4);
  481. setSetting("ledLogic", 0, 0);
  482. setSetting("btnGPIO", 0, 13);
  483. setSetting("btnRelay", 0, 0);
  484. setSetting("relayGPIO", 0, 12);
  485. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  486. #elif defined(AUTHOMETION_LYT8266)
  487. setSetting("board", 45);
  488. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  489. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  490. setSetting("chGPIO", 0, 13);
  491. setSetting("chGPIO", 1, 12);
  492. setSetting("chGPIO", 2, 14);
  493. setSetting("chGPIO", 3, 2);
  494. setSetting("chLogic", 0, 0);
  495. setSetting("chLogic", 1, 0);
  496. setSetting("chLogic", 2, 0);
  497. setSetting("chLogic", 3, 0);
  498. setSetting("relays", 1);
  499. setSetting("enGPIO", 15);
  500. #elif defined(ARILUX_E27)
  501. setSetting("board", 46);
  502. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  503. setSetting("lightProvider", LIGHT_PROVIDER_MY92XX);
  504. setSetting("myModel", MY92XX_MODEL_MY9291);
  505. setSetting("myChips", 1);
  506. setSetting("myDIGPIO", 13);
  507. setSetting("myDCKIGPIO", 15);
  508. setSetting("relays", 1);
  509. #elif defined(YJZK_SWITCH_2CH)
  510. setSetting("board", 47);
  511. setSetting("ledGPIO", 0, 13);
  512. setSetting("ledLogic", 0, 0);
  513. setSetting("ledWifi", 0);
  514. setSetting("btnGPIO", 0, 0);
  515. setSetting("btnGPIO", 1, 9);
  516. setSetting("btnRelay", 0, 0);
  517. setSetting("btnRelay", 1, 1);
  518. setSetting("relayGPIO", 0, 12);
  519. setSetting("relayGPIO", 1, 5);
  520. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  521. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  522. #elif defined(ITEAD_SONOFF_DUAL_R2)
  523. setSetting("board", 48);
  524. setSetting("ledGPIO", 0, 13);
  525. setSetting("ledLogic", 0, 1);
  526. setSetting("btnGPIO", 0, 0);
  527. setSetting("btnGPIO", 1, 9);
  528. setSetting("btnGPIO", 2, 10);
  529. setSetting("btnRelay", 0, 0);
  530. setSetting("btnRelay", 1, 1);
  531. setSetting("btnRelay", 2, 0);
  532. setSetting("relayGPIO", 0, 12);
  533. setSetting("relayGPIO", 1, 5);
  534. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  535. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  536. #elif defined(GENERIC_8CH)
  537. setSetting("board", 49);
  538. setSetting("relayGPIO", 0, 0);
  539. setSetting("relayGPIO", 1, 2);
  540. setSetting("relayGPIO", 2, 4);
  541. setSetting("relayGPIO", 3, 5);
  542. setSetting("relayGPIO", 4, 12);
  543. setSetting("relayGPIO", 5, 13);
  544. setSetting("relayGPIO", 6, 14);
  545. setSetting("relayGPIO", 7, 15);
  546. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  547. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  548. setSetting("relayType", 2, RELAY_TYPE_NORMAL);
  549. setSetting("relayType", 3, RELAY_TYPE_NORMAL);
  550. setSetting("relayType", 4, RELAY_TYPE_NORMAL);
  551. setSetting("relayType", 5, RELAY_TYPE_NORMAL);
  552. setSetting("relayType", 6, RELAY_TYPE_NORMAL);
  553. setSetting("relayType", 7, RELAY_TYPE_NORMAL);
  554. #elif defined(ARILUX_AL_LC01)
  555. setSetting("board", 50);
  556. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  557. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  558. setSetting("chGPIO", 0, 5);
  559. setSetting("chGPIO", 1, 12);
  560. setSetting("chGPIO", 2, 13);
  561. setSetting("chGPIO", 3, 14);
  562. setSetting("chLogic", 0, 0);
  563. setSetting("chLogic", 1, 0);
  564. setSetting("chLogic", 2, 0);
  565. setSetting("chLogic", 3, 0);
  566. setSetting("relays", 1);
  567. #elif defined(ARILUX_AL_LC11)
  568. setSetting("board", 51);
  569. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  570. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  571. setSetting("chGPIO", 0, 5);
  572. setSetting("chGPIO", 1, 4);
  573. setSetting("chGPIO", 2, 14);
  574. setSetting("chGPIO", 3, 13);
  575. setSetting("chGPIO", 4, 12);
  576. setSetting("chLogic", 0, 0);
  577. setSetting("chLogic", 1, 0);
  578. setSetting("chLogic", 2, 0);
  579. setSetting("chLogic", 3, 0);
  580. setSetting("chLogic", 4, 0);
  581. setSetting("relays", 1);
  582. #elif defined(ARILUX_AL_LC02)
  583. setSetting("board", 52);
  584. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  585. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  586. setSetting("chGPIO", 0, 12);
  587. setSetting("chGPIO", 1, 5);
  588. setSetting("chGPIO", 2, 13);
  589. setSetting("chGPIO", 3, 15);
  590. setSetting("chLogic", 0, 0);
  591. setSetting("chLogic", 1, 0);
  592. setSetting("chLogic", 2, 0);
  593. setSetting("chLogic", 3, 0);
  594. setSetting("relays", 1);
  595. #elif defined(KMC_70011)
  596. setSetting("board", 53);
  597. setSetting("ledGPIO", 0, 13);
  598. setSetting("ledLogic", 0, 0);
  599. setSetting("btnGPIO", 0, 0);
  600. setSetting("btnRelay", 0, 0);
  601. setSetting("relayGPIO", 0, 14);
  602. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  603. setSetting("selGPIO", 12);
  604. setSetting("cf1GPIO", 5);
  605. setSetting("cfGPIO", 4);
  606. #elif defined(GIZWITS_WITTY_CLOUD)
  607. setSetting("board", 54);
  608. setSetting("ledGPIO", 0, 2);
  609. setSetting("ledLogic", 0, 1);
  610. setSetting("btnGPIO", 0, 4);
  611. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  612. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  613. setSetting("chGPIO", 0, 15);
  614. setSetting("chGPIO", 1, 12);
  615. setSetting("chGPIO", 2, 13);
  616. setSetting("chLogic", 0, 0);
  617. setSetting("chLogic", 1, 0);
  618. setSetting("chLogic", 2, 0);
  619. setSetting("relays", 1);
  620. #elif defined(EUROMATE_WIFI_STECKER_SCHUKO)
  621. setSetting("board", 55);
  622. setSetting("ledGPIO", 0, 4);
  623. setSetting("ledLogic", 0, 0);
  624. setSetting("ledGPIO", 1, 12);
  625. setSetting("ledLogic", 1, 0);
  626. setSetting("btnGPIO", 0, 14);
  627. setSetting("btnRelay", 0, 0);
  628. setSetting("relayGPIO", 0, 5);
  629. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  630. #elif defined(TONBUX_POWERSTRIP02)
  631. setSetting("board", 56);
  632. setSetting("relayGPIO", 0, 4);
  633. setSetting("relayGPIO", 1, 13);
  634. setSetting("relayGPIO", 2, 12);
  635. setSetting("relayGPIO", 3, 14);
  636. setSetting("relayGPIO", 4, 16);
  637. setSetting("relayType", 0, RELAY_TYPE_INVERSE);
  638. setSetting("relayType", 1, RELAY_TYPE_INVERSE);
  639. setSetting("relayType", 2, RELAY_TYPE_INVERSE);
  640. setSetting("relayType", 3, RELAY_TYPE_INVERSE);
  641. setSetting("relayType", 4, RELAY_TYPE_NORMAL); // Not a relay. USB ports on/off
  642. setSetting("ledGPIO", 0, 0); // 1 blue led
  643. setSetting("ledLogic", 0, 1);
  644. setSetting("ledGPIO", 1, 3); // 3 red leds
  645. setSetting("ledLogic", 1, 1);
  646. setSetting("btnGPIO", 0, 5);
  647. setSetting("btnRelay", 0, 1);
  648. #elif defined(LINGAN_SWA1)
  649. setSetting("board", 57);
  650. setSetting("ledGPIO", 0, 4);
  651. setSetting("ledLogic", 0, 1);
  652. setSetting("btnGPIO", 0, 13);
  653. setSetting("btnRelay", 0, 0);
  654. setSetting("relayGPIO", 0, 5);
  655. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  656. #elif defined(HEYGO_HY02)
  657. setSetting("board", 58);
  658. setSetting("ledGPIO", 0, 0);
  659. setSetting("ledLogic", 0, 1);
  660. setSetting("ledGPIO", 1, 15);
  661. setSetting("ledLogic", 1, 0);
  662. setSetting("btnGPIO", 0, 13);
  663. setSetting("btnRelay", 0, 0);
  664. setSetting("relayGPIO", 0, 15);
  665. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  666. setSetting("selGPIO", 3);
  667. setSetting("cf1GPIO", 14);
  668. setSetting("cfGPIO", 5);
  669. #elif defined(MAXCIO_WUS002S)
  670. setSetting("board", 59);
  671. setSetting("ledGPIO", 0, 3);
  672. setSetting("ledLogic", 0, 0);
  673. setSetting("btnGPIO", 0, 2);
  674. setSetting("btnRelay", 0, 0);
  675. setSetting("relayGPIO", 0, 13);
  676. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  677. setSetting("selGPIO", 12);
  678. setSetting("cf1GPIO", 5);
  679. setSetting("cfGPIO", 4);
  680. #elif defined(YIDIAN_XSSSA05)
  681. setSetting("board", 60);
  682. setSetting("ledGPIO", 0, 0);
  683. setSetting("ledLogic", 0, 0);
  684. setSetting("ledGPIO", 1, 5);
  685. setSetting("ledLogic", 1, 0);
  686. setSetting("ledGPIO", 2, 2);
  687. setSetting("ledLogic", 2, 0);
  688. setSetting("btnGPIO", 0, 13);
  689. setSetting("btnRelay", 0, 0);
  690. setSetting("relayGPIO", 0, 15);
  691. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  692. #elif defined(TONBUX_XSSSA06)
  693. setSetting("board", 61);
  694. setSetting("ledGPIO", 0, 4);
  695. setSetting("ledLogic", 0, 1);
  696. setSetting("btnGPIO", 0, 13);
  697. setSetting("btnRelay", 0, 0);
  698. setSetting("relayGPIO", 0, 5);
  699. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  700. #elif defined(GREEN_ESP8266RELAY)
  701. setSetting("board", 62);
  702. setSetting("ledGPIO", 0, 2);
  703. setSetting("ledLogic", 0, 1);
  704. setSetting("btnGPIO", 0, 5);
  705. setSetting("btnRelay", 0, 0);
  706. setSetting("relayGPIO", 0, 4);
  707. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  708. #elif defined(IKE_ESPIKE)
  709. setSetting("board", 63);
  710. setSetting("ledGPIO", 0, 2);
  711. setSetting("ledLogic", 0, 1);
  712. setSetting("btnGPIO", 0, 13);
  713. setSetting("btnRelay", 0, 0);
  714. setSetting("btnGPIO", 1, 12);
  715. setSetting("btnRelay", 1, 1);
  716. setSetting("btnGPIO", 2, 13);
  717. setSetting("btnRelay", 2, 2);
  718. setSetting("relayGPIO", 0, 4);
  719. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  720. setSetting("relayGPIO", 1, 5);
  721. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  722. setSetting("relayGPIO", 2, 16);
  723. setSetting("relayType", 2, RELAY_TYPE_NORMAL);
  724. #elif defined(ARNIEX_SWIFITCH)
  725. setSetting("board", 64);
  726. setSetting("ledGPIO", 0, 12);
  727. setSetting("ledLogic", 0, 1);
  728. setSetting("btnGPIO", 0, 4);
  729. setSetting("btnRelay", 0, 1);
  730. setSetting("relayGPIO", 0, 5);
  731. setSetting("relayType", 0, RELAY_TYPE_INVERSE);
  732. #elif defined(GENERIC_ESP01S_RELAY_V40)
  733. setSetting("board", 65);
  734. setSetting("ledGPIO", 0, 2);
  735. setSetting("ledLogic", 0, 0);
  736. setSetting("relayGPIO", 0, 0);
  737. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  738. #elif defined(GENERIC_ESP01S_RGBLED_V10)
  739. setSetting("board", 66);
  740. setSetting("ledGPIO", 0, 2);
  741. #elif defined(HELTEC_TOUCHRELAY)
  742. setSetting("board", 67);
  743. setSetting("btnGPIO", 0, 14);
  744. setSetting("btnRelay", 0, 1);
  745. setSetting("relayGPIO", 0, 12);
  746. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  747. #elif defined(GENERIC_ESP01S_DHT11_V10)
  748. setSetting("board", 68);
  749. #elif defined(GENERIC_ESP01S_DS18B20_V10)
  750. setSetting("board", 69);
  751. #elif defined(ZHILDE_EU44_W)
  752. setSetting("board", 70);
  753. setSetting("btnGPIO", 0, 3);
  754. setSetting("ledGPIO", 0, 1);
  755. setSetting("ledLogic", 0, 1);
  756. setSetting("relayGPIO", 0, 5);
  757. setSetting("relayGPIO", 1, 4);
  758. setSetting("relayGPIO", 2, 12);
  759. setSetting("relayGPIO", 3, 13);
  760. setSetting("relayGPIO", 4, 14);
  761. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  762. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  763. setSetting("relayType", 2, RELAY_TYPE_NORMAL);
  764. setSetting("relayType", 3, RELAY_TYPE_NORMAL);
  765. setSetting("relayType", 4, RELAY_TYPE_NORMAL);
  766. #elif defined(ITEAD_SONOFF_POW_R2)
  767. setSetting("board", 71);
  768. setSetting("ledGPIO", 0, 15);
  769. setSetting("ledLogic", 0, 1);
  770. setSetting("btnGPIO", 0, 0);
  771. setSetting("btnRelay", 0, 0);
  772. setSetting("relayGPIO", 0, 12);
  773. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  774. setSetting("selGPIO", 5);
  775. setSetting("cf1GPIO", 13);
  776. setSetting("cfGPIO", 14);
  777. #elif defined(LUANI_HVIO)
  778. setSetting("board", 72);
  779. setSetting("ledGPIO", 0, 15);
  780. setSetting("ledLogic", 0, 0);
  781. setSetting("btnGPIO", 0, 12);
  782. setSetting("btnRelay", 0, 0);
  783. setSetting("relayGPIO", 0, 4);
  784. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  785. setSetting("relayGPIO", 1, 5);
  786. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  787. #elif defined(ALLNET_4DUINO_IOT_WLAN_RELAIS)
  788. setSetting("board", 73);
  789. setSetting("relayGPIO", 0, 14);
  790. setSetting("relayResetGPIO", 0, 12);
  791. setSetting("relayType", 0, RELAY_TYPE_LATCHED);
  792. #elif defined(TONBUX_MOSQUITO_KILLER)
  793. setSetting("board", 74);
  794. setSetting("ledGPIO", 0, 15);
  795. setSetting("ledLogic", 0, 1);
  796. setSetting("ledGPIO", 1, 14);
  797. setSetting("ledLogic", 1, 1);
  798. setSetting("ledGPIO", 2, 12);
  799. setSetting("ledLogic", 2, 0);
  800. setSetting("ledGPIO", 3, 16);
  801. setSetting("ledLogic", 3, 0);
  802. setSetting("btnGPIO", 0, 2);
  803. setSetting("btnRelay", 0, 0);
  804. setSetting("relayGPIO", 0, 5);
  805. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  806. #elif defined(NEO_COOLCAM_NAS_WR01W)
  807. setSetting("board", 75);
  808. setSetting("ledGPIO", 0, 4);
  809. setSetting("ledLogic", 0, 1);
  810. setSetting("btnGPIO", 0, 13);
  811. setSetting("btnRelay", 0, 0);
  812. setSetting("relayGPIO", 0, 12);
  813. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  814. #elif defined(PILOTAK_ESP_DIN_V1)
  815. setSetting("board", 76);
  816. setSetting("ledGPIO", 0, 16);
  817. setSetting("ledLogic", 0, 0);
  818. setSetting("btnGPIO", 0, 0);
  819. setSetting("btnRelay", 0, 0);
  820. setSetting("relayGPIO", 0, 4);
  821. setSetting("relayGPIO", 1, 5);
  822. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  823. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  824. #elif defined(FORNORM_ZLD_34EU)
  825. setSetting("board", 77);
  826. setSetting("btnGPIO", 0, 16);
  827. setSetting("btnRelay", 0, 3);
  828. setSetting("ledGPIO", 0, 0);
  829. setSetting("ledGPIO", 1, 12);
  830. setSetting("ledGPIO", 2, 3);
  831. setSetting("ledGPIO", 3, 5);
  832. setSetting("ledLogic", 0, 1);
  833. setSetting("ledLogic", 1, 1);
  834. setSetting("ledLogic", 2, 1);
  835. setSetting("ledLogic", 3, 1);
  836. setSetting("ledMode", 0, LED_MODE_FINDME);
  837. setSetting("ledMode", 1, LED_MODE_FOLLOW);
  838. setSetting("ledMode", 2, LED_MODE_FOLLOW);
  839. setSetting("ledMode", 3, LED_MODE_FOLLOW);
  840. setSetting("ledRelay", 1, 1);
  841. setSetting("ledRelay", 2, 2);
  842. setSetting("ledRelay", 3, 3);
  843. setSetting("relayGPIO", 0, 14);
  844. setSetting("relayGPIO", 1, 13);
  845. setSetting("relayGPIO", 2, 4);
  846. setSetting("relayGPIO", 3, 15);
  847. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  848. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  849. setSetting("relayType", 2, RELAY_TYPE_NORMAL);
  850. setSetting("relayType", 3, RELAY_TYPE_NORMAL);
  851. #elif defined(BH_ONOFRE)
  852. setSetting("board", 78);
  853. setSetting("btnGPIO", 0, 12);
  854. setSetting("btnGPIO", 0, 13);
  855. setSetting("btnRelay", 0, 0);
  856. setSetting("btnRelay", 0, 1);
  857. setSetting("relayGPIO", 0, 4);
  858. setSetting("relayGPIO", 1, 5);
  859. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  860. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  861. #elif defined(BLITZWOLF_BWSHPX)
  862. setSetting("board", 79);
  863. setSetting("ledGPIO", 0, 2);
  864. setSetting("ledLogic", 0, 1);
  865. setSetting("ledGPIO", 1, 0);
  866. setSetting("ledLogic", 1, 1);
  867. setSetting("ledMode", 1, LED_MODE_FINDME);
  868. setSetting("ledRelay", 1, 0);
  869. setSetting("btnGPIO", 0, 13);
  870. setSetting("btnRelay", 0, 0);
  871. setSetting("relayGPIO", 0, 15);
  872. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  873. setSetting("selGPIO", 12);
  874. setSetting("cf1GPIO", 14);
  875. setSetting("cfGPIO", 5);
  876. setSetting("pwrRatioC", 25740);
  877. setSetting("pwrRatioV", 313400);
  878. setSetting("pwrRatioP", 3414290);
  879. setSetting("hlwSelC", LOW);
  880. setSetting("hlwIntM", FALLING);
  881. #elif defined(TINKERMAN_RFM69GW)
  882. setSetting("board", 80);
  883. setSetting("btnGPIO", 0, 0);
  884. #elif defined(ITEAD_SONOFF_IFAN02)
  885. setSetting("board", 81);
  886. setSetting("btnGPIO", 0, 0);
  887. setSetting("btnGPIO", 1, 9);
  888. setSetting("btnGPIO", 2, 10);
  889. setSetting("btnGPIO", 3, 14);
  890. setSetting("ledGPIO", 1, 13);
  891. setSetting("ledLogic", 1, 1);
  892. setSetting("relayGPIO", 0, 12);
  893. setSetting("relayGPIO", 1, 5);
  894. setSetting("relayGPIO", 2, 4);
  895. setSetting("relayGPIO", 3, 15);
  896. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  897. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  898. setSetting("relayType", 2, RELAY_TYPE_NORMAL);
  899. setSetting("relayType", 3, RELAY_TYPE_NORMAL);
  900. #elif defined(GENERIC_AG_L4)
  901. setSetting("board", 82);
  902. setSetting("btnGPIO", 0, 4);
  903. setSetting("btnGPIO", 1, 2);
  904. setSetting("btnRelay", 0, 0);
  905. setSetting("ledGPIO", 0, 5);
  906. setSetting("ledGPIO", 1, 16);
  907. setSetting("ledLogic", 0, 0);
  908. setSetting("ledLogic", 1, 1);
  909. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  910. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  911. setSetting("chGPIO", 0, 14);
  912. setSetting("chGPIO", 1, 13);
  913. setSetting("chGPIO", 2, 12);
  914. setSetting("chLogic", 0, 0);
  915. setSetting("chLogic", 1, 0);
  916. setSetting("chLogic", 2, 0);
  917. setSetting("relays", 1);
  918. #elif defined(ALLTERCO_SHELLY1)
  919. setSetting("board", 83);
  920. setSetting("btnGPIO", 0, 5);
  921. setSetting("btnRelay", 0, 0);
  922. setSetting("relayGPIO", 0, 4);
  923. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  924. #elif defined(LOHAS_9W)
  925. setSetting("board", 84);
  926. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  927. setSetting("lightProvider", LIGHT_PROVIDER_MY92XX);
  928. setSetting("myModel", MY92XX_MODEL_MY9231);
  929. setSetting("myChips", 2);
  930. setSetting("myDIGPIO", 13);
  931. setSetting("myDCKIGPIO", 15);
  932. setSetting("relays", 1);
  933. #elif defined(YJZK_SWITCH_1CH)
  934. setSetting("board", 85);
  935. setSetting("ledGPIO", 0, 13);
  936. setSetting("ledLogic", 0, 0);
  937. setSetting("ledWifi", 0);
  938. setSetting("btnGPIO", 0, 0);
  939. setSetting("btnRelay", 0, 0);
  940. setSetting("relayGPIO", 0, 12);
  941. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  942. #elif defined(YJZK_SWITCH_3CH)
  943. setSetting("board", 86);
  944. setSetting("ledGPIO", 0, 13);
  945. setSetting("ledLogic", 0, 0);
  946. setSetting("ledWifi", 0);
  947. setSetting("btnGPIO", 0, 0);
  948. setSetting("btnGPIO", 1, 9);
  949. setSetting("btnGPIO", 2, 10);
  950. setSetting("btnRelay", 0, 0);
  951. setSetting("btnRelay", 1, 1);
  952. setSetting("btnRelay", 2, 2);
  953. setSetting("relayGPIO", 0, 12);
  954. setSetting("relayGPIO", 1, 5);
  955. setSetting("relayGPIO", 2, 4);
  956. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  957. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  958. setSetting("relayType", 2, RELAY_TYPE_NORMAL);
  959. #elif defined(XIAOMI_SMART_DESK_LAMP)
  960. setSetting("board", 87);
  961. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  962. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  963. setSetting("relays", 1);
  964. setSetting("chGPIO", 0, 5);
  965. setSetting("chGPIO", 1, 4);
  966. setSetting("chLogic", 0, 0);
  967. setSetting("chLogic", 1, 0);
  968. setSetting("btnGPIO", 0, 2);
  969. setSetting("btnGPIO", 1, 14);
  970. setSetting("btnRelay", 0, 0);
  971. setSetting("btnLngDelay", 500);
  972. setSetting("btnDblClick", 0, BUTTON_MODE_NONE);
  973. setSetting("btnLngClick", 0, BUTTON_MODE_NONE);
  974. setSetting("btnLngLngClick", 0, BUTTON_MODE_NONE);
  975. setSetting("btnDblClick", 1, BUTTON_MODE_AP);
  976. setSetting("btnLngLngClick", 1, BUTTON_MODE_RESET);
  977. setSetting("enc1stGPIO", 0, 12);
  978. setSetting("enc2ndGPIO", 0, 13);
  979. setSetting("encBtnGPIO", 0, 2);
  980. setSetting("encMode", ENCODER_MODE_RATIO);
  981. #elif defined(ALLTERCO_SHELLY2)
  982. setSetting("board", 88);
  983. setSetting("btnGPIO", 0, 12);
  984. setSetting("btnGPIO", 1, 14);
  985. setSetting("btnRelay", 0, 0);
  986. setSetting("btnRelay", 1, 1);
  987. setSetting("relayGPIO", 0, 4);
  988. setSetting("relayGPIO", 1, 5);
  989. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  990. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  991. #elif defined(PHYX_ESP12_RGB)
  992. setSetting("board", 89);
  993. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  994. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  995. setSetting("relays", 1);
  996. setSetting("chGPIO", 0, 4);
  997. setSetting("chGPIO", 1, 14);
  998. setSetting("chGPIO", 2, 12);
  999. setSetting("chLogic", 0, 0);
  1000. setSetting("chLogic", 1, 0);
  1001. setSetting("chLogic", 3, 0);
  1002. #elif defined(IWOOLE_LED_TABLE_LAMP)
  1003. setSetting("board", 90);
  1004. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  1005. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  1006. setSetting("chGPIO", 0, 12);
  1007. setSetting("chGPIO", 1, 5);
  1008. setSetting("chGPIO", 2, 14);
  1009. setSetting("chGPIO", 3, 4);
  1010. setSetting("chLogic", 0, 0);
  1011. setSetting("chLogic", 1, 0);
  1012. setSetting("chLogic", 2, 0);
  1013. setSetting("chLogic", 3, 0);
  1014. setSetting("relays", 1);
  1015. #elif defined(EXS_WIFI_RELAY_V50)
  1016. setSetting("board", 91);
  1017. setSetting("btnGPIO", 0, 5);
  1018. setSetting("btnGPIO", 1, 4);
  1019. setSetting("btnRelay", 0, 0);
  1020. setSetting("btnRelay", 1, 1);
  1021. setSetting("relayGPIO", 0, 14);
  1022. setSetting("relayGPIO", 1, 13);
  1023. setSetting("relayResetGPIO", 0, 16);
  1024. setSetting("relayResetGPIO", 1, 12);
  1025. setSetting("relayType", 0, RELAY_TYPE_LATCHED);
  1026. setSetting("relayType", 0, RELAY_TYPE_LATCHED);
  1027. setSetting("ledGPIO", 1, 15);
  1028. setSetting("ledLogic", 1, 0);
  1029. #elif defined(TONBUX_XSSSA01)
  1030. setSetting("board", 92);
  1031. setSetting("ledGPIO", 0, 13);
  1032. setSetting("ledLogic", 0, 0);
  1033. setSetting("btnGPIO", 0, 13);
  1034. setSetting("btnRelay", 0, 0);
  1035. setSetting("relayGPIO", 0, 5);
  1036. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  1037. #elif defined(EUROMATE_WIFI_STECKER_SCHUKO_V2)
  1038. setSetting("board", 93);
  1039. setSetting("ledGPIO", 0, 13); // Red LED
  1040. setSetting("ledLogic", 0, 1);
  1041. setSetting("ledGPIO", 1, 12); // Green LED
  1042. setSetting("ledLogic", 1, 1);
  1043. setSetting("btnGPIO", 0, 5);
  1044. setSetting("btnRelay", 0, 0);
  1045. setSetting("relayGPIO", 0, 4);
  1046. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  1047. #elif defined(OUKITEL_P1)
  1048. setSetting("board", 94);
  1049. setSetting("ledGPIO", 0, 0); // Blue LED
  1050. setSetting("ledLogic", 0, 0);
  1051. setSetting("btnGPIO", 0, 13);
  1052. setSetting("btnRelay", 0, 0);
  1053. setSetting("relayGPIO", 0, 12); // Right outlet
  1054. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  1055. setSetting("relayGPIO", 1, 15); // Left outlet
  1056. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  1057. #elif defined(DIGOO_NX_SP202)
  1058. setSetting("board", 95);
  1059. setSetting("ledGPIO", 0, 13);
  1060. setSetting("ledLogic", 0, 1);
  1061. setSetting("btnGPIO", 0, 0);
  1062. setSetting("btnRelay", 0, 0);
  1063. setSetting("btnGPIO", 1, 16);
  1064. setSetting("btnRelay", 1, 1);
  1065. setSetting("relayGPIO", 0, 15);
  1066. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  1067. setSetting("relayGPIO", 1, 14);
  1068. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  1069. setSetting("selGPIO", 12);
  1070. setSetting("cf1GPIO", 5);
  1071. setSetting("cfGPIO", 4);
  1072. setSetting("pwrRatioC", 23296);
  1073. setSetting("pwrRatioV", 310085);
  1074. setSetting("pwrRatioP", 3368471);
  1075. setSetting("hlwSelC", LOW);
  1076. setSetting("hlwIntM", FALLING);
  1077. #elif defined(FOXEL_LIGHTFOX_DUAL)
  1078. setSetting("board", 96);
  1079. setSetting("btnRelay", 0, 0);
  1080. setSetting("btnRelay", 1, 1);
  1081. setSetting("btnRelay", 2, 1);
  1082. setSetting("btnRelay", 3, 0);
  1083. setSetting("relayProvider", RELAY_PROVIDER_DUAL);
  1084. setSetting("relays", 2);
  1085. #elif defined(GENERIC_GU10)
  1086. setSetting("board", 97);
  1087. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  1088. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  1089. setSetting("chGPIO", 0, 14);
  1090. setSetting("chGPIO", 1, 12);
  1091. setSetting("chGPIO", 2, 13);
  1092. setSetting("chGPIO", 3, 4);
  1093. setSetting("chLogic", 0, 0);
  1094. setSetting("chLogic", 1, 0);
  1095. setSetting("chLogic", 2, 0);
  1096. setSetting("chLogic", 3, 0);
  1097. setSetting("relays", 1);
  1098. #elif defined(ISELECTOR_SM_PW702)
  1099. setSetting("board", 98);
  1100. setSetting("ledGPIO", 0, 4);
  1101. setSetting("ledLogic", 0, 0);
  1102. setSetting("ledGPIO", 1, 5);
  1103. setSetting("ledLogic", 0, 0);
  1104. setSetting("btnGPIO", 0, 13);
  1105. setSetting("btnRelay", 0, 0);
  1106. setSetting("relayGPIO", 0, 12);
  1107. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  1108. #elif defined(ITEAD_SONOFF_MINI)
  1109. setSetting("board", 99);
  1110. setSetting("ledGPIO", 0, 13);
  1111. setSetting("ledLogic", 0, 1);
  1112. setSetting("btnGPIO", 0, 0);
  1113. setSetting("btnRelay", 0, 0);
  1114. setSetting("btnGPIO", 1, 4);
  1115. setSetting("btnRelay", 1, 0);
  1116. setSetting("relayGPIO", 0, 12);
  1117. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  1118. #elif defined(TECKIN_SP21)
  1119. setSetting("board", 100);
  1120. setSetting("ledGPIO", 0, 2);
  1121. setSetting("ledLogic", 0, 1);
  1122. setSetting("btnGPIO", 0, 13);
  1123. setSetting("btnRelay", 0, 0);
  1124. setSetting("relayGPIO", 0, 15);
  1125. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  1126. #else
  1127. // Allow users to define new settings without migration config
  1128. //#error "UNSUPPORTED HARDWARE!"
  1129. #endif
  1130. }
  1131. saveSettings();
  1132. }