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.

1494 lines
54 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(AVATTO_NAS_WR01W)
  807. setSetting("board", 75);
  808. setSetting("ledGPIO", 0, 13);
  809. setSetting("ledLogic", 0, 1);
  810. setSetting("btnGPIO", 0, 0);
  811. setSetting("btnRelay", 0, 0);
  812. setSetting("relayGPIO", 0, 14);
  813. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  814. #elif defined(NEO_COOLCAM_NAS_WR01W)
  815. setSetting("board", 75);
  816. setSetting("ledGPIO", 0, 4);
  817. setSetting("ledLogic", 0, 1);
  818. setSetting("btnGPIO", 0, 13);
  819. setSetting("btnRelay", 0, 0);
  820. setSetting("relayGPIO", 0, 12);
  821. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  822. #elif defined(PILOTAK_ESP_DIN_V1)
  823. setSetting("board", 76);
  824. setSetting("ledGPIO", 0, 16);
  825. setSetting("ledLogic", 0, 0);
  826. setSetting("btnGPIO", 0, 0);
  827. setSetting("btnRelay", 0, 0);
  828. setSetting("relayGPIO", 0, 4);
  829. setSetting("relayGPIO", 1, 5);
  830. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  831. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  832. #elif defined(FORNORM_ZLD_34EU)
  833. setSetting("board", 77);
  834. setSetting("btnGPIO", 0, 16);
  835. setSetting("btnRelay", 0, 3);
  836. setSetting("ledGPIO", 0, 0);
  837. setSetting("ledGPIO", 1, 12);
  838. setSetting("ledGPIO", 2, 3);
  839. setSetting("ledGPIO", 3, 5);
  840. setSetting("ledLogic", 0, 1);
  841. setSetting("ledLogic", 1, 1);
  842. setSetting("ledLogic", 2, 1);
  843. setSetting("ledLogic", 3, 1);
  844. setSetting("ledMode", 0, LED_MODE_FINDME);
  845. setSetting("ledMode", 1, LED_MODE_FOLLOW);
  846. setSetting("ledMode", 2, LED_MODE_FOLLOW);
  847. setSetting("ledMode", 3, LED_MODE_FOLLOW);
  848. setSetting("ledRelay", 1, 1);
  849. setSetting("ledRelay", 2, 2);
  850. setSetting("ledRelay", 3, 3);
  851. setSetting("relayGPIO", 0, 14);
  852. setSetting("relayGPIO", 1, 13);
  853. setSetting("relayGPIO", 2, 4);
  854. setSetting("relayGPIO", 3, 15);
  855. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  856. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  857. setSetting("relayType", 2, RELAY_TYPE_NORMAL);
  858. setSetting("relayType", 3, RELAY_TYPE_NORMAL);
  859. #elif defined(BH_ONOFRE)
  860. setSetting("board", 78);
  861. setSetting("btnGPIO", 0, 12);
  862. setSetting("btnGPIO", 0, 13);
  863. setSetting("btnRelay", 0, 0);
  864. setSetting("btnRelay", 0, 1);
  865. setSetting("relayGPIO", 0, 4);
  866. setSetting("relayGPIO", 1, 5);
  867. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  868. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  869. #elif defined(BLITZWOLF_BWSHPX)
  870. setSetting("board", 79);
  871. setSetting("ledGPIO", 0, 2);
  872. setSetting("ledLogic", 0, 1);
  873. setSetting("ledGPIO", 1, 0);
  874. setSetting("ledLogic", 1, 1);
  875. setSetting("ledMode", 1, LED_MODE_FINDME);
  876. setSetting("ledRelay", 1, 0);
  877. setSetting("btnGPIO", 0, 13);
  878. setSetting("btnRelay", 0, 0);
  879. setSetting("relayGPIO", 0, 15);
  880. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  881. setSetting("selGPIO", 12);
  882. setSetting("cf1GPIO", 14);
  883. setSetting("cfGPIO", 5);
  884. setSetting("pwrRatioC", 25740);
  885. setSetting("pwrRatioV", 313400);
  886. setSetting("pwrRatioP", 3414290);
  887. setSetting("hlwSelC", LOW);
  888. setSetting("hlwIntM", FALLING);
  889. #elif defined(TINKERMAN_RFM69GW)
  890. setSetting("board", 80);
  891. setSetting("btnGPIO", 0, 0);
  892. #elif defined(ITEAD_SONOFF_IFAN02)
  893. setSetting("board", 81);
  894. setSetting("btnGPIO", 0, 0);
  895. setSetting("btnGPIO", 1, 9);
  896. setSetting("btnGPIO", 2, 10);
  897. setSetting("btnGPIO", 3, 14);
  898. setSetting("ledGPIO", 1, 13);
  899. setSetting("ledLogic", 1, 1);
  900. setSetting("relayGPIO", 0, 12);
  901. setSetting("relayGPIO", 1, 5);
  902. setSetting("relayGPIO", 2, 4);
  903. setSetting("relayGPIO", 3, 15);
  904. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  905. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  906. setSetting("relayType", 2, RELAY_TYPE_NORMAL);
  907. setSetting("relayType", 3, RELAY_TYPE_NORMAL);
  908. #elif defined(GENERIC_AG_L4)
  909. setSetting("board", 82);
  910. setSetting("btnGPIO", 0, 4);
  911. setSetting("btnGPIO", 1, 2);
  912. setSetting("btnRelay", 0, 0);
  913. setSetting("ledGPIO", 0, 5);
  914. setSetting("ledGPIO", 1, 16);
  915. setSetting("ledLogic", 0, 0);
  916. setSetting("ledLogic", 1, 1);
  917. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  918. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  919. setSetting("chGPIO", 0, 14);
  920. setSetting("chGPIO", 1, 13);
  921. setSetting("chGPIO", 2, 12);
  922. setSetting("chLogic", 0, 0);
  923. setSetting("chLogic", 1, 0);
  924. setSetting("chLogic", 2, 0);
  925. setSetting("relays", 1);
  926. #elif defined(ALLTERCO_SHELLY1)
  927. setSetting("board", 83);
  928. setSetting("btnGPIO", 0, 5);
  929. setSetting("btnRelay", 0, 0);
  930. setSetting("relayGPIO", 0, 4);
  931. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  932. #elif defined(LOHAS_9W)
  933. setSetting("board", 84);
  934. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  935. setSetting("lightProvider", LIGHT_PROVIDER_MY92XX);
  936. setSetting("myModel", MY92XX_MODEL_MY9231);
  937. setSetting("myChips", 2);
  938. setSetting("myDIGPIO", 13);
  939. setSetting("myDCKIGPIO", 15);
  940. setSetting("relays", 1);
  941. #elif defined(YJZK_SWITCH_1CH)
  942. setSetting("board", 85);
  943. setSetting("ledGPIO", 0, 13);
  944. setSetting("ledLogic", 0, 0);
  945. setSetting("ledWifi", 0);
  946. setSetting("btnGPIO", 0, 0);
  947. setSetting("btnRelay", 0, 0);
  948. setSetting("relayGPIO", 0, 12);
  949. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  950. #elif defined(YJZK_SWITCH_3CH)
  951. setSetting("board", 86);
  952. setSetting("ledGPIO", 0, 13);
  953. setSetting("ledLogic", 0, 0);
  954. setSetting("ledWifi", 0);
  955. setSetting("btnGPIO", 0, 0);
  956. setSetting("btnGPIO", 1, 9);
  957. setSetting("btnGPIO", 2, 10);
  958. setSetting("btnRelay", 0, 0);
  959. setSetting("btnRelay", 1, 1);
  960. setSetting("btnRelay", 2, 2);
  961. setSetting("relayGPIO", 0, 12);
  962. setSetting("relayGPIO", 1, 5);
  963. setSetting("relayGPIO", 2, 4);
  964. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  965. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  966. setSetting("relayType", 2, RELAY_TYPE_NORMAL);
  967. #elif defined(XIAOMI_SMART_DESK_LAMP)
  968. setSetting("board", 87);
  969. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  970. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  971. setSetting("relays", 1);
  972. setSetting("chGPIO", 0, 5);
  973. setSetting("chGPIO", 1, 4);
  974. setSetting("chLogic", 0, 0);
  975. setSetting("chLogic", 1, 0);
  976. setSetting("btnGPIO", 0, 2);
  977. setSetting("btnGPIO", 1, 14);
  978. setSetting("btnRelay", 0, 0);
  979. setSetting("btnLngDelay", 500);
  980. setSetting("btnDblClick", 0, BUTTON_MODE_NONE);
  981. setSetting("btnLngClick", 0, BUTTON_MODE_NONE);
  982. setSetting("btnLngLngClick", 0, BUTTON_MODE_NONE);
  983. setSetting("btnDblClick", 1, BUTTON_MODE_AP);
  984. setSetting("btnLngLngClick", 1, BUTTON_MODE_RESET);
  985. setSetting("enc1stGPIO", 0, 12);
  986. setSetting("enc2ndGPIO", 0, 13);
  987. setSetting("encBtnGPIO", 0, 2);
  988. setSetting("encMode", ENCODER_MODE_RATIO);
  989. #elif defined(ALLTERCO_SHELLY2)
  990. setSetting("board", 88);
  991. setSetting("btnGPIO", 0, 12);
  992. setSetting("btnGPIO", 1, 14);
  993. setSetting("btnRelay", 0, 0);
  994. setSetting("btnRelay", 1, 1);
  995. setSetting("relayGPIO", 0, 4);
  996. setSetting("relayGPIO", 1, 5);
  997. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  998. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  999. #elif defined(PHYX_ESP12_RGB)
  1000. setSetting("board", 89);
  1001. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  1002. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  1003. setSetting("relays", 1);
  1004. setSetting("chGPIO", 0, 4);
  1005. setSetting("chGPIO", 1, 14);
  1006. setSetting("chGPIO", 2, 12);
  1007. setSetting("chLogic", 0, 0);
  1008. setSetting("chLogic", 1, 0);
  1009. setSetting("chLogic", 3, 0);
  1010. #elif defined(IWOOLE_LED_TABLE_LAMP)
  1011. setSetting("board", 90);
  1012. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  1013. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  1014. setSetting("chGPIO", 0, 12);
  1015. setSetting("chGPIO", 1, 5);
  1016. setSetting("chGPIO", 2, 14);
  1017. setSetting("chGPIO", 3, 4);
  1018. setSetting("chLogic", 0, 0);
  1019. setSetting("chLogic", 1, 0);
  1020. setSetting("chLogic", 2, 0);
  1021. setSetting("chLogic", 3, 0);
  1022. setSetting("relays", 1);
  1023. #elif defined(EXS_WIFI_RELAY_V50)
  1024. setSetting("board", 91);
  1025. setSetting("btnGPIO", 0, 5);
  1026. setSetting("btnGPIO", 1, 4);
  1027. setSetting("btnRelay", 0, 0);
  1028. setSetting("btnRelay", 1, 1);
  1029. setSetting("relayGPIO", 0, 14);
  1030. setSetting("relayGPIO", 1, 13);
  1031. setSetting("relayResetGPIO", 0, 16);
  1032. setSetting("relayResetGPIO", 1, 12);
  1033. setSetting("relayType", 0, RELAY_TYPE_LATCHED);
  1034. setSetting("relayType", 0, RELAY_TYPE_LATCHED);
  1035. setSetting("ledGPIO", 1, 15);
  1036. setSetting("ledLogic", 1, 0);
  1037. #elif defined(TONBUX_XSSSA01)
  1038. setSetting("board", 92);
  1039. setSetting("ledGPIO", 0, 13);
  1040. setSetting("ledLogic", 0, 0);
  1041. setSetting("btnGPIO", 0, 13);
  1042. setSetting("btnRelay", 0, 0);
  1043. setSetting("relayGPIO", 0, 5);
  1044. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  1045. #elif defined(EUROMATE_WIFI_STECKER_SCHUKO_V2)
  1046. setSetting("board", 93);
  1047. setSetting("ledGPIO", 0, 13); // Red LED
  1048. setSetting("ledLogic", 0, 1);
  1049. setSetting("ledGPIO", 1, 12); // Green LED
  1050. setSetting("ledLogic", 1, 1);
  1051. setSetting("btnGPIO", 0, 5);
  1052. setSetting("btnRelay", 0, 0);
  1053. setSetting("relayGPIO", 0, 4);
  1054. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  1055. #elif defined(OUKITEL_P1)
  1056. setSetting("board", 94);
  1057. setSetting("ledGPIO", 0, 0); // Blue LED
  1058. setSetting("ledLogic", 0, 0);
  1059. setSetting("btnGPIO", 0, 13);
  1060. setSetting("btnRelay", 0, 0);
  1061. setSetting("relayGPIO", 0, 12); // Right outlet
  1062. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  1063. setSetting("relayGPIO", 1, 15); // Left outlet
  1064. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  1065. #elif defined(DIGOO_NX_SP202)
  1066. setSetting("board", 95);
  1067. setSetting("ledGPIO", 0, 13);
  1068. setSetting("ledLogic", 0, 1);
  1069. setSetting("btnGPIO", 0, 0);
  1070. setSetting("btnRelay", 0, 0);
  1071. setSetting("btnGPIO", 1, 16);
  1072. setSetting("btnRelay", 1, 1);
  1073. setSetting("relayGPIO", 0, 15);
  1074. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  1075. setSetting("relayGPIO", 1, 14);
  1076. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  1077. setSetting("selGPIO", 12);
  1078. setSetting("cf1GPIO", 5);
  1079. setSetting("cfGPIO", 4);
  1080. setSetting("pwrRatioC", 23296);
  1081. setSetting("pwrRatioV", 310085);
  1082. setSetting("pwrRatioP", 3368471);
  1083. setSetting("hlwSelC", LOW);
  1084. setSetting("hlwIntM", FALLING);
  1085. #elif defined(FOXEL_LIGHTFOX_DUAL)
  1086. setSetting("board", 96);
  1087. setSetting("btnRelay", 0, 0);
  1088. setSetting("btnRelay", 1, 1);
  1089. setSetting("btnRelay", 2, 1);
  1090. setSetting("btnRelay", 3, 0);
  1091. setSetting("relayProvider", RELAY_PROVIDER_DUAL);
  1092. setSetting("relays", 2);
  1093. #elif defined(GENERIC_GU10)
  1094. setSetting("board", 97);
  1095. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  1096. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  1097. setSetting("chGPIO", 0, 14);
  1098. setSetting("chGPIO", 1, 12);
  1099. setSetting("chGPIO", 2, 13);
  1100. setSetting("chGPIO", 3, 4);
  1101. setSetting("chLogic", 0, 0);
  1102. setSetting("chLogic", 1, 0);
  1103. setSetting("chLogic", 2, 0);
  1104. setSetting("chLogic", 3, 0);
  1105. setSetting("relays", 1);
  1106. #elif defined(ISELECTOR_SM_PW702)
  1107. setSetting("board", 98);
  1108. setSetting("ledGPIO", 0, 4);
  1109. setSetting("ledLogic", 0, 0);
  1110. setSetting("ledGPIO", 1, 5);
  1111. setSetting("ledLogic", 0, 0);
  1112. setSetting("btnGPIO", 0, 13);
  1113. setSetting("btnRelay", 0, 0);
  1114. setSetting("relayGPIO", 0, 12);
  1115. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  1116. #elif defined(ITEAD_SONOFF_MINI)
  1117. setSetting("board", 99);
  1118. setSetting("ledGPIO", 0, 13);
  1119. setSetting("ledLogic", 0, 1);
  1120. setSetting("btnGPIO", 0, 0);
  1121. setSetting("btnRelay", 0, 0);
  1122. setSetting("btnGPIO", 1, 4);
  1123. setSetting("btnRelay", 1, 0);
  1124. setSetting("relayGPIO", 0, 12);
  1125. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  1126. #elif defined(TECKIN_SP21)
  1127. setSetting("board", 100);
  1128. setSetting("ledGPIO", 0, 2);
  1129. setSetting("ledLogic", 0, 1);
  1130. setSetting("btnGPIO", 0, 13);
  1131. setSetting("btnRelay", 0, 0);
  1132. setSetting("relayGPIO", 0, 15);
  1133. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  1134. #elif defined(TFLAG_NX_SMX00)
  1135. setSetting("board", 101);
  1136. setSetting("ledGPIO", 0, 0);
  1137. setSetting("ledLogic", 0, 1);
  1138. setSetting("ledMode", 0, LED_MODE_FOLLOW_INVERSE);
  1139. setSetting("ledRelay", 0, 0);
  1140. setSetting("ledGPIO", 1, 15);
  1141. setSetting("ledLogic", 1, 1);
  1142. setSetting("ledMode", 1, LED_MODE_WIFI);
  1143. setSetting("btnGPIO", 0, 13);
  1144. setSetting("btnRelay", 0, 0);
  1145. setSetting("relayGPIO", 0, 12);
  1146. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  1147. setSetting("selGPIO", 16);
  1148. setSetting("cf1GPIO", 14);
  1149. setSetting("cfGPIO", 5);
  1150. setSetting("pwrRatioC", 632);
  1151. setSetting("pwrRatioV", 313400);
  1152. setSetting("pwrRatioP", 3711185);
  1153. setSetting("hlwSelC", LOW);
  1154. setSetting("hlwIntM", FALLING);
  1155. #elif defined(MUVIT_IO_MIOBULB001)
  1156. setSetting("board", 102);
  1157. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  1158. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  1159. setSetting("chGPIO", 0, 14);
  1160. setSetting("chGPIO", 1, 12);
  1161. setSetting("chGPIO", 2, 13);
  1162. setSetting("chGPIO", 3, 4);
  1163. setSetting("chLogic", 0, 0);
  1164. setSetting("chLogic", 1, 0);
  1165. setSetting("chLogic", 2, 0);
  1166. setSetting("chLogic", 3, 0);
  1167. setSetting("relays", 1);
  1168. #elif defined(LINKSPRITE_LINKNODE_R4)
  1169. setSetting("board", 104);
  1170. setSetting("relayGPIO", 0, 12);
  1171. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  1172. setSetting("relayGPIO", 1, 13);
  1173. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  1174. setSetting("relayGPIO", 2, 14);
  1175. setSetting("relayType", 2, RELAY_TYPE_NORMAL);
  1176. setSetting("relayGPIO", 3, 16);
  1177. setSetting("relayType", 4, RELAY_TYPE_NORMAL);
  1178. #elif defined(GENERIC_E14)
  1179. setSetting("board", 104);
  1180. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  1181. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  1182. setSetting("chGPIO", 0, 4);
  1183. setSetting("chGPIO", 1, 12);
  1184. setSetting("chGPIO", 2, 14);
  1185. setSetting("chGPIO", 3, 5);
  1186. setSetting("chLogic", 0, 0);
  1187. setSetting("chLogic", 1, 0);
  1188. setSetting("chLogic", 2, 0);
  1189. setSetting("chLogic", 3, 0);
  1190. setSetting("relays", 1);
  1191. #elif defined(DELTACO_SH_P01)
  1192. setSetting("board", 105);
  1193. setSetting("ledGPIO", 0, 5);
  1194. setSetting("ledLogic", 0, 1);
  1195. setSetting("ledMode", 0, LED_MODE_FOLLOW);
  1196. setSetting("btnGPIO", 0, 13);
  1197. setSetting("btnRelay", 0, 0);
  1198. setSetting("relayGPIO", 0, 12);
  1199. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  1200. #elif defined(DELTACO_SH_P03USB)
  1201. setSetting("board", 106);
  1202. setSetting("btnGPIO", 0, 13);
  1203. setSetting("btnRelay", 0, 2);
  1204. setSetting("ledGPIO", 0, 0);
  1205. setSetting("ledLogic", 0, 1);
  1206. setSetting("ledMode", 0, LED_MODE_FINDME);
  1207. setSetting("relayGPIO", 0, 15);
  1208. setSetting("relayGPIO", 1, 12);
  1209. setSetting("relayGPIO", 2, 14);
  1210. setSetting("relayGPIO", 3, 5);
  1211. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  1212. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  1213. setSetting("relayType", 2, RELAY_TYPE_NORMAL);
  1214. setSetting("relayType", 3, RELAY_TYPE_NORMAL);
  1215. #elif defined(DELTACO_SH_LEXXW)
  1216. setSetting("board", 107);
  1217. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  1218. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  1219. setSetting("chGPIO", 0, 12);
  1220. setSetting("chGPIO", 1, 14);
  1221. setSetting("chLogic", 0, 0);
  1222. setSetting("chLogic", 1, 0);
  1223. setSetting("relays", 1);
  1224. #elif defined(DELTACO_SH_LEXXRGB)
  1225. setSetting("board", 108);
  1226. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  1227. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  1228. setSetting("chGPIO", 0, 5);
  1229. setSetting("chGPIO", 1, 4);
  1230. setSetting("chGPIO", 2, 13);
  1231. setSetting("chGPIO", 3, 14);
  1232. setSetting("chGPIO", 4, 12);
  1233. setSetting("chLogic", 0, 0);
  1234. setSetting("chLogic", 1, 0);
  1235. setSetting("chLogic", 2, 0);
  1236. setSetting("chLogic", 3, 0);
  1237. setSetting("chLogic", 4, 0);
  1238. setSetting("relays", 1);
  1239. #else
  1240. // Allow users to define new settings without migration config
  1241. //#error "UNSUPPORTED HARDWARE!"
  1242. #endif
  1243. }
  1244. saveSettings();
  1245. }