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.

700 lines
24 KiB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
6 years ago
  1. // =============================================================================
  2. // SENSORS - General data
  3. // =============================================================================
  4. #define SENSOR_DEBUG 0 // Debug sensors
  5. #define SENSOR_READ_INTERVAL 6 // Read data from sensors every 6 seconds
  6. #define SENSOR_READ_MIN_INTERVAL 6 // Minimum read interval
  7. #define SENSOR_READ_MAX_INTERVAL 3600 // Maximum read interval
  8. #define SENSOR_INIT_INTERVAL 10000 // Try to re-init non-ready sensors every 10s
  9. #define SENSOR_REPORT_EVERY 10 // Report every this many readings
  10. #define SENSOR_REPORT_MIN_EVERY 1 // Minimum every value
  11. #define SENSOR_REPORT_MAX_EVERY 12 // Maximum
  12. #define SENSOR_USE_INDEX 0 // Use the index in topic (i.e. temperature/0)
  13. // even if just one sensor (0 for backwards compatibility)
  14. #ifndef SENSOR_TEMPERATURE_CORRECTION
  15. #define SENSOR_TEMPERATURE_CORRECTION 0.0 // Offset correction
  16. #endif
  17. #ifndef TEMPERATURE_MIN_CHANGE
  18. #define TEMPERATURE_MIN_CHANGE 0.0 // Minimum temperature change to report
  19. #endif
  20. #ifndef HUMIDITY_MIN_CHANGE
  21. #define HUMIDITY_MIN_CHANGE 0 // Minimum humidity change to report
  22. #endif
  23. #define HUMIDITY_NORMAL 0
  24. #define HUMIDITY_COMFORTABLE 1
  25. #define HUMIDITY_DRY 2
  26. #define HUMIDITY_WET 3
  27. #define SENSOR_PUBLISH_ADDRESSES 0 // Publish sensor addresses
  28. #define SENSOR_ADDRESS_TOPIC "address" // Topic to publish sensor addresses
  29. //------------------------------------------------------------------------------
  30. // UNITS
  31. //------------------------------------------------------------------------------
  32. #define POWER_WATTS 0
  33. #define POWER_KILOWATTS 1
  34. #define ENERGY_JOULES 0
  35. #define ENERGY_KWH 1
  36. #define TMP_CELSIUS 0
  37. #define TMP_FAHRENHEIT 1
  38. #ifndef SENSOR_TEMPERATURE_UNITS
  39. #define SENSOR_TEMPERATURE_UNITS TMP_CELSIUS // Temperature units (TMP_CELSIUS | TMP_FAHRENHEIT)
  40. #endif
  41. #ifndef SENSOR_ENERGY_UNITS
  42. #define SENSOR_ENERGY_UNITS ENERGY_JOULES // Energy units (ENERGY_JOULES | ENERGY_KWH)
  43. #endif
  44. #ifndef SENSOR_POWER_UNITS
  45. #define SENSOR_POWER_UNITS POWER_WATTS // Power units (POWER_WATTS | POWER_KILOWATTS)
  46. #endif
  47. //--------------------------------------------------------------------------------
  48. // Sensor ID
  49. // These should remain over time, do not modify them, only add new ones at the end
  50. //--------------------------------------------------------------------------------
  51. #define SENSOR_DHTXX_ID 0x01
  52. #define SENSOR_DALLAS_ID 0x02
  53. #define SENSOR_EMON_ANALOG_ID 0x03
  54. #define SENSOR_EMON_ADC121_ID 0x04
  55. #define SENSOR_EMON_ADS1X15_ID 0x05
  56. #define SENSOR_HLW8012_ID 0x06
  57. #define SENSOR_V9261F_ID 0x07
  58. #define SENSOR_ECH1560_ID 0x08
  59. #define SENSOR_ANALOG_ID 0x09
  60. #define SENSOR_DIGITAL_ID 0x10
  61. #define SENSOR_EVENTS_ID 0x11
  62. #define SENSOR_PMSX003_ID 0x12
  63. #define SENSOR_BMX280_ID 0x13
  64. #define SENSOR_MHZ19_ID 0x14
  65. #define SENSOR_SI7021_ID 0x15
  66. #define SENSOR_SHT3X_I2C_ID 0x16
  67. #define SENSOR_BH1750_ID 0x17
  68. #define SENSOR_PZEM004T_ID 0x18
  69. //--------------------------------------------------------------------------------
  70. // Magnitudes
  71. //--------------------------------------------------------------------------------
  72. #define MAGNITUDE_NONE 0
  73. #define MAGNITUDE_TEMPERATURE 1
  74. #define MAGNITUDE_HUMIDITY 2
  75. #define MAGNITUDE_PRESSURE 3
  76. #define MAGNITUDE_CURRENT 4
  77. #define MAGNITUDE_VOLTAGE 5
  78. #define MAGNITUDE_POWER_ACTIVE 6
  79. #define MAGNITUDE_POWER_APPARENT 7
  80. #define MAGNITUDE_POWER_REACTIVE 8
  81. #define MAGNITUDE_POWER_FACTOR 9
  82. #define MAGNITUDE_ENERGY 10
  83. #define MAGNITUDE_ENERGY_DELTA 11
  84. #define MAGNITUDE_ANALOG 12
  85. #define MAGNITUDE_DIGITAL 13
  86. #define MAGNITUDE_EVENTS 14
  87. #define MAGNITUDE_PM1dot0 15
  88. #define MAGNITUDE_PM2dot5 16
  89. #define MAGNITUDE_PM10 17
  90. #define MAGNITUDE_CO2 18
  91. #define MAGNITUDE_LUX 19
  92. #define MAGNITUDE_MAX 20
  93. // =============================================================================
  94. // Specific data for each sensor
  95. // =============================================================================
  96. //------------------------------------------------------------------------------
  97. // Analog sensor
  98. // Enable support by passing ANALOG_SUPPORT=1 build flag
  99. //--------------------------------------------------------------------------------
  100. #ifndef ANALOG_SUPPORT
  101. #define ANALOG_SUPPORT 0
  102. #endif
  103. #if ANALOG_SUPPORT
  104. #undef ADC_VCC_ENABLED
  105. #define ADC_VCC_ENABLED 0
  106. #endif
  107. //------------------------------------------------------------------------------
  108. // BH1750
  109. // Enable support by passing BH1750_SUPPORT=1 build flag
  110. // http://www.elechouse.com/elechouse/images/product/Digital%20light%20Sensor/bh1750fvi-e.pdf
  111. //------------------------------------------------------------------------------
  112. #ifndef BH1750_SUPPORT
  113. #define BH1750_SUPPORT 0
  114. #endif
  115. #ifndef BH1750_ADDRESS
  116. #define BH1750_ADDRESS 0x00 // 0x00 means auto
  117. #endif
  118. #define BH1750_MODE BH1750_CONTINUOUS_HIGH_RES_MODE
  119. #if BH1750_SUPPORT
  120. #undef I2C_SUPPORT
  121. #define I2C_SUPPORT 1
  122. #endif
  123. //------------------------------------------------------------------------------
  124. // BME280/BMP280
  125. // Enable support by passing BMX280_SUPPORT=1 build flag
  126. //------------------------------------------------------------------------------
  127. #ifndef BMX280_SUPPORT
  128. #define BMX280_SUPPORT 0
  129. #endif
  130. #ifndef BMX280_ADDRESS
  131. #define BMX280_ADDRESS 0x00 // 0x00 means auto
  132. #endif
  133. #define BMX280_MODE 1 // 0 for sleep mode, 1 or 2 for forced mode, 3 for normal mode
  134. #define BMX280_STANDBY 0 // 0 for 0.5ms, 1 for 62.5ms, 2 for 125ms
  135. // 3 for 250ms, 4 for 500ms, 5 for 1000ms
  136. // 6 for 10ms, 7 for 20ms
  137. #define BMX280_FILTER 0 // 0 for OFF, 1 for 2 values, 2 for 4 values, 3 for 8 values and 4 for 16 values
  138. #define BMX280_TEMPERATURE 1 // Oversampling for temperature (set to 0 to disable magnitude)
  139. #define BMX280_HUMIDITY 1 // Oversampling for humidity (set to 0 to disable magnitude, only for BME280)
  140. #define BMX280_PRESSURE 1 // Oversampling for pressure (set to 0 to disable magnitude)
  141. #if BMX280_SUPPORT
  142. #undef I2C_SUPPORT
  143. #define I2C_SUPPORT 1
  144. #endif
  145. //------------------------------------------------------------------------------
  146. // Dallas OneWire temperature sensors
  147. // Enable support by passing DALLAS_SUPPORT=1 build flag
  148. //------------------------------------------------------------------------------
  149. #ifndef DALLAS_SUPPORT
  150. #define DALLAS_SUPPORT 0
  151. #endif
  152. #ifndef DALLAS_PIN
  153. #define DALLAS_PIN 14
  154. #endif
  155. #define DALLAS_RESOLUTION 9 // Not used atm
  156. #define DALLAS_READ_INTERVAL 2000 // Force sensor read & cache every 2 seconds
  157. //------------------------------------------------------------------------------
  158. // DHTXX temperature/humidity sensor
  159. // Enable support by passing DHT_SUPPORT=1 build flag
  160. //------------------------------------------------------------------------------
  161. #ifndef DHT_SUPPORT
  162. #define DHT_SUPPORT 0
  163. #endif
  164. #ifndef DHT_PIN
  165. #define DHT_PIN 14
  166. #endif
  167. #ifndef DHT_TYPE
  168. #define DHT_TYPE DHT_CHIP_DHT22
  169. #endif
  170. //------------------------------------------------------------------------------
  171. // Digital sensor
  172. // Enable support by passing DIGITAL_SUPPORT=1 build flag
  173. //------------------------------------------------------------------------------
  174. #ifndef DIGITAL_SUPPORT
  175. #define DIGITAL_SUPPORT 0
  176. #endif
  177. #ifndef DIGITAL_PIN
  178. #define DIGITAL_PIN 2
  179. #endif
  180. #ifndef DIGITAL_PIN_MODE
  181. #define DIGITAL_PIN_MODE INPUT_PULLUP
  182. #endif
  183. #ifndef DIGITAL_DEFAULT_STATE
  184. #define DIGITAL_DEFAULT_STATE 1
  185. #endif
  186. //------------------------------------------------------------------------------
  187. // ECH1560 based power sensor
  188. // Enable support by passing ECH1560_SUPPORT=1 build flag
  189. //------------------------------------------------------------------------------
  190. #ifndef ECH1560_SUPPORT
  191. #define ECH1560_SUPPORT 0
  192. #endif
  193. #ifndef ECH1560_CLK_PIN
  194. #define ECH1560_CLK_PIN 4 // CLK pin for the ECH1560
  195. #endif
  196. #ifndef ECH1560_MISO_PIN
  197. #define ECH1560_MISO_PIN 5 // MISO pin for the ECH1560
  198. #endif
  199. #ifndef ECH1560_INVERTED
  200. #define ECH1560_INVERTED 0 // Signal is inverted
  201. #endif
  202. //------------------------------------------------------------------------------
  203. // Energy Monitor general settings
  204. //------------------------------------------------------------------------------
  205. #define EMON_MAX_SAMPLES 1000 // Max number of samples to get
  206. #define EMON_MAX_TIME 250 // Max time in ms to sample
  207. #define EMON_FILTER_SPEED 512 // Mobile average filter speed
  208. #define EMON_MAINS_VOLTAGE 230 // Mains voltage
  209. #define EMON_REFERENCE_VOLTAGE 3.3 // Reference voltage of the ADC
  210. #define EMON_CURRENT_RATIO 30 // Current ratio in the clamp (30V/1A)
  211. #define EMON_REPORT_CURRENT 0 // Report current
  212. #define EMON_REPORT_POWER 1 // Report power
  213. #define EMON_REPORT_ENERGY 1 // Report energy
  214. //------------------------------------------------------------------------------
  215. // Energy Monitor based on ADC121
  216. // Enable support by passing EMON_ADC121_SUPPORT=1 build flag
  217. //------------------------------------------------------------------------------
  218. #ifndef EMON_ADC121_SUPPORT
  219. #define EMON_ADC121_SUPPORT 0 // Do not build support by default
  220. #endif
  221. #define EMON_ADC121_I2C_ADDRESS 0x00 // 0x00 means auto
  222. #if EMON_ADC121_SUPPORT
  223. #undef I2C_SUPPORT
  224. #define I2C_SUPPORT 1
  225. #endif
  226. //------------------------------------------------------------------------------
  227. // Energy Monitor based on ADS1X15
  228. // Enable support by passing EMON_ADS1X15_SUPPORT=1 build flag
  229. //------------------------------------------------------------------------------
  230. #ifndef EMON_ADS1X15_SUPPORT
  231. #define EMON_ADS1X15_SUPPORT 0 // Do not build support by default
  232. #endif
  233. #define EMON_ADS1X15_I2C_ADDRESS 0x00 // 0x00 means auto
  234. #define EMON_ADS1X15_TYPE ADS1X15_CHIP_ADS1115
  235. #define EMON_ADS1X15_GAIN ADS1X15_REG_CONFIG_PGA_4_096V
  236. #define EMON_ADS1X15_MASK 0x0F // A0=1 A1=2 A2=4 A3=8
  237. #if EMON_ADS1X15_SUPPORT
  238. #undef I2C_SUPPORT
  239. #define I2C_SUPPORT 1
  240. #endif
  241. //------------------------------------------------------------------------------
  242. // Energy Monitor based on interval analog GPIO
  243. // Enable support by passing EMON_ANALOG_SUPPORT=1 build flag
  244. //------------------------------------------------------------------------------
  245. #ifndef EMON_ANALOG_SUPPORT
  246. #define EMON_ANALOG_SUPPORT 0 // Do not build support by default
  247. #endif
  248. #if EMON_ANALOG_SUPPORT
  249. #undef ADC_VCC_ENABLED
  250. #define ADC_VCC_ENABLED 0
  251. #endif
  252. //------------------------------------------------------------------------------
  253. // Counter sensor
  254. // Enable support by passing EVENTS_SUPPORT=1 build flag
  255. //------------------------------------------------------------------------------
  256. #ifndef EVENTS_SUPPORT
  257. #define EVENTS_SUPPORT 0 // Do not build with counter support by default
  258. #endif
  259. #ifndef EVENTS_PIN
  260. #define EVENTS_PIN 2 // GPIO to monitor
  261. #endif
  262. #ifndef EVENTS_PIN_MODE
  263. #define EVENTS_PIN_MODE INPUT // INPUT, INPUT_PULLUP
  264. #endif
  265. #ifndef EVENTS_INTERRUPT_MODE
  266. #define EVENTS_INTERRUPT_MODE RISING // RISING, FALLING, BOTH
  267. #endif
  268. #define EVENTS_DEBOUNCE 50 // Do not register events within less than 10 millis
  269. //------------------------------------------------------------------------------
  270. // HLW8012 Energy monitor IC
  271. // Enable support by passing HLW8012_SUPPORT=1 build flag
  272. //------------------------------------------------------------------------------
  273. #ifndef HLW8012_SUPPORT
  274. #define HLW8012_SUPPORT 0
  275. #endif
  276. #ifndef HLW8012_SEL_PIN
  277. #define HLW8012_SEL_PIN 5
  278. #endif
  279. #ifndef HLW8012_CF1_PIN
  280. #define HLW8012_CF1_PIN 13
  281. #endif
  282. #ifndef HLW8012_CF_PIN
  283. #define HLW8012_CF_PIN 14
  284. #endif
  285. #ifndef HLW8012_SEL_CURRENT
  286. #define HLW8012_SEL_CURRENT HIGH // SEL pin to HIGH to measure current
  287. #endif
  288. #ifndef HLW8012_CURRENT_R
  289. #define HLW8012_CURRENT_R 0.001 // Current resistor
  290. #endif
  291. #ifndef HLW8012_VOLTAGE_R_UP
  292. #define HLW8012_VOLTAGE_R_UP ( 5 * 470000 ) // Upstream voltage resistor
  293. #endif
  294. #ifndef HLW8012_VOLTAGE_R_DOWN
  295. #define HLW8012_VOLTAGE_R_DOWN ( 1000 ) // Downstream voltage resistor
  296. #endif
  297. #define HLW8012_USE_INTERRUPTS 1 // Use interrupts to trap HLW8012 signals
  298. //------------------------------------------------------------------------------
  299. // MHZ19 CO2 sensor
  300. // Enable support by passing MHZ19_SUPPORT=1 build flag
  301. //------------------------------------------------------------------------------
  302. #ifndef MHZ19_SUPPORT
  303. #define MHZ19_SUPPORT 0
  304. #endif
  305. #define MHZ19_RX_PIN 13
  306. #define MHZ19_TX_PIN 15
  307. //------------------------------------------------------------------------------
  308. // Particle Monitor based on Plantower PMSX003
  309. // Enable support by passing PMSX003_SUPPORT=1 build flag
  310. //------------------------------------------------------------------------------
  311. #ifndef PMSX003_SUPPORT
  312. #define PMSX003_SUPPORT 0
  313. #endif
  314. #define PMS_RX_PIN 13
  315. #define PMS_TX_PIN 15
  316. //------------------------------------------------------------------------------
  317. // PZEM004T based power monitor
  318. // Enable support by passing PZEM004T_SUPPORT=1 build flag
  319. //------------------------------------------------------------------------------
  320. #ifndef PZEM004T_SUPPORT
  321. #define PZEM004T_SUPPORT 0
  322. #endif
  323. #ifndef PZEM004T_USE_SOFT
  324. #define PZEM004T_USE_SOFT 1 // Use software serial
  325. #endif
  326. #ifndef PZEM004T_RX_PIN
  327. #define PZEM004T_RX_PIN 13 // Software serial RX GPIO (if PZEM004T_USE_SOFT == 1)
  328. #endif
  329. #ifndef PZEM004T_TX_PIN
  330. #define PZEM004T_TX_PIN 15 // Software serial TX GPIO (if PZEM004T_USE_SOFT == 1)
  331. #endif
  332. #ifndef PZEM004T_HW_PORT
  333. #define PZEM004T_HW_PORT Serial1 // Hardware serial port (if PZEM004T_USE_SOFT == 0)
  334. #endif
  335. //------------------------------------------------------------------------------
  336. // SHT3X I2C (Wemos) temperature & humidity sensor
  337. // Enable support by passing SHT3X_SUPPORT=1 build flag
  338. //------------------------------------------------------------------------------
  339. #ifndef SHT3X_I2C_SUPPORT
  340. #define SHT3X_I2C_SUPPORT 0
  341. #endif
  342. #ifndef SHT3X_I2C_ADDRESS
  343. #define SHT3X_I2C_ADDRESS 0x00 // 0x00 means auto
  344. #endif
  345. #if SHT3X_I2C_SUPPORT
  346. #undef I2C_SUPPORT
  347. #define I2C_SUPPORT 1
  348. #endif
  349. //------------------------------------------------------------------------------
  350. // SI7021 temperature & humidity sensor
  351. // Enable support by passing SI7021_SUPPORT=1 build flag
  352. //------------------------------------------------------------------------------
  353. #ifndef SI7021_SUPPORT
  354. #define SI7021_SUPPORT 0
  355. #endif
  356. #ifndef SI7021_ADDRESS
  357. #define SI7021_ADDRESS 0x00 // 0x00 means auto
  358. #endif
  359. #if SI7021_SUPPORT
  360. #undef I2C_SUPPORT
  361. #define I2C_SUPPORT 1
  362. #endif
  363. //------------------------------------------------------------------------------
  364. // V9261F based power sensor
  365. // Enable support by passing SI7021_SUPPORT=1 build flag
  366. //------------------------------------------------------------------------------
  367. #ifndef V9261F_SUPPORT
  368. #define V9261F_SUPPORT 0
  369. #endif
  370. #ifndef V9261F_PIN
  371. #define V9261F_PIN 2 // TX pin from the V9261F
  372. #endif
  373. #ifndef V9261F_PIN_INVERSE
  374. #define V9261F_PIN_INVERSE 1 // Signal is inverted
  375. #endif
  376. #define V9261F_SYNC_INTERVAL 600 // Sync signal length (ms)
  377. #define V9261F_BAUDRATE 4800 // UART baudrate
  378. // Default ratios
  379. #define V9261F_CURRENT_FACTOR 79371434.0
  380. #define V9261F_VOLTAGE_FACTOR 4160651.0
  381. #define V9261F_POWER_FACTOR 153699.0
  382. #define V9261F_RPOWER_FACTOR V9261F_CURRENT_FACTOR
  383. // =============================================================================
  384. // Sensor helpers configuration
  385. // =============================================================================
  386. #ifndef SENSOR_SUPPORT
  387. #if ANALOG_SUPPORT || BH1750_SUPPORT || BMX280_SUPPORT || DALLAS_SUPPORT \
  388. || DHT_SUPPORT || DIGITAL_SUPPORT || ECH1560_SUPPORT \
  389. || EMON_ADC121_SUPPORT || EMON_ADS1X15_SUPPORT \
  390. || EMON_ANALOG_SUPPORT || EVENTS_SUPPORT || HLW8012_SUPPORT \
  391. || MHZ19_SUPPORT || PMSX003_SUPPORT || SHT3X_I2C_SUPPORT \
  392. || SI7021_SUPPORT || V9261F_SUPPORT
  393. #define SENSOR_SUPPORT 1
  394. #else
  395. #define SENSOR_SUPPORT 0
  396. #endif
  397. #endif
  398. // -----------------------------------------------------------------------------
  399. // I2C
  400. // -----------------------------------------------------------------------------
  401. #ifndef I2C_SUPPORT
  402. #define I2C_SUPPORT 0 // I2C enabled (1.98Kb)
  403. #endif
  404. #define I2C_USE_BRZO 0 // Use brzo_i2c library or standard Wire
  405. #ifndef I2C_SDA_PIN
  406. #define I2C_SDA_PIN SDA // SDA GPIO (Sonoff => 4)
  407. #endif
  408. #ifndef I2C_SCL_PIN
  409. #define I2C_SCL_PIN SCL // SCL GPIO (Sonoff => 14)
  410. #endif
  411. #define I2C_CLOCK_STRETCH_TIME 200 // BRZO clock stretch time
  412. #define I2C_SCL_FREQUENCY 1000 // BRZO SCL frequency
  413. #define I2C_CLEAR_BUS 0 // Clear I2C bus on boot
  414. #define I2C_PERFORM_SCAN 1 // Perform a bus scan on boot
  415. //--------------------------------------------------------------------------------
  416. // Internal power monitor
  417. // Enable support by passing ADC_VCC_ENABLED=1 build flag
  418. // Do not enable this if using the analog GPIO for any other thing
  419. //--------------------------------------------------------------------------------
  420. #ifndef ADC_VCC_ENABLED
  421. #define ADC_VCC_ENABLED 1
  422. #endif
  423. #if ADC_VCC_ENABLED
  424. ADC_MODE(ADC_VCC);
  425. #endif
  426. //--------------------------------------------------------------------------------
  427. // Class loading
  428. //--------------------------------------------------------------------------------
  429. #if SENSOR_SUPPORT
  430. PROGMEM const unsigned char magnitude_decimals[] = {
  431. 0,
  432. 1, 0, 2,
  433. 3, 0, 0, 0, 0, 0, 0, 0,
  434. 0, 0, 0,
  435. 0, 0, 0,
  436. 0, 0
  437. };
  438. PROGMEM const char magnitude_unknown_topic[] = "unknown";
  439. PROGMEM const char magnitude_temperature_topic[] = "temperature";
  440. PROGMEM const char magnitude_humidity_topic[] = "humidity";
  441. PROGMEM const char magnitude_pressure_topic[] = "pressure";
  442. PROGMEM const char magnitude_current_topic[] = "current";
  443. PROGMEM const char magnitude_voltage_topic[] = "voltage";
  444. PROGMEM const char magnitude_active_power_topic[] = "power";
  445. PROGMEM const char magnitude_apparent_power_topic[] = "apparent";
  446. PROGMEM const char magnitude_reactive_power_topic[] = "reactive";
  447. PROGMEM const char magnitude_power_factor_topic[] = "factor";
  448. PROGMEM const char magnitude_energy_topic[] = "energy";
  449. PROGMEM const char magnitude_energy_delta_topic[] = "energy_delta";
  450. PROGMEM const char magnitude_analog_topic[] = "analog";
  451. PROGMEM const char magnitude_digital_topic[] = "digital";
  452. PROGMEM const char magnitude_events_topic[] = "events";
  453. PROGMEM const char magnitude_pm1dot0_topic[] = "pm1dot0";
  454. PROGMEM const char magnitude_pm2dot5_topic[] = "pm2dot5";
  455. PROGMEM const char magnitude_pm10_topic[] = "pm10";
  456. PROGMEM const char magnitude_co2_topic[] = "co2";
  457. PROGMEM const char magnitude_lux_topic[] = "lux";
  458. PROGMEM const char* const magnitude_topics[] = {
  459. magnitude_unknown_topic, magnitude_temperature_topic, magnitude_humidity_topic,
  460. magnitude_pressure_topic, magnitude_current_topic, magnitude_voltage_topic,
  461. magnitude_active_power_topic, magnitude_apparent_power_topic, magnitude_reactive_power_topic,
  462. magnitude_power_factor_topic, magnitude_energy_topic, magnitude_energy_delta_topic,
  463. magnitude_analog_topic, magnitude_digital_topic, magnitude_events_topic,
  464. magnitude_pm1dot0_topic, magnitude_pm2dot5_topic, magnitude_pm10_topic,
  465. magnitude_co2_topic, magnitude_lux_topic
  466. };
  467. PROGMEM const char magnitude_empty[] = "";
  468. PROGMEM const char magnitude_celsius[] = "C";
  469. PROGMEM const char magnitude_fahrenheit[] = "F";
  470. PROGMEM const char magnitude_percentage[] = "%";
  471. PROGMEM const char magnitude_hectopascals[] = "hPa";
  472. PROGMEM const char magnitude_amperes[] = "A";
  473. PROGMEM const char magnitude_volts[] = "V";
  474. PROGMEM const char magnitude_watts[] = "W";
  475. PROGMEM const char magnitude_kw[] = "kW";
  476. PROGMEM const char magnitude_joules[] = "J";
  477. PROGMEM const char magnitude_kwh[] = "kWh";
  478. PROGMEM const char magnitude_ugm3[] = "µg/m3";
  479. PROGMEM const char magnitude_ppm[] = "ppm";
  480. PROGMEM const char magnitude_lux[] = "lux";
  481. PROGMEM const char* const magnitude_units[] = {
  482. magnitude_empty, magnitude_celsius, magnitude_percentage,
  483. magnitude_hectopascals, magnitude_amperes, magnitude_volts,
  484. magnitude_watts, magnitude_watts, magnitude_watts,
  485. magnitude_percentage, magnitude_joules, magnitude_joules,
  486. magnitude_empty, magnitude_empty, magnitude_empty,
  487. magnitude_ugm3, magnitude_ugm3, magnitude_ugm3,
  488. magnitude_ppm, magnitude_lux
  489. };
  490. #include "../sensors/BaseSensor.h"
  491. #if ANALOG_SUPPORT
  492. #include "../sensors/AnalogSensor.h"
  493. #endif
  494. #if BH1750_SUPPORT
  495. #include "../sensors/BH1750Sensor.h"
  496. #endif
  497. #if BMX280_SUPPORT
  498. #include <SparkFunBME280.h>
  499. #include "../sensors/BMX280Sensor.h"
  500. #endif
  501. #if DALLAS_SUPPORT
  502. #include <OneWire.h>
  503. #include "../sensors/DallasSensor.h"
  504. #endif
  505. #if DHT_SUPPORT
  506. #include "../sensors/DHTSensor.h"
  507. #endif
  508. #if DIGITAL_SUPPORT
  509. #include "../sensors/DigitalSensor.h"
  510. #endif
  511. #if ECH1560_SUPPORT
  512. #include "../sensors/ECH1560Sensor.h"
  513. #endif
  514. #if EMON_ADC121_SUPPORT
  515. #include "../sensors/EmonADC121Sensor.h"
  516. #endif
  517. #if EMON_ADS1X15_SUPPORT
  518. #include "../sensors/EmonADS1X15Sensor.h"
  519. #endif
  520. #if EMON_ANALOG_SUPPORT
  521. #include "../sensors/EmonAnalogSensor.h"
  522. #endif
  523. #if EVENTS_SUPPORT
  524. #include "../sensors/EventSensor.h"
  525. #endif
  526. #if HLW8012_SUPPORT
  527. #include <HLW8012.h>
  528. #include "../sensors/HLW8012Sensor.h"
  529. #endif
  530. #if MHZ19_SUPPORT
  531. #include <SoftwareSerial.h>
  532. #include "../sensors/MHZ19Sensor.h"
  533. #endif
  534. #if PMSX003_SUPPORT
  535. #include <SoftwareSerial.h>
  536. #include <PMS.h>
  537. #include "../sensors/PMSX003Sensor.h"
  538. #endif
  539. #if PZEM004T_SUPPORT
  540. #include <SoftwareSerial.h>
  541. #include "../sensors/PZEM004TSensor.h"
  542. #endif
  543. #if SI7021_SUPPORT
  544. #include "../sensors/SI7021Sensor.h"
  545. #endif
  546. #if SHT3X_I2C_SUPPORT
  547. #include "../sensors/SHT3XI2CSensor.h"
  548. #endif
  549. #if V9261F_SUPPORT
  550. #include <SoftwareSerial.h>
  551. #include "../sensors/V9261FSensor.h"
  552. #endif
  553. #endif // SENSOR_SUPPORT