|
@ -48,6 +48,9 @@ String _sensorTopic(magnitude_t type) { |
|
|
if (type == MAGNITUDE_POWER_FACTOR) return String(SENSOR_POWER_FACTOR_TOPIC); |
|
|
if (type == MAGNITUDE_POWER_FACTOR) return String(SENSOR_POWER_FACTOR_TOPIC); |
|
|
if (type == MAGNITUDE_ENERGY) return String(SENSOR_ENERGY_TOPIC); |
|
|
if (type == MAGNITUDE_ENERGY) return String(SENSOR_ENERGY_TOPIC); |
|
|
if (type == MAGNITUDE_ENERGY_DELTA) return String(SENSOR_ENERGY_DELTA_TOPIC); |
|
|
if (type == MAGNITUDE_ENERGY_DELTA) return String(SENSOR_ENERGY_DELTA_TOPIC); |
|
|
|
|
|
if (type == MAGNITUDE_PM1dot0) return String(SENSOR_PM1dot0_TOPIC); |
|
|
|
|
|
if (type == MAGNITUDE_PM2dot5) return String(SENSOR_PM2dot5_TOPIC); |
|
|
|
|
|
if (type == MAGNITUDE_PM10) return String(SENSOR_PM10_TOPIC); |
|
|
if (type == MAGNITUDE_ANALOG) return String(SENSOR_ANALOG_TOPIC); |
|
|
if (type == MAGNITUDE_ANALOG) return String(SENSOR_ANALOG_TOPIC); |
|
|
if (type == MAGNITUDE_EVENTS) return String(SENSOR_EVENTS_TOPIC); |
|
|
if (type == MAGNITUDE_EVENTS) return String(SENSOR_EVENTS_TOPIC); |
|
|
return String(SENSOR_UNKNOWN_TOPIC); |
|
|
return String(SENSOR_UNKNOWN_TOPIC); |
|
@ -65,6 +68,9 @@ unsigned char _sensorDecimals(magnitude_t type) { |
|
|
if (type == MAGNITUDE_POWER_FACTOR) return SENSOR_POWER_FACTOR_DECIMALS; |
|
|
if (type == MAGNITUDE_POWER_FACTOR) return SENSOR_POWER_FACTOR_DECIMALS; |
|
|
if (type == MAGNITUDE_ENERGY) return SENSOR_ENERGY_DECIMALS; |
|
|
if (type == MAGNITUDE_ENERGY) return SENSOR_ENERGY_DECIMALS; |
|
|
if (type == MAGNITUDE_ENERGY_DELTA) return SENSOR_ENERGY_DECIMALS; |
|
|
if (type == MAGNITUDE_ENERGY_DELTA) return SENSOR_ENERGY_DECIMALS; |
|
|
|
|
|
if (type == MAGNITUDE_PM1dot0) return SENSOR_PM1dot0_DECIMALS; |
|
|
|
|
|
if (type == MAGNITUDE_PM2dot5) return SENSOR_PM2dot5_DECIMALS; |
|
|
|
|
|
if (type == MAGNITUDE_PM10) return SENSOR_PM10_DECIMALS; |
|
|
if (type == MAGNITUDE_ANALOG) return SENSOR_ANALOG_DECIMALS; |
|
|
if (type == MAGNITUDE_ANALOG) return SENSOR_ANALOG_DECIMALS; |
|
|
if (type == MAGNITUDE_EVENTS) return SENSOR_EVENTS_DECIMALS; |
|
|
if (type == MAGNITUDE_EVENTS) return SENSOR_EVENTS_DECIMALS; |
|
|
return 0; |
|
|
return 0; |
|
@ -80,6 +86,9 @@ String _sensorUnits(magnitude_t type) { |
|
|
if (type == MAGNITUDE_POWER_APPARENT) return String("W"); |
|
|
if (type == MAGNITUDE_POWER_APPARENT) return String("W"); |
|
|
if (type == MAGNITUDE_POWER_REACTIVE) return String("W"); |
|
|
if (type == MAGNITUDE_POWER_REACTIVE) return String("W"); |
|
|
if (type == MAGNITUDE_POWER_FACTOR) return String("%"); |
|
|
if (type == MAGNITUDE_POWER_FACTOR) return String("%"); |
|
|
|
|
|
if (type == MAGNITUDE_PM1dot0) return String("µg/m3"); |
|
|
|
|
|
if (type == MAGNITUDE_PM2dot5) return String("µg/m3"); |
|
|
|
|
|
if (type == MAGNITUDE_PM10) return String("µg/m3"); |
|
|
if (type == MAGNITUDE_ENERGY) return String("J"); |
|
|
if (type == MAGNITUDE_ENERGY) return String("J"); |
|
|
if (type == MAGNITUDE_ENERGY_DELTA) return String("J"); |
|
|
if (type == MAGNITUDE_ENERGY_DELTA) return String("J"); |
|
|
if (type == MAGNITUDE_EVENTS) return String("/m"); |
|
|
if (type == MAGNITUDE_EVENTS) return String("/m"); |
|
@ -252,6 +261,11 @@ void sensorInit() { |
|
|
#include "sensors/EmonADS1115Sensor.h"
|
|
|
#include "sensors/EmonADS1115Sensor.h"
|
|
|
sensorRegister(new EmonADS1115Sensor(EMON_ADS1115_I2C_ADDRESS, EMON_ADS1115_PORT_MASK, EMON_MAINS_VOLTAGE, EMON_ADS1115_ADC_BITS, EMON_ADS1115_REFERENCE_VOLTAGE, EMON_ADS1115_CURRENT_RATIO)); |
|
|
sensorRegister(new EmonADS1115Sensor(EMON_ADS1115_I2C_ADDRESS, EMON_ADS1115_PORT_MASK, EMON_MAINS_VOLTAGE, EMON_ADS1115_ADC_BITS, EMON_ADS1115_REFERENCE_VOLTAGE, EMON_ADS1115_CURRENT_RATIO)); |
|
|
#endif
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if PMSX003_SUPPORT
|
|
|
|
|
|
#include "sensors/PMSX003Sensor.h"
|
|
|
|
|
|
sensorRegister(new PMSX003Sensor(PMS_RX_PIN, PMS_TX_PIN)); |
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
#if COUNTER_SUPPORT
|
|
|
#if COUNTER_SUPPORT
|
|
|
if (_sensor_isr == 0xFF) { |
|
|
if (_sensor_isr == 0xFF) { |
|
|