|
@ -57,6 +57,7 @@ |
|
|
#define SENSOR_MHZ19_ID 0x14 |
|
|
#define SENSOR_MHZ19_ID 0x14 |
|
|
#define SENSOR_SI7021_ID 0x15 |
|
|
#define SENSOR_SI7021_ID 0x15 |
|
|
#define SENSOR_SHT3X_I2C_ID 0x16 |
|
|
#define SENSOR_SHT3X_I2C_ID 0x16 |
|
|
|
|
|
#define SENSOR_BH1750_ID 0x17 |
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------------------- |
|
|
//-------------------------------------------------------------------------------- |
|
|
// Magnitudes |
|
|
// Magnitudes |
|
@ -81,8 +82,9 @@ |
|
|
#define MAGNITUDE_PM2dot5 16 |
|
|
#define MAGNITUDE_PM2dot5 16 |
|
|
#define MAGNITUDE_PM10 17 |
|
|
#define MAGNITUDE_PM10 17 |
|
|
#define MAGNITUDE_CO2 18 |
|
|
#define MAGNITUDE_CO2 18 |
|
|
|
|
|
#define MAGNITUDE_LUX 19 |
|
|
|
|
|
|
|
|
#define MAGNITUDE_MAX 19 |
|
|
|
|
|
|
|
|
#define MAGNITUDE_MAX 20 |
|
|
|
|
|
|
|
|
// ============================================================================= |
|
|
// ============================================================================= |
|
|
// Specific data for each sensor |
|
|
// Specific data for each sensor |
|
@ -102,6 +104,27 @@ |
|
|
#define ADC_VCC_ENABLED 0 |
|
|
#define ADC_VCC_ENABLED 0 |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------ |
|
|
|
|
|
// BH1750 |
|
|
|
|
|
// Enable support by passing BH1750_SUPPORT=1 build flag |
|
|
|
|
|
// http://www.elechouse.com/elechouse/images/product/Digital%20light%20Sensor/bh1750fvi-e.pdf |
|
|
|
|
|
//------------------------------------------------------------------------------ |
|
|
|
|
|
|
|
|
|
|
|
#ifndef BH1750_SUPPORT |
|
|
|
|
|
#define BH1750_SUPPORT 0 |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#ifndef BH1750_ADDRESS |
|
|
|
|
|
#define BH1750_ADDRESS 0x00 // 0x00 means auto |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#define BH1750_MODE BH1750_CONTINUOUS_HIGH_RES_MODE |
|
|
|
|
|
|
|
|
|
|
|
#if BH1750_SUPPORT |
|
|
|
|
|
#undef I2C_SUPPORT |
|
|
|
|
|
#define I2C_SUPPORT 1 |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------ |
|
|
//------------------------------------------------------------------------------ |
|
|
// BME280/BMP280 |
|
|
// BME280/BMP280 |
|
|
// Enable support by passing BMX280_SUPPORT=1 build flag |
|
|
// Enable support by passing BMX280_SUPPORT=1 build flag |
|
@ -415,7 +438,7 @@ |
|
|
// Sensor helpers configuration |
|
|
// Sensor helpers configuration |
|
|
// ============================================================================= |
|
|
// ============================================================================= |
|
|
|
|
|
|
|
|
#if ANALOG_SUPPORT || BMX280_SUPPORT || DALLAS_SUPPORT \ |
|
|
|
|
|
|
|
|
#if ANALOG_SUPPORT || BH1750_SUPPORT || BMX280_SUPPORT || DALLAS_SUPPORT \ |
|
|
|| DHT_SUPPORT || DIGITAL_SUPPORT || ECH1560_SUPPORT \ |
|
|
|| DHT_SUPPORT || DIGITAL_SUPPORT || ECH1560_SUPPORT \ |
|
|
|| EMON_ADC121_SUPPORT || EMON_ADS1X15_SUPPORT \ |
|
|
|| EMON_ADC121_SUPPORT || EMON_ADS1X15_SUPPORT \ |
|
|
|| EMON_ANALOG_SUPPORT || EVENTS_SUPPORT || HLW8012_SUPPORT \ |
|
|
|| EMON_ANALOG_SUPPORT || EVENTS_SUPPORT || HLW8012_SUPPORT \ |
|
@ -474,7 +497,7 @@ PROGMEM const unsigned char magnitude_decimals[] = { |
|
|
3, 0, 0, 0, 0, 0, 0, 0, |
|
|
3, 0, 0, 0, 0, 0, 0, 0, |
|
|
0, 0, 0, |
|
|
0, 0, 0, |
|
|
0, 0, 0, |
|
|
0, 0, 0, |
|
|
0 |
|
|
|
|
|
|
|
|
0, 0 |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
PROGMEM const char magnitude_unknown_topic[] = "unknown"; |
|
|
PROGMEM const char magnitude_unknown_topic[] = "unknown"; |
|
@ -496,6 +519,7 @@ PROGMEM const char magnitude_analog_topic[] = "analog"; |
|
|
PROGMEM const char magnitude_digital_topic[] = "digital"; |
|
|
PROGMEM const char magnitude_digital_topic[] = "digital"; |
|
|
PROGMEM const char magnitude_events_topic[] = "events"; |
|
|
PROGMEM const char magnitude_events_topic[] = "events"; |
|
|
PROGMEM const char magnitude_co2_topic[] = "co2"; |
|
|
PROGMEM const char magnitude_co2_topic[] = "co2"; |
|
|
|
|
|
PROGMEM const char magnitude_lux_topic[] = "lux"; |
|
|
|
|
|
|
|
|
PROGMEM const char* const magnitude_topics[] = { |
|
|
PROGMEM const char* const magnitude_topics[] = { |
|
|
magnitude_unknown_topic, magnitude_temperature_topic, magnitude_humidity_topic, |
|
|
magnitude_unknown_topic, magnitude_temperature_topic, magnitude_humidity_topic, |
|
@ -504,7 +528,7 @@ PROGMEM const char* const magnitude_topics[] = { |
|
|
magnitude_power_factor_topic, magnitude_energy_topic, magnitude_energy_delta_topic, |
|
|
magnitude_power_factor_topic, magnitude_energy_topic, magnitude_energy_delta_topic, |
|
|
magnitude_pm1dot0_topic, magnitude_pm2dot5_topic, magnitude_pm10_topic, |
|
|
magnitude_pm1dot0_topic, magnitude_pm2dot5_topic, magnitude_pm10_topic, |
|
|
magnitude_analog_topic, magnitude_digital_topic, magnitude_events_topic, |
|
|
magnitude_analog_topic, magnitude_digital_topic, magnitude_events_topic, |
|
|
magnitude_co2_topic |
|
|
|
|
|
|
|
|
magnitude_co2_topic, magnitude_lux_topic |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
PROGMEM const char magnitude_empty[] = ""; |
|
|
PROGMEM const char magnitude_empty[] = ""; |
|
@ -518,6 +542,7 @@ PROGMEM const char magnitude_watts[] = "W"; |
|
|
PROGMEM const char magnitude_joules[] = "J"; |
|
|
PROGMEM const char magnitude_joules[] = "J"; |
|
|
PROGMEM const char magnitude_ugm3[] = "µg/m3"; |
|
|
PROGMEM const char magnitude_ugm3[] = "µg/m3"; |
|
|
PROGMEM const char magnitude_ppm[] = "ppm"; |
|
|
PROGMEM const char magnitude_ppm[] = "ppm"; |
|
|
|
|
|
PROGMEM const char magnitude_lux[] = "lux"; |
|
|
|
|
|
|
|
|
PROGMEM const char* const magnitude_units[] = { |
|
|
PROGMEM const char* const magnitude_units[] = { |
|
|
magnitude_empty, magnitude_celsius, magnitude_percentage, |
|
|
magnitude_empty, magnitude_celsius, magnitude_percentage, |
|
@ -526,7 +551,7 @@ PROGMEM const char* const magnitude_units[] = { |
|
|
magnitude_percentage, magnitude_joules, magnitude_joules, |
|
|
magnitude_percentage, magnitude_joules, magnitude_joules, |
|
|
magnitude_ugm3, magnitude_ugm3, magnitude_ugm3, |
|
|
magnitude_ugm3, magnitude_ugm3, magnitude_ugm3, |
|
|
magnitude_empty, magnitude_empty, magnitude_empty, |
|
|
magnitude_empty, magnitude_empty, magnitude_empty, |
|
|
magnitude_ppm |
|
|
|
|
|
|
|
|
magnitude_ppm, magnitude_lux |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
#include "../sensors/BaseSensor.h" |
|
|
#include "../sensors/BaseSensor.h" |
|
@ -535,6 +560,10 @@ PROGMEM const char* const magnitude_units[] = { |
|
|
#include "../sensors/AnalogSensor.h" |
|
|
#include "../sensors/AnalogSensor.h" |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#if BH1750_SUPPORT |
|
|
|
|
|
#include "../sensors/BH1750Sensor.h" |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
#if BMX280_SUPPORT |
|
|
#if BMX280_SUPPORT |
|
|
#include <SparkFunBME280.h> |
|
|
#include <SparkFunBME280.h> |
|
|
#include "../sensors/BMX280Sensor.h" |
|
|
#include "../sensors/BMX280Sensor.h" |
|
|