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.

359 lines
9.4 KiB

  1. /*
  2. BOARD MODULE
  3. */
  4. #include "board.h"
  5. String getIdentifier() {
  6. char buffer[20];
  7. snprintf_P(buffer, sizeof(buffer), PSTR("%s-%06X"), APP_NAME, ESP.getChipId());
  8. return String(buffer);
  9. }
  10. String getEspurnaModules() {
  11. return FPSTR(espurna_modules);
  12. }
  13. String getEspurnaOTAModules() {
  14. return FPSTR(espurna_ota_modules);
  15. }
  16. #if SENSOR_SUPPORT
  17. String getEspurnaSensors() {
  18. return FPSTR(espurna_sensors);
  19. }
  20. #endif
  21. String getEspurnaWebUI() {
  22. return FPSTR(espurna_webui);
  23. }
  24. bool haveRelaysOrSensors() {
  25. bool result = false;
  26. result = (relayCount() > 0);
  27. #if SENSOR_SUPPORT
  28. result = result || (magnitudeCount() > 0);
  29. #endif
  30. return result;
  31. }
  32. int getBoardId() {
  33. #if defined(ESPURNA_CORE)
  34. return 0;
  35. #elif defined(ESPURNA_BASE)
  36. return 1;
  37. #elif defined(NODEMCU_LOLIN)
  38. return 2;
  39. #elif defined(NODEMCU_BASIC)
  40. return 3;
  41. #elif defined(WEMOS_D1_MINI)
  42. return 4;
  43. #elif defined(WEMOS_D1_MINI_RELAYSHIELD)
  44. return 5;
  45. #elif defined(WEMOS_D1_TARPUNA_SHIELD)
  46. return 6;
  47. #elif defined(TINKERMAN_ESPURNA_H06)
  48. return 7;
  49. #elif defined(TINKERMAN_ESPURNA_H08)
  50. return 8;
  51. #elif defined(TINKERMAN_ESPURNA_SWITCH)
  52. return 9;
  53. #elif defined(TINKERMAN_RFM69GW)
  54. return 10;
  55. #elif defined(ITEAD_SONOFF_BASIC)
  56. return 11;
  57. #elif defined(ITEAD_SONOFF_RF)
  58. return 12;
  59. #elif defined(ITEAD_SONOFF_MINI)
  60. return 13;
  61. #elif defined(ITEAD_SONOFF_TH)
  62. return 14;
  63. #elif defined(ITEAD_SONOFF_SV)
  64. return 15;
  65. #elif defined(ITEAD_SLAMPHER)
  66. return 16;
  67. #elif defined(ITEAD_S20)
  68. return 17;
  69. #elif defined(ITEAD_SONOFF_TOUCH)
  70. return 18;
  71. #elif defined(ITEAD_SONOFF_POW)
  72. return 19;
  73. #elif defined(ITEAD_SONOFF_POW_R2)
  74. return 20;
  75. #elif defined(ITEAD_SONOFF_DUAL)
  76. return 21;
  77. #elif defined(ITEAD_SONOFF_DUAL_R2)
  78. return 22;
  79. #elif defined(ITEAD_SONOFF_4CH)
  80. return 23;
  81. #elif defined(ITEAD_SONOFF_4CH_PRO)
  82. return 24;
  83. #elif defined(ITEAD_1CH_INCHING)
  84. return 25;
  85. #elif defined(ITEAD_MOTOR)
  86. return 26;
  87. #elif defined(ITEAD_BNSZ01)
  88. return 27;
  89. #elif defined(ITEAD_SONOFF_RFBRIDGE)
  90. return 28;
  91. #elif defined(ITEAD_SONOFF_B1)
  92. return 29;
  93. #elif defined(ITEAD_SONOFF_LED)
  94. return 30;
  95. #elif defined(ITEAD_SONOFF_T1_1CH)
  96. return 31;
  97. #elif defined(ITEAD_SONOFF_T1_2CH)
  98. return 32;
  99. #elif defined(ITEAD_SONOFF_T1_3CH)
  100. return 33;
  101. #elif defined(ITEAD_SONOFF_S31)
  102. return 34;
  103. #elif defined(ITEAD_SONOFF_S31_LITE)
  104. return 35;
  105. #elif defined(ITEAD_SONOFF_IFAN02)
  106. return 36;
  107. #elif defined(ORVIBO_B25)
  108. return 37;
  109. #elif defined(YJZK_SWITCH_1CH)
  110. return 38;
  111. #elif defined(YJZK_SWITCH_2CH)
  112. return 39;
  113. #elif defined(YJZK_SWITCH_3CH)
  114. return 40;
  115. #elif defined(ELECTRODRAGON_WIFI_IOT)
  116. return 41;
  117. #elif defined(WORKCHOICE_ECOPLUG)
  118. return 42;
  119. #elif defined(AITHINKER_AI_LIGHT)
  120. return 43;
  121. #elif defined(LYASI_LIGHT)
  122. return 44;
  123. #elif defined(MAGICHOME_LED_CONTROLLER)
  124. return 45;
  125. #elif defined(MAGICHOME_LED_CONTROLLER_20)
  126. return 46;
  127. #elif defined(MAGICHOME_ZJ_WFMN_A_11)
  128. return 47;
  129. #elif defined(MAGICHOME_ZJ_WFMN_B_11)
  130. return 48;
  131. #elif defined(MAGICHOME_ZJ_WFMN_C_11)
  132. return 49;
  133. #elif defined(MAGICHOME_ZJ_ESPM_5CH_B_13)
  134. return 50;
  135. #elif defined(MAGICHOME_ZJ_LB_RGBWW_L)
  136. return 51;
  137. #elif defined(HUACANXING_H801)
  138. return 52;
  139. #elif defined(HUACANXING_H802)
  140. return 53;
  141. #elif defined(JANGOE_WIFI_RELAY_NC)
  142. return 54;
  143. #elif defined(JANGOE_WIFI_RELAY_NO)
  144. return 55;
  145. #elif defined(JORGEGARCIA_WIFI_RELAYS)
  146. return 56;
  147. #elif defined(OPENENERGYMONITOR_MQTT_RELAY)
  148. return 57;
  149. #elif defined(WION_50055)
  150. return 58;
  151. #elif defined(EXS_WIFI_RELAY_V31)
  152. return 59;
  153. #elif defined(EXS_WIFI_RELAY_V50)
  154. return 60;
  155. #elif defined(GENERIC_V9261F)
  156. return 61;
  157. #elif defined(GENERIC_ECH1560)
  158. return 62;
  159. #elif defined(MANCAVEMADE_ESPLIVE)
  160. return 63;
  161. #elif defined(INTERMITTECH_QUINLED)
  162. return 64;
  163. #elif defined(ARILUX_AL_LC01)
  164. return 65;
  165. #elif defined(ARILUX_AL_LC02)
  166. return 66;
  167. #elif defined(ARILUX_AL_LC02_V14)
  168. return 67;
  169. #elif defined(ARILUX_AL_LC06)
  170. return 68;
  171. #elif defined(ARILUX_AL_LC11)
  172. return 69;
  173. #elif defined(ARILUX_E27)
  174. return 70;
  175. #elif defined(XENON_SM_PW702U)
  176. return 71;
  177. #elif defined(ISELECTOR_SM_PW702)
  178. return 72;
  179. #elif defined(AUTHOMETION_LYT8266)
  180. return 73;
  181. #elif defined(GIZWITS_WITTY_CLOUD)
  182. return 74;
  183. #elif defined(KMC_70011)
  184. return 75;
  185. #elif defined(EUROMATE_WIFI_STECKER_SCHUKO)
  186. return 76;
  187. #elif defined(EUROMATE_WIFI_STECKER_SCHUKO_V2)
  188. return 77;
  189. #elif defined(GENERIC_8CH)
  190. return 78;
  191. #elif defined(STM_RELAY)
  192. return 79;
  193. #elif defined(TONBUX_POWERSTRIP02)
  194. return 80;
  195. #elif defined(LINGAN_SWA1)
  196. return 81;
  197. #elif defined(HEYGO_HY02)
  198. return 82;
  199. #elif defined(MAXCIO_WUS002S)
  200. return 83;
  201. #elif defined(MAXCIO_WDE004)
  202. return 84;
  203. #elif defined(OUKITEL_P1)
  204. return 85;
  205. #elif defined(YIDIAN_XSSSA05)
  206. return 86;
  207. #elif defined(TONBUX_XSSSA01)
  208. return 87;
  209. #elif defined(TONBUX_XSSSA06)
  210. return 88;
  211. #elif defined(GREEN_ESP8266RELAY)
  212. return 89;
  213. #elif defined(IKE_ESPIKE)
  214. return 90;
  215. #elif defined(ARNIEX_SWIFITCH)
  216. return 91;
  217. #elif defined(GENERIC_ESP01S_RELAY_V40)
  218. return 92;
  219. #elif defined(GENERIC_ESP01S_RGBLED_V10)
  220. return 93;
  221. #elif defined(GENERIC_ESP01S_DHT11_V10)
  222. return 94;
  223. #elif defined(GENERIC_ESP01S_DS18B20_V10)
  224. return 95;
  225. #elif defined(PILOTAK_ESP_DIN_V1)
  226. return 96;
  227. #elif defined(HELTEC_TOUCHRELAY)
  228. return 97;
  229. #elif defined(ZHILDE_EU44_W)
  230. return 98;
  231. #elif defined(ALLNET_4DUINO_IOT_WLAN_RELAIS)
  232. return 99;
  233. #elif defined(LUANI_HVIO)
  234. return 100;
  235. #elif defined(TONBUX_MOSQUITO_KILLER)
  236. return 101;
  237. #elif defined(NEO_COOLCAM_NAS_WR01W)
  238. return 102;
  239. #elif defined(DELTACO_SH_P01)
  240. return 103;
  241. #elif defined(DELTACO_SH_P03USB)
  242. return 104;
  243. #elif defined(FORNORM_ZLD_34EU)
  244. return 105;
  245. #elif defined(BH_ONOFRE)
  246. return 106;
  247. #elif defined(BLITZWOLF_BWSHPX)
  248. return 107;
  249. #elif defined(BLITZWOLF_BWSHPX_V23)
  250. return 108;
  251. #elif defined(BLITZWOLF_BWSHP5)
  252. return 109;
  253. #elif defined(TECKIN_SP21)
  254. return 110;
  255. #elif defined(TECKIN_SP22_V14)
  256. return 111;
  257. #elif defined(GOSUND_WS1)
  258. return 112;
  259. #elif defined(HOMECUBE_16A)
  260. return 113;
  261. #elif defined(VANZAVANZU_SMART_WIFI_PLUG_MINI)
  262. return 114;
  263. #elif defined(GENERIC_AG_L4)
  264. return 115;
  265. #elif defined(ALLTERCO_SHELLY1)
  266. return 116;
  267. #elif defined(ALLTERCO_SHELLY2)
  268. return 117;
  269. #elif defined(ALLTERCO_SHELLY1PM)
  270. return 118;
  271. #elif defined(ALLTERCO_SHELLY25)
  272. return 119;
  273. #elif defined(LOHAS_E27_9W)
  274. return 120;
  275. #elif defined(LOHAS_E26_A19)
  276. return 121;
  277. #elif defined(TECKIN_SB53)
  278. return 122;
  279. #elif defined(XIAOMI_SMART_DESK_LAMP)
  280. return 123;
  281. #elif defined(PHYX_ESP12_RGB)
  282. return 124;
  283. #elif defined(IWOOLE_LED_TABLE_LAMP)
  284. return 125;
  285. #elif defined(GENERIC_GU10)
  286. return 126;
  287. #elif defined(GENERIC_E14)
  288. return 127;
  289. #elif defined(DELTACO_SH_LEXXW)
  290. return 128;
  291. #elif defined(DELTACO_SH_LEXXRGB)
  292. return 129;
  293. #elif defined(NEXETE_A19)
  294. return 130;
  295. #elif defined(LOMBEX_LUX_NOVA2_TUNABLE_WHITE)
  296. return 131;
  297. #elif defined(LOMBEX_LUX_NOVA2_WHITE_COLOR)
  298. return 132;
  299. #elif defined(BESTEK_MRJ1011)
  300. return 133;
  301. #elif defined(GBLIFE_RGBW_SOCKET)
  302. return 134;
  303. #elif defined(SMARTLIFE_MINI_SMART_SOCKET)
  304. return 135;
  305. #elif defined(HAMA_WIFI_STECKDOSE_00176533)
  306. return 136;
  307. #elif defined(DIGOO_NX_SP202)
  308. return 137;
  309. #elif defined(FOXEL_LIGHTFOX_DUAL)
  310. return 138;
  311. #elif defined(TECKIN_SP20)
  312. return 139;
  313. #elif defined(LITESUN_LA_WF3)
  314. return 140;
  315. #elif defined(PSH_WIFI_PLUG)
  316. return 141;
  317. #elif defined(PSH_RGBW_CONTROLLER)
  318. return 142;
  319. #elif defined(PSH_WIFI_SENSOR)
  320. return 143;
  321. #elif defined(JINVOO_VALVE_SM_AW713)
  322. return 144;
  323. #elif defined(TUYA_GENERIC_DIMMER)
  324. return 145;
  325. #elif defined(ETEKCITY_ESW01_USA)
  326. return 146;
  327. #elif defined(FS_UAP1)
  328. return 147;
  329. #elif defined(TFLAG_NX_SMX00)
  330. return 148;
  331. #elif defined(MUVIT_IO_MIOBULB001)
  332. return 149;
  333. #elif defined(HYKKER_SMART_HOME_POWER_PLUG)
  334. return 150;
  335. #elif defined(KOGAN_SMARTER_HOME_PLUG_W_POW)
  336. return 151;
  337. #elif defined(LSC_SMART_LED_LIGHT_STRIP)
  338. return 152;
  339. #elif defined(EHOMEDIY_WT02)
  340. return 153;
  341. #elif defined(EHOMEDIY_WT03)
  342. return 154;
  343. #elif defined(LINKSPRITE_LINKNODE_R4)
  344. return 155;
  345. #else
  346. return -1; // CUSTOM
  347. #endif
  348. }