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.

708 lines
16 KiB

Rework settings (#2282) * wip based on early draft. todo benchmarking * fixup eraser, assume keys are unique * fix cursor copy, test removal at random * small benchmark via permutations. todo lambdas and novirtual * fix empty condition / reset * overwrite optimizations, fix move offsets overflows * ...erase using 0xff instead of 0 * test the theory with code, different length kv were bugged * try to check for out-of-bounds writes / reads * style * trying to fix mover again * clarify length, defend against reading len on edge * fix uncommited rewind change * prove space assumptions * more concise traces, fix move condition (agrh!!!) * slightly more internal knowledge (estimates API?) * make sure cursor is only valid within the range * ensure 0 does not blow things * go back up * cursor comments * comments * rewrite writes through cursor * in del too * estimate kv storage requirements, return available size * move raw erase / move into a method, allow ::set to avoid scanning storage twice * refactor naming, use in code * amend storage slicing test * fix crash handler offsets, cleanup configuration * start -> begin * eeprom readiness * dependencies * unused * SPI_FLASH constants for older Core * vtables -> templates * less include dependencies * gcov help, move estimate outside of the class * writer position can never match, use begin + offset * tweak save_crash to trigger only once in a serious crash * doh, header function should be inline * foreach api, tweak structs for public api * use test helper class * when not using foreach, move cursor reset closer to the loop using read_kv * coverage comments, fix typo in tests decltype * ensure set() does not break with offset * make codacy happy again
4 years ago
  1. /*
  2. BOARD MODULE
  3. */
  4. #include "espurna.h"
  5. #include "relay.h"
  6. #include "sensor.h"
  7. //--------------------------------------------------------------------------------
  8. PROGMEM const char espurna_modules[] =
  9. #if ALEXA_SUPPORT
  10. "ALEXA "
  11. #endif
  12. #if API_SUPPORT
  13. "API "
  14. #endif
  15. #if BROKER_SUPPORT
  16. "BROKER "
  17. #endif
  18. #if BUTTON_SUPPORT
  19. "BUTTON "
  20. #endif
  21. #if DEBUG_SERIAL_SUPPORT
  22. "DEBUG_SERIAL "
  23. #endif
  24. #if DEBUG_TELNET_SUPPORT
  25. "DEBUG_TELNET "
  26. #endif
  27. #if DEBUG_UDP_SUPPORT
  28. "DEBUG_UDP "
  29. #endif
  30. #if DEBUG_WEB_SUPPORT
  31. "DEBUG_WEB "
  32. #endif
  33. #if DOMOTICZ_SUPPORT
  34. "DOMOTICZ "
  35. #endif
  36. #if ENCODER_SUPPORT
  37. "ENCODER "
  38. #endif
  39. #if FAN_SUPPORT
  40. "FAN "
  41. #endif
  42. #if HOMEASSISTANT_SUPPORT
  43. "HOMEASSISTANT "
  44. #endif
  45. #if I2C_SUPPORT
  46. "I2C "
  47. #endif
  48. #if INFLUXDB_SUPPORT
  49. "INFLUXDB "
  50. #endif
  51. #if IR_SUPPORT
  52. "IR "
  53. #endif
  54. #if LED_SUPPORT
  55. "LED "
  56. #endif
  57. #if LLMNR_SUPPORT
  58. "LLMNR "
  59. #endif
  60. #if MDNS_CLIENT_SUPPORT
  61. "MDNS_CLIENT "
  62. #endif
  63. #if MDNS_SERVER_SUPPORT
  64. "MDNS_SERVER "
  65. #endif
  66. #if MQTT_SUPPORT
  67. "MQTT "
  68. #endif
  69. #if NETBIOS_SUPPORT
  70. "NETBIOS "
  71. #endif
  72. #if NOFUSS_SUPPORT
  73. "NOFUSS "
  74. #endif
  75. #if NTP_SUPPORT
  76. "NTP "
  77. #endif
  78. #if PROMETHEUS_SUPPORT
  79. "METRICS "
  80. #endif
  81. #if RELAY_SUPPORT
  82. "RELAY "
  83. #endif
  84. #if RFM69_SUPPORT
  85. "RFM69 "
  86. #endif
  87. #if RFB_SUPPORT
  88. "RFB "
  89. #endif
  90. #if RPN_RULES_SUPPORT
  91. "RPN_RULES "
  92. #endif
  93. #if SCHEDULER_SUPPORT
  94. "SCHEDULER "
  95. #endif
  96. #if SENSOR_SUPPORT
  97. "SENSOR "
  98. #endif
  99. #if SPIFFS_SUPPORT
  100. "SPIFFS "
  101. #endif
  102. #if SSDP_SUPPORT
  103. "SSDP "
  104. #endif
  105. #if TELNET_SUPPORT
  106. #if TELNET_SERVER == TELNET_SERVER_WIFISERVER
  107. "TELNET_SYNC "
  108. #else
  109. "TELNET "
  110. #endif // TELNET_SERVER == TELNET_SERVER_WIFISERVER
  111. #endif
  112. #if TERMINAL_SUPPORT
  113. "TERMINAL "
  114. #endif
  115. #if GARLAND_SUPPORT
  116. "GARLAND "
  117. #endif
  118. #if THERMOSTAT_SUPPORT
  119. "THERMOSTAT "
  120. #endif
  121. #if THERMOSTAT_DISPLAY_SUPPORT
  122. "THERMOSTAT_DISPLAY "
  123. #endif
  124. #if THINGSPEAK_SUPPORT
  125. "THINGSPEAK "
  126. #endif
  127. #if UART_MQTT_SUPPORT
  128. "UART_MQTT "
  129. #endif
  130. #if WEB_SUPPORT
  131. "WEB "
  132. #endif
  133. "";
  134. PROGMEM const char espurna_ota_modules[] =
  135. #if OTA_ARDUINOOTA_SUPPORT
  136. "ARDUINO "
  137. #endif
  138. #if (OTA_CLIENT == OTA_CLIENT_ASYNCTCP)
  139. "ASYNCTCP "
  140. #endif
  141. #if (OTA_CLIENT == OTA_CLIENT_HTTPUPDATE)
  142. #if (SECURE_CLIENT == SECURE_CLIENT_NONE)
  143. "*HTTPUPDATE "
  144. #endif
  145. #if (SECURE_CLIENT == SECURE_CLIENT_AXTLS)
  146. "*HTTPUPDATE_AXTLS "
  147. #endif
  148. #if (SECURE_CLIENT == SECURE_CLIENT_BEARSSL)
  149. "*HTTPUPDATE_BEARSSL "
  150. #endif
  151. #endif // OTA_CLIENT_HTTPUPDATE
  152. #if OTA_MQTT_SUPPORT
  153. "MQTT "
  154. #endif
  155. #if WEB_SUPPORT
  156. "WEB "
  157. #endif
  158. "";
  159. PROGMEM const char espurna_webui[] =
  160. #if WEBUI_IMAGE == WEBUI_IMAGE_SMALL
  161. "SMALL"
  162. #endif
  163. #if WEBUI_IMAGE == WEBUI_IMAGE_LIGHT
  164. "LIGHT"
  165. #endif
  166. #if WEBUI_IMAGE == WEBUI_IMAGE_SENSOR
  167. "SENSOR"
  168. #endif
  169. #if WEBUI_IMAGE == WEBUI_IMAGE_RFBRIDGE
  170. "RFBRIDGE"
  171. #endif
  172. #if WEBUI_IMAGE == WEBUI_IMAGE_RFM69
  173. "RFM69"
  174. #endif
  175. #if WEBUI_IMAGE == WEBUI_IMAGE_LIGHTFOX
  176. "LIGHTFOX"
  177. #endif
  178. #if WEBUI_IMAGE == WEBUI_IMAGE_GARLAND
  179. "GARLAND"
  180. #endif
  181. #if WEBUI_IMAGE == WEBUI_IMAGE_THERMOSTAT
  182. "THERMOSTAT"
  183. #endif
  184. #if WEBUI_IMAGE == WEBUI_IMAGE_CURTAIN
  185. "CURTAIN"
  186. #endif
  187. #if WEBUI_IMAGE == WEBUI_IMAGE_FULL
  188. "FULL"
  189. #endif
  190. "";
  191. #if SENSOR_SUPPORT
  192. PROGMEM const char espurna_sensors[] =
  193. #if AM2320_SUPPORT
  194. "AM2320_I2C "
  195. #endif
  196. #if ANALOG_SUPPORT
  197. "ANALOG "
  198. #endif
  199. #if BH1750_SUPPORT
  200. "BH1750 "
  201. #endif
  202. #if BMP180_SUPPORT
  203. "BMP180 "
  204. #endif
  205. #if BMX280_SUPPORT
  206. "BMX280 "
  207. #endif
  208. #if BME680_SUPPORT
  209. "BME680 "
  210. #endif
  211. #if CSE7766_SUPPORT
  212. "CSE7766 "
  213. #endif
  214. #if DALLAS_SUPPORT
  215. "DALLAS "
  216. #endif
  217. #if DHT_SUPPORT
  218. "DHTXX "
  219. #endif
  220. #if DIGITAL_SUPPORT
  221. "DIGITAL "
  222. #endif
  223. #if ECH1560_SUPPORT
  224. "ECH1560 "
  225. #endif
  226. #if EMON_ADC121_SUPPORT
  227. "EMON_ADC121 "
  228. #endif
  229. #if EMON_ADS1X15_SUPPORT
  230. "EMON_ADX1X15 "
  231. #endif
  232. #if EMON_ANALOG_SUPPORT
  233. "EMON_ANALOG "
  234. #endif
  235. #if EVENTS_SUPPORT
  236. "EVENTS "
  237. #endif
  238. #if GEIGER_SUPPORT
  239. "GEIGER "
  240. #endif
  241. #if GUVAS12SD_SUPPORT
  242. "GUVAS12SD "
  243. #endif
  244. #if HLW8012_SUPPORT
  245. "HLW8012 "
  246. #endif
  247. #if LDR_SUPPORT
  248. "LDR "
  249. #endif
  250. #if MHZ19_SUPPORT
  251. "MHZ19 "
  252. #endif
  253. #if MICS2710_SUPPORT
  254. "MICS2710 "
  255. #endif
  256. #if MICS5525_SUPPORT
  257. "MICS5525 "
  258. #endif
  259. #if NTC_SUPPORT
  260. "NTC "
  261. #endif
  262. #if PMSX003_SUPPORT
  263. "PMSX003 "
  264. #endif
  265. #if PULSEMETER_SUPPORT
  266. "PULSEMETER "
  267. #endif
  268. #if PZEM004T_SUPPORT
  269. "PZEM004T "
  270. #endif
  271. #if SDS011_SUPPORT
  272. "SDS011 "
  273. #endif
  274. #if SENSEAIR_SUPPORT
  275. "SENSEAIR "
  276. #endif
  277. #if SHT3X_I2C_SUPPORT
  278. "SHT3X_I2C "
  279. #endif
  280. #if SI7021_SUPPORT
  281. "SI7021 "
  282. #endif
  283. #if SONAR_SUPPORT
  284. "SONAR "
  285. #endif
  286. #if T6613_SUPPORT
  287. "T6613 "
  288. #endif
  289. #if TMP3X_SUPPORT
  290. "TMP3X "
  291. #endif
  292. #if V9261F_SUPPORT
  293. "V9261F "
  294. #endif
  295. #if VEML6075_SUPPORT
  296. "VEML6075 "
  297. #endif
  298. #if VL53L1X_SUPPORT
  299. "VL53L1X "
  300. #endif
  301. #if EZOPH_SUPPORT
  302. "EZOPH "
  303. #endif
  304. #if ADE7953_SUPPORT
  305. "ADE7953 "
  306. #endif
  307. #if SI1145_SUPPORT
  308. "SI1145 "
  309. #endif
  310. "";
  311. #endif // SENSOR_SUPPORT == 1
  312. //--------------------------------------------------------------------------------
  313. const String& getChipId() {
  314. static String value;
  315. if (!value.length()) {
  316. char buffer[7];
  317. value.reserve(sizeof(buffer));
  318. snprintf_P(buffer, sizeof(buffer), PSTR("%06X"), ESP.getChipId());
  319. value = buffer;
  320. }
  321. return value;
  322. }
  323. const String& getIdentifier() {
  324. static String value;
  325. if (!value.length()) {
  326. value += APP_NAME;
  327. value += '-';
  328. value += getChipId();
  329. }
  330. return value;
  331. }
  332. String getEspurnaModules() {
  333. return FPSTR(espurna_modules);
  334. }
  335. String getEspurnaOTAModules() {
  336. return FPSTR(espurna_ota_modules);
  337. }
  338. #if SENSOR_SUPPORT
  339. String getEspurnaSensors() {
  340. return FPSTR(espurna_sensors);
  341. }
  342. #endif // SENSOR_SUPPORT == 1
  343. String getEspurnaWebUI() {
  344. return FPSTR(espurna_webui);
  345. }
  346. bool isEspurnaCore() {
  347. #if defined(ESPURNA_CORE) || defined(ESPURNA_CORE_WEBUI)
  348. return true;
  349. #else
  350. return false;
  351. #endif
  352. }
  353. bool haveRelaysOrSensors() {
  354. bool result = false;
  355. result = (relayCount() > 0);
  356. #if SENSOR_SUPPORT
  357. result = result || (magnitudeCount() > 0);
  358. #endif
  359. return result;
  360. }
  361. int getBoardId() {
  362. #if defined(ESPURNA_CORE) || defined(ESPURNA_CORE_WEBUI)
  363. return 0;
  364. #elif defined(NODEMCU_LOLIN)
  365. return 2;
  366. #elif defined(NODEMCU_BASIC)
  367. return 3;
  368. #elif defined(WEMOS_D1_MINI)
  369. return 4;
  370. #elif defined(WEMOS_D1_MINI_RELAYSHIELD)
  371. return 5;
  372. #elif defined(WEMOS_D1_TARPUNA_SHIELD)
  373. return 6;
  374. #elif defined(TINKERMAN_ESPURNA_H06)
  375. return 7;
  376. #elif defined(TINKERMAN_ESPURNA_H08)
  377. return 8;
  378. #elif defined(TINKERMAN_ESPURNA_SWITCH)
  379. return 9;
  380. #elif defined(TINKERMAN_RFM69GW)
  381. return 10;
  382. #elif defined(ITEAD_SONOFF_BASIC)
  383. return 11;
  384. #elif defined(ITEAD_SONOFF_RF)
  385. return 12;
  386. #elif defined(ITEAD_SONOFF_MINI)
  387. return 13;
  388. #elif defined(ITEAD_SONOFF_TH)
  389. return 14;
  390. #elif defined(ITEAD_SONOFF_SV)
  391. return 15;
  392. #elif defined(ITEAD_SLAMPHER)
  393. return 16;
  394. #elif defined(ITEAD_S20)
  395. return 17;
  396. #elif defined(ITEAD_SONOFF_TOUCH)
  397. return 18;
  398. #elif defined(ITEAD_SONOFF_POW)
  399. return 19;
  400. #elif defined(ITEAD_SONOFF_POW_R2)
  401. return 20;
  402. #elif defined(ITEAD_SONOFF_DUAL)
  403. return 21;
  404. #elif defined(ITEAD_SONOFF_DUAL_R2)
  405. return 22;
  406. #elif defined(ITEAD_SONOFF_4CH)
  407. return 23;
  408. #elif defined(ITEAD_SONOFF_4CH_PRO)
  409. return 24;
  410. #elif defined(ITEAD_1CH_INCHING)
  411. return 25;
  412. #elif defined(ITEAD_MOTOR)
  413. return 26;
  414. #elif defined(ITEAD_BNSZ01)
  415. return 27;
  416. #elif defined(ITEAD_SONOFF_RFBRIDGE)
  417. return 28;
  418. #elif defined(ITEAD_SONOFF_B1)
  419. return 29;
  420. #elif defined(ITEAD_SONOFF_LED)
  421. return 30;
  422. #elif defined(ITEAD_SONOFF_T1_1CH)
  423. return 31;
  424. #elif defined(ITEAD_SONOFF_T1_2CH)
  425. return 32;
  426. #elif defined(ITEAD_SONOFF_T1_3CH)
  427. return 33;
  428. #elif defined(ITEAD_SONOFF_S31)
  429. return 34;
  430. #elif defined(ITEAD_SONOFF_S31_LITE)
  431. return 35;
  432. #elif defined(ITEAD_SONOFF_IFAN02)
  433. return 36;
  434. #elif defined(ORVIBO_B25)
  435. return 37;
  436. #elif defined(YJZK_SWITCH_1CH)
  437. return 38;
  438. #elif defined(YJZK_SWITCH_2CH)
  439. return 39;
  440. #elif defined(YJZK_SWITCH_3CH)
  441. return 40;
  442. #elif defined(ELECTRODRAGON_WIFI_IOT)
  443. return 41;
  444. #elif defined(WORKCHOICE_ECOPLUG)
  445. return 42;
  446. #elif defined(AITHINKER_AI_LIGHT)
  447. return 43;
  448. #elif defined(LYASI_LIGHT)
  449. return 44;
  450. #elif defined(MAGICHOME_LED_CONTROLLER)
  451. return 45;
  452. #elif defined(MAGICHOME_LED_CONTROLLER_20)
  453. return 46;
  454. #elif defined(MAGICHOME_ZJ_WFMN_A_11)
  455. return 47;
  456. #elif defined(MAGICHOME_ZJ_WFMN_B_11)
  457. return 48;
  458. #elif defined(MAGICHOME_ZJ_WFMN_C_11)
  459. return 49;
  460. #elif defined(MAGICHOME_ZJ_ESPM_5CH_B_13)
  461. return 50;
  462. #elif defined(MAGICHOME_ZJ_LB_RGBWW_L)
  463. return 51;
  464. #elif defined(HUACANXING_H801)
  465. return 52;
  466. #elif defined(HUACANXING_H802)
  467. return 53;
  468. #elif defined(JANGOE_WIFI_RELAY_NC)
  469. return 54;
  470. #elif defined(JANGOE_WIFI_RELAY_NO)
  471. return 55;
  472. #elif defined(JORGEGARCIA_WIFI_RELAYS)
  473. return 56;
  474. #elif defined(OPENENERGYMONITOR_MQTT_RELAY)
  475. return 57;
  476. #elif defined(WION_50055)
  477. return 58;
  478. #elif defined(EXS_WIFI_RELAY_V31)
  479. return 59;
  480. #elif defined(EXS_WIFI_RELAY_V50)
  481. return 60;
  482. #elif defined(GENERIC_V9261F)
  483. return 61;
  484. #elif defined(GENERIC_ECH1560)
  485. return 62;
  486. #elif defined(MANCAVEMADE_ESPLIVE)
  487. return 63;
  488. #elif defined(INTERMITTECH_QUINLED)
  489. return 64;
  490. #elif defined(ARILUX_AL_LC01)
  491. return 65;
  492. #elif defined(ARILUX_AL_LC02)
  493. return 66;
  494. #elif defined(ARILUX_AL_LC02_V14)
  495. return 67;
  496. #elif defined(ARILUX_AL_LC06)
  497. return 68;
  498. #elif defined(ARILUX_AL_LC11)
  499. return 69;
  500. #elif defined(ARILUX_E27)
  501. return 70;
  502. #elif defined(XENON_SM_PW702U)
  503. return 71;
  504. #elif defined(ISELECTOR_SM_PW702)
  505. return 72;
  506. #elif defined(AUTHOMETION_LYT8266)
  507. return 73;
  508. #elif defined(GIZWITS_WITTY_CLOUD)
  509. return 74;
  510. #elif defined(KMC_70011)
  511. return 75;
  512. #elif defined(EUROMATE_WIFI_STECKER_SCHUKO)
  513. return 76;
  514. #elif defined(EUROMATE_WIFI_STECKER_SCHUKO_V2)
  515. return 77;
  516. #elif defined(GENERIC_8CH)
  517. return 78;
  518. #elif defined(STM_RELAY)
  519. return 79;
  520. #elif defined(TONBUX_POWERSTRIP02)
  521. return 80;
  522. #elif defined(LINGAN_SWA1)
  523. return 81;
  524. #elif defined(HEYGO_HY02)
  525. return 82;
  526. #elif defined(MAXCIO_WUS002S)
  527. return 83;
  528. #elif defined(MAXCIO_WDE004)
  529. return 84;
  530. #elif defined(OUKITEL_P1)
  531. return 85;
  532. #elif defined(YIDIAN_XSSSA05)
  533. return 86;
  534. #elif defined(TONBUX_XSSSA01)
  535. return 87;
  536. #elif defined(TONBUX_XSSSA06)
  537. return 88;
  538. #elif defined(GREEN_ESP8266RELAY)
  539. return 89;
  540. #elif defined(IKE_ESPIKE)
  541. return 90;
  542. #elif defined(ARNIEX_SWIFITCH)
  543. return 91;
  544. #elif defined(GENERIC_ESP01S_RELAY_V40)
  545. return 92;
  546. #elif defined(GENERIC_ESP01S_RGBLED_V10)
  547. return 93;
  548. #elif defined(GENERIC_ESP01S_DHT11_V10)
  549. return 94;
  550. #elif defined(GENERIC_ESP01S_DS18B20_V10)
  551. return 95;
  552. #elif defined(PILOTAK_ESP_DIN_V1)
  553. return 96;
  554. #elif defined(HELTEC_TOUCHRELAY)
  555. return 97;
  556. #elif defined(ZHILDE_44EU_W)
  557. return 98;
  558. #elif defined(ALLNET_4DUINO_IOT_WLAN_RELAIS)
  559. return 99;
  560. #elif defined(LUANI_HVIO)
  561. return 100;
  562. #elif defined(TONBUX_MOSQUITO_KILLER)
  563. return 101;
  564. #elif defined(NEO_COOLCAM_NAS_WR01W)
  565. return 102;
  566. #elif defined(DELTACO_SH_P01)
  567. return 103;
  568. #elif defined(DELTACO_SH_P03USB)
  569. return 104;
  570. #elif defined(FORNORM_ZLD_34EU)
  571. return 105;
  572. #elif defined(BH_ONOFRE)
  573. return 106;
  574. #elif defined(BLITZWOLF_BWSHPX)
  575. return 107;
  576. #elif defined(BLITZWOLF_BWSHPX_V23)
  577. return 108;
  578. #elif defined(BLITZWOLF_BWSHP5)
  579. return 109;
  580. #elif defined(TECKIN_SP21)
  581. return 110;
  582. #elif defined(TECKIN_SP22_V14)
  583. return 111;
  584. #elif defined(GOSUND_WS1)
  585. return 112;
  586. #elif defined(HOMECUBE_16A)
  587. return 113;
  588. #elif defined(VANZAVANZU_SMART_WIFI_PLUG_MINI)
  589. return 114;
  590. #elif defined(GENERIC_AG_L4)
  591. return 115;
  592. #elif defined(ALLTERCO_SHELLY1)
  593. return 116;
  594. #elif defined(ALLTERCO_SHELLY2)
  595. return 117;
  596. #elif defined(ALLTERCO_SHELLY1PM)
  597. return 118;
  598. #elif defined(ALLTERCO_SHELLY25)
  599. return 119;
  600. #elif defined(LOHAS_E27_9W)
  601. return 120;
  602. #elif defined(LOHAS_E26_A19)
  603. return 121;
  604. #elif defined(TECKIN_SB53)
  605. return 122;
  606. #elif defined(XIAOMI_SMART_DESK_LAMP)
  607. return 123;
  608. #elif defined(PHYX_ESP12_RGB)
  609. return 124;
  610. #elif defined(IWOOLE_LED_TABLE_LAMP)
  611. return 125;
  612. #elif defined(GENERIC_GU10)
  613. return 126;
  614. #elif defined(GENERIC_E14)
  615. return 127;
  616. #elif defined(DELTACO_SH_LEXXW)
  617. return 128;
  618. #elif defined(DELTACO_SH_LEXXRGB)
  619. return 129;
  620. #elif defined(NEXETE_A19)
  621. return 130;
  622. #elif defined(LOMBEX_LUX_NOVA2_TUNABLE_WHITE)
  623. return 131;
  624. #elif defined(LOMBEX_LUX_NOVA2_WHITE_COLOR)
  625. return 132;
  626. #elif defined(BESTEK_MRJ1011)
  627. return 133;
  628. #elif defined(GBLIFE_RGBW_SOCKET)
  629. return 134;
  630. #elif defined(SMARTLIFE_MINI_SMART_SOCKET)
  631. return 135;
  632. #elif defined(HAMA_WIFI_STECKDOSE_00176533)
  633. return 136;
  634. #elif defined(DIGOO_NX_SP202)
  635. return 137;
  636. #elif defined(FOXEL_LIGHTFOX_DUAL)
  637. return 138;
  638. #elif defined(TECKIN_SP20)
  639. return 139;
  640. #elif defined(LITESUN_LA_WF3)
  641. return 140;
  642. #elif defined(PSH_WIFI_PLUG)
  643. return 141;
  644. #elif defined(PSH_RGBW_CONTROLLER)
  645. return 142;
  646. #elif defined(PSH_WIFI_SENSOR)
  647. return 143;
  648. #elif defined(JINVOO_VALVE_SM_AW713)
  649. return 144;
  650. #elif defined(TUYA_GENERIC_DIMMER)
  651. return 145;
  652. #elif defined(ETEKCITY_ESW01_USA)
  653. return 146;
  654. #elif defined(FS_UAP1)
  655. return 147;
  656. #elif defined(TFLAG_NX_SMX00)
  657. return 148;
  658. #elif defined(MUVIT_IO_MIOBULB001)
  659. return 149;
  660. #elif defined(HYKKER_SMART_HOME_POWER_PLUG)
  661. return 150;
  662. #elif defined(KOGAN_SMARTER_HOME_PLUG_W_POW)
  663. return 151;
  664. #elif defined(LSC_SMART_LED_LIGHT_STRIP)
  665. return 152;
  666. #elif defined(EHOMEDIY_WT02)
  667. return 153;
  668. #elif defined(EHOMEDIY_WT03)
  669. return 154;
  670. #elif defined(LINKSPRITE_LINKNODE_R4)
  671. return 155;
  672. #elif defined(GENERIC_ESP01_512KB)
  673. return 156;
  674. #elif defined(GOSUND_WP3)
  675. return 157;
  676. #elif defined(GENERIC_AG_L4_V3)
  677. return 158;
  678. #elif defined(PRODINO_WIFI)
  679. return 159;
  680. #elif defined(GOSUND_SP111)
  681. return 160;
  682. #elif defined(GOSUND_P1)
  683. return 161;
  684. #else
  685. return -1; // CUSTOM
  686. #endif
  687. }