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.

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