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.

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