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.

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