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.

727 lines
26 KiB

6 years ago
  1. /*
  2. MIGRATE MODULE
  3. Copyright (C) 2016-2018 by Xose Pérez <xose dot perez at gmail dot com>
  4. */
  5. void _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(MAGICHOME_LED_CONTROLLER)
  212. setSetting("board", 21);
  213. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  214. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  215. setSetting("ledGPIO", 0, 2);
  216. setSetting("ledLogic", 0, 1);
  217. setSetting("chGPIO", 0, 14);
  218. setSetting("chGPIO", 1, 5);
  219. setSetting("chGPIO", 2, 12);
  220. setSetting("chGPIO", 3, 13);
  221. setSetting("chLogic", 0, 0);
  222. setSetting("chLogic", 1, 0);
  223. setSetting("chLogic", 2, 0);
  224. setSetting("chLogic", 3, 0);
  225. setSetting("relays", 1);
  226. #elif defined(MAGICHOME_LED_CONTROLLER_IR)
  227. setSetting("board", 21);
  228. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  229. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  230. setSetting("ledGPIO", 0, 2);
  231. setSetting("ledLogic", 0, 1);
  232. setSetting("chGPIO", 0, 5);
  233. setSetting("chGPIO", 1, 12);
  234. setSetting("chGPIO", 2, 13);
  235. setSetting("chGPIO", 3, 14);
  236. setSetting("chLogic", 0, 0);
  237. setSetting("chLogic", 1, 0);
  238. setSetting("chLogic", 2, 0);
  239. setSetting("chLogic", 3, 0);
  240. setSetting("relays", 1);
  241. #elif defined(ITEAD_MOTOR)
  242. setSetting("board", 22);
  243. setSetting("ledGPIO", 0, 13);
  244. setSetting("ledLogic", 0, 1);
  245. setSetting("btnGPIO", 0, 0);
  246. setSetting("btnRelay", 0, 0);
  247. setSetting("relayGPIO", 0, 12);
  248. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  249. #elif defined(TINKERMAN_ESPURNA_H06)
  250. setSetting("board", 23);
  251. setSetting("ledGPIO", 0, 5);
  252. setSetting("ledLogic", 0, 0);
  253. setSetting("btnGPIO", 0, 4);
  254. setSetting("btnRelay", 0, 0);
  255. setSetting("relayGPIO", 0, 12);
  256. setSetting("relayType", 0, RELAY_TYPE_INVERSE);
  257. setSetting("selGPIO", 2);
  258. setSetting("cf1GPIO", 13);
  259. setSetting("cfGPIO", 14);
  260. #elif defined(HUACANXING_H801)
  261. setSetting("board", 24);
  262. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  263. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  264. setSetting("ledGPIO", 0, 5);
  265. setSetting("ledLogic", 0, 1);
  266. setSetting("chGPIO", 0, 15);
  267. setSetting("chGPIO", 1, 13);
  268. setSetting("chGPIO", 2, 12);
  269. setSetting("chGPIO", 3, 14);
  270. setSetting("chGPIO", 4, 4);
  271. setSetting("chLogic", 0, 0);
  272. setSetting("chLogic", 1, 0);
  273. setSetting("chLogic", 2, 0);
  274. setSetting("chLogic", 3, 0);
  275. setSetting("chLogic", 4, 0);
  276. setSetting("relays", 1);
  277. #elif defined(ITEAD_BNSZ01)
  278. setSetting("board", 25);
  279. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  280. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  281. setSetting("ledGPIO", 0, 13);
  282. setSetting("ledLogic", 0, 1);
  283. setSetting("chGPIO", 0, 12);
  284. setSetting("chLogic", 0, 0);
  285. setSetting("relays", 1);
  286. #elif defined(ITEAD_SONOFF_RFBRIDGE)
  287. setSetting("board", 26);
  288. setSetting("ledGPIO", 0, 13);
  289. setSetting("ledLogic", 0, 1);
  290. setSetting("btnGPIO", 0, 0);
  291. setSetting("relayProvider", RELAY_PROVIDER_RFBRIDGE);
  292. setSetting("relays", 6);
  293. #elif defined(ITEAD_SONOFF_4CH_PRO)
  294. setSetting("board", 27);
  295. setSetting("ledGPIO", 0, 13);
  296. setSetting("ledLogic", 0, 1);
  297. setSetting("btnGPIO", 0, 0);
  298. setSetting("btnGPIO", 1, 9);
  299. setSetting("btnGPIO", 2, 10);
  300. setSetting("btnGPIO", 3, 14);
  301. setSetting("btnRelay", 0, 0);
  302. setSetting("btnRelay", 1, 1);
  303. setSetting("btnRelay", 2, 2);
  304. setSetting("btnRelay", 3, 3);
  305. setSetting("relayGPIO", 0, 12);
  306. setSetting("relayGPIO", 1, 5);
  307. setSetting("relayGPIO", 2, 4);
  308. setSetting("relayGPIO", 3, 15);
  309. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  310. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  311. setSetting("relayType", 2, RELAY_TYPE_NORMAL);
  312. setSetting("relayType", 3, RELAY_TYPE_NORMAL);
  313. #elif defined(ITEAD_SONOFF_B1)
  314. setSetting("board", 28);
  315. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  316. setSetting("lightProvider", LIGHT_PROVIDER_MY92XX);
  317. setSetting("myModel", MY92XX_MODEL_MY9231);
  318. setSetting("myChips", 2);
  319. setSetting("myDIGPIO", 12);
  320. setSetting("myDCKIGPIO", 14);
  321. setSetting("relays", 1);
  322. #elif defined(ITEAD_SONOFF_LED)
  323. setSetting("board", 29);
  324. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  325. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  326. setSetting("ledGPIO", 0, 13);
  327. setSetting("ledLogic", 0, 1);
  328. setSetting("chGPIO", 0, 12);
  329. setSetting("chLogic", 0, 0);
  330. setSetting("chGPIO", 1, 14);
  331. setSetting("chLogic", 1, 0);
  332. setSetting("relays", 1);
  333. #elif defined(ITEAD_SONOFF_T1_1CH)
  334. setSetting("board", 30);
  335. setSetting("ledGPIO", 0, 13);
  336. setSetting("ledLogic", 0, 1);
  337. setSetting("btnGPIO", 0, 9);
  338. setSetting("btnRelay", 0, 0);
  339. setSetting("relayGPIO", 0, 5);
  340. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  341. #elif defined(ITEAD_SONOFF_T1_2CH)
  342. setSetting("board", 31);
  343. setSetting("ledGPIO", 0, 13);
  344. setSetting("ledLogic", 0, 1);
  345. setSetting("btnGPIO", 0, 0);
  346. setSetting("btnGPIO", 1, 10);
  347. setSetting("btnRelay", 0, 0);
  348. setSetting("btnRelay", 1, 1);
  349. setSetting("relayGPIO", 0, 12);
  350. setSetting("relayGPIO", 1, 4);
  351. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  352. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  353. #elif defined(ITEAD_SONOFF_T1_3CH)
  354. setSetting("board", 32);
  355. setSetting("ledGPIO", 0, 13);
  356. setSetting("ledLogic", 0, 1);
  357. setSetting("btnGPIO", 0, 0);
  358. setSetting("btnGPIO", 1, 9);
  359. setSetting("btnGPIO", 2, 10);
  360. setSetting("btnRelay", 0, 0);
  361. setSetting("btnRelay", 1, 1);
  362. setSetting("btnRelay", 2, 2);
  363. setSetting("relayGPIO", 0, 12);
  364. setSetting("relayGPIO", 1, 5);
  365. setSetting("relayGPIO", 2, 4);
  366. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  367. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  368. setSetting("relayType", 2, RELAY_TYPE_NORMAL);
  369. #elif defined(ITEAD_SONOFF_RF)
  370. setSetting("board", 33);
  371. setSetting("ledGPIO", 0, 13);
  372. setSetting("ledLogic", 0, 1);
  373. setSetting("btnGPIO", 0, 0);
  374. setSetting("btnRelay", 0, 0);
  375. setSetting("relayGPIO", 0, 12);
  376. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  377. #elif defined(WION_50055)
  378. setSetting("board", 34);
  379. setSetting("ledGPIO", 0, 2);
  380. setSetting("ledLogic", 0, 0);
  381. setSetting("btnGPIO", 0, 13);
  382. setSetting("btnRelay", 0, 0);
  383. setSetting("relayGPIO", 0, 15);
  384. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  385. #elif defined(EXS_WIFI_RELAY_V31)
  386. setSetting("board", 35);
  387. setSetting("btnGPIO", 0, 0);
  388. setSetting("btnRelay", 0, 0);
  389. setSetting("relayGPIO", 0, 13);
  390. setSetting("relayResetGPIO", 0, 12);
  391. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  392. #elif defined(HUACANXING_H802)
  393. setSetting("board", 36);
  394. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  395. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  396. setSetting("chGPIO", 0, 12);
  397. setSetting("chGPIO", 1, 14);
  398. setSetting("chGPIO", 2, 13);
  399. setSetting("chGPIO", 3, 15);
  400. setSetting("chLogic", 0, 0);
  401. setSetting("chLogic", 1, 0);
  402. setSetting("chLogic", 2, 0);
  403. setSetting("chLogic", 3, 0);
  404. setSetting("relays", 1);
  405. #elif defined(GENERIC_V9261F)
  406. setSetting("board", 37);
  407. #elif defined(GENERIC_ECH1560)
  408. setSetting("board", 38);
  409. #elif defined(TINKERMAN_ESPURNA_H08)
  410. setSetting("board", 39);
  411. setSetting("ledGPIO", 0, 2);
  412. setSetting("ledLogic", 0, 0);
  413. setSetting("btnGPIO", 0, 4);
  414. setSetting("btnRelay", 0, 0);
  415. setSetting("relayGPIO", 0, 12);
  416. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  417. setSetting("selGPIO", 5);
  418. setSetting("cf1GPIO", 13);
  419. setSetting("cfGPIO", 14);
  420. #elif defined(MANCAVEMADE_ESPLIVE)
  421. setSetting("board", 40);
  422. setSetting("btnGPIO", 0, 4);
  423. setSetting("btnGPIO", 1, 5);
  424. setSetting("btnRelay", 0, 0);
  425. setSetting("btnRelay", 1, 1);
  426. setSetting("relayGPIO", 0, 12);
  427. setSetting("relayGPIO", 1, 13);
  428. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  429. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  430. #elif defined(INTERMITTECH_QUINLED)
  431. setSetting("board", 41);
  432. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  433. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  434. setSetting("ledGPIO", 0, 1);
  435. setSetting("ledLogic", 0, 1);
  436. setSetting("chGPIO", 0, 0);
  437. setSetting("chGPIO", 1, 2);
  438. setSetting("chLogic", 0, 0);
  439. setSetting("chLogic", 1, 0);
  440. setSetting("relays", 1);
  441. #elif defined(MAGICHOME_LED_CONTROLLER_20)
  442. setSetting("board", 42);
  443. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  444. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  445. setSetting("chGPIO", 0, 5);
  446. setSetting("chGPIO", 1, 12);
  447. setSetting("chGPIO", 2, 13);
  448. setSetting("chGPIO", 3, 15);
  449. setSetting("chLogic", 0, 0);
  450. setSetting("chLogic", 1, 0);
  451. setSetting("chLogic", 2, 0);
  452. setSetting("chLogic", 3, 0);
  453. setSetting("relays", 1);
  454. #elif defined(ARILUX_AL_LC06)
  455. setSetting("board", 43);
  456. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  457. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  458. setSetting("chGPIO", 0, 12);
  459. setSetting("chGPIO", 1, 14);
  460. setSetting("chGPIO", 2, 13);
  461. setSetting("chGPIO", 3, 15);
  462. setSetting("chGPIO", 4, 5);
  463. setSetting("chLogic", 0, 0);
  464. setSetting("chLogic", 1, 0);
  465. setSetting("chLogic", 2, 0);
  466. setSetting("chLogic", 3, 0);
  467. setSetting("chLogic", 4, 0);
  468. setSetting("relays", 1);
  469. #elif defined(XENON_SM_PW702U)
  470. setSetting("board", 44);
  471. setSetting("ledGPIO", 0, 4);
  472. setSetting("ledLogic", 0, 0);
  473. setSetting("btnGPIO", 0, 13);
  474. setSetting("btnRelay", 0, 0);
  475. setSetting("relayGPIO", 0, 12);
  476. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  477. #elif defined(AUTHOMETION_LYT8266)
  478. setSetting("board", 45);
  479. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  480. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  481. setSetting("chGPIO", 0, 13);
  482. setSetting("chGPIO", 1, 12);
  483. setSetting("chGPIO", 2, 14);
  484. setSetting("chGPIO", 3, 2);
  485. setSetting("chLogic", 0, 0);
  486. setSetting("chLogic", 1, 0);
  487. setSetting("chLogic", 2, 0);
  488. setSetting("chLogic", 3, 0);
  489. setSetting("relays", 1);
  490. setSetting("enGPIO", 15);
  491. #elif defined(ARILUX_E27)
  492. setSetting("board", 46);
  493. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  494. setSetting("lightProvider", LIGHT_PROVIDER_MY92XX);
  495. setSetting("myModel", MY92XX_MODEL_MY9291);
  496. setSetting("myChips", 1);
  497. setSetting("myDIGPIO", 13);
  498. setSetting("myDCKIGPIO", 15);
  499. setSetting("relays", 1);
  500. #elif defined(YJZK_SWITCH_2CH)
  501. setSetting("board", 47);
  502. setSetting("ledGPIO", 0, 13);
  503. setSetting("ledLogic", 0, 0);
  504. setSetting("ledWifi", 0);
  505. setSetting("btnGPIO", 0, 0);
  506. setSetting("btnGPIO", 1, 9);
  507. setSetting("btnRelay", 0, 0);
  508. setSetting("btnRelay", 1, 1);
  509. setSetting("relayGPIO", 0, 12);
  510. setSetting("relayGPIO", 1, 5);
  511. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  512. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  513. #elif defined(ITEAD_SONOFF_DUAL_R2)
  514. setSetting("board", 48);
  515. setSetting("ledGPIO", 0, 13);
  516. setSetting("ledLogic", 0, 1);
  517. setSetting("btnGPIO", 0, 0);
  518. setSetting("btnGPIO", 1, 9);
  519. setSetting("btnGPIO", 2, 10);
  520. setSetting("btnRelay", 0, 0);
  521. setSetting("btnRelay", 1, 1);
  522. setSetting("btnRelay", 2, 0);
  523. setSetting("relayGPIO", 0, 12);
  524. setSetting("relayGPIO", 1, 5);
  525. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  526. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  527. #elif defined(GENERIC_8CH)
  528. setSetting("board", 49);
  529. setSetting("relayGPIO", 0, 0);
  530. setSetting("relayGPIO", 1, 2);
  531. setSetting("relayGPIO", 2, 4);
  532. setSetting("relayGPIO", 3, 5);
  533. setSetting("relayGPIO", 4, 12);
  534. setSetting("relayGPIO", 5, 13);
  535. setSetting("relayGPIO", 6, 14);
  536. setSetting("relayGPIO", 7, 15);
  537. setSetting("relayType", 0, RELAY_TYPE_NORMAL);
  538. setSetting("relayType", 1, RELAY_TYPE_NORMAL);
  539. setSetting("relayType", 2, RELAY_TYPE_NORMAL);
  540. setSetting("relayType", 3, RELAY_TYPE_NORMAL);
  541. setSetting("relayType", 4, RELAY_TYPE_NORMAL);
  542. setSetting("relayType", 5, RELAY_TYPE_NORMAL);
  543. setSetting("relayType", 6, RELAY_TYPE_NORMAL);
  544. setSetting("relayType", 7, RELAY_TYPE_NORMAL);
  545. #elif defined(ARILUX_AL_LC01)
  546. setSetting("board", 50);
  547. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  548. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  549. setSetting("chGPIO", 0, 5);
  550. setSetting("chGPIO", 1, 12);
  551. setSetting("chGPIO", 2, 13);
  552. setSetting("chGPIO", 3, 14);
  553. setSetting("chLogic", 0, 0);
  554. setSetting("chLogic", 1, 0);
  555. setSetting("chLogic", 2, 0);
  556. setSetting("chLogic", 3, 0);
  557. setSetting("relays", 1);
  558. #elif defined(ARILUX_AL_LC11)
  559. setSetting("board", 51);
  560. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  561. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  562. setSetting("chGPIO", 0, 5);
  563. setSetting("chGPIO", 1, 4);
  564. setSetting("chGPIO", 2, 14);
  565. setSetting("chGPIO", 3, 13);
  566. setSetting("chGPIO", 4, 12);
  567. setSetting("chLogic", 0, 0);
  568. setSetting("chLogic", 1, 0);
  569. setSetting("chLogic", 2, 0);
  570. setSetting("chLogic", 3, 0);
  571. setSetting("chLogic", 4, 0);
  572. setSetting("relays", 1);
  573. #elif defined(ARILUX_AL_LC02)
  574. setSetting("board", 52);
  575. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  576. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  577. setSetting("chGPIO", 0, 12);
  578. setSetting("chGPIO", 1, 5);
  579. setSetting("chGPIO", 2, 13);
  580. setSetting("chGPIO", 3, 15);
  581. setSetting("chLogic", 0, 0);
  582. setSetting("chLogic", 1, 0);
  583. setSetting("chLogic", 2, 0);
  584. setSetting("chLogic", 3, 0);
  585. setSetting("relays", 1);
  586. #elif defined(MAGICHOME_LED_CONTROLLER_23)
  587. setSetting("board", 53);
  588. setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
  589. setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
  590. setSetting("chGPIO", 0, 12);
  591. setSetting("chGPIO", 1, 5);
  592. setSetting("chGPIO", 2, 13);
  593. setSetting("chGPIO", 3, 15);
  594. setSetting("chLogic", 0, 0);
  595. setSetting("chLogic", 1, 0);
  596. setSetting("chLogic", 2, 0);
  597. setSetting("chLogic", 3, 0);
  598. setSetting("relays", 1);
  599. #else
  600. // Allow users to define new settings without migration config
  601. //#error "UNSUPPORTED HARDWARE!"
  602. #endif
  603. }
  604. saveSettings();
  605. }