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.

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