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.

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