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