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.

667 lines
23 KiB

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