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.

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