Skip to content

SensorsConfiguration

Maxim Prokhorov edited this page Aug 23, 2024 · 4 revisions

Sensors Configuration

Terminal

Command description
Common
magnitudes Lists all sensor magnitudes
I2C
i2c.scan Lists available i2c devices
i2c.clear Recovers i2c bus from failure
PZEM004T(v3)
pz.address <address> Set address string (use pzemAddress setting to permanently set it)
pz.reset <index> Reset energy total for device
pz.value <index> Show sensor values (only PZEM004T v1)

Common

Configuration key Build flag Description
snsRead Sensor read interval in seconds A positive number greater than 2. Defaults to 6
snsReport Sensor report every N reads A positive number greater than 0. Defaults to 10 (i.e. by default, reports happen every minute)

I2C

Configuration key Description
i2cSCL SCL pin, defaults to 5
i2cSDA SDA pin, defaults to 4
i2cCST I2C Clock Stretch Time in milliseconds (only for I2C_Brzo library). A positive number, defaults to 200
i2cFreq I2C SCL frequency (only for I2C_Brzo library). A positive number, defaults to 1000

Magnitudes

Each individual magnitude can be configured by using special configuration keys. Each magnitute is assigned an unique index #. Default values depend on the selected sensor

Configuration key Description
xCorrection# Static offset for the value
xMinDelta# After N readings (specified as snsReport), check if the value changed by at least this much and only then proceed with the report action
xMaxDelta# After each reading, check if the value had changed by at least this much and trigger the report action (even before the snsReport number of readings is reached)
xZeroThreshold After each reading, check if the sensor value is above a certain threshold. If not, reset the value to 0. Setting value is expected to be greater or equal to zero. Defaults to 'NaN', value is read as-is.
xMinThreshold After each reading, check if the sensor value is above a certain threshold. Proceed with the report action only when this condition is true. Defaults to 'NaN', value is always reported
xMaxThreshold After each reading, check if the sensor value is below a certain threshold. Proceed with the report action only when this condition is true. Defaults to 'NaN', value is always reported

Where x is one of:

Prefix Description
tmp Temperature
hum Humidity
press Pressure
curr Current
volt Voltage
pwrP Active power
pwrQ Apparent power
pwrModS Reactive power
pwrPF Power factor
ene Energy (total)
eneDelta Energy delta
analog Analog reading
digital Digital reading
event
pm1dot0
pm1dot5
pm10
co2
voc
iaq
iaqAccuracy
iaqStatic
lux
uva
uvb
uvi
distance
hcho
gcpm
gsiev
count
no2
co
res Resistance
ph
freq

Units

Configuration key Description
xUnits# Defaults to the unit choosen by the BaseSensor or the custom override specific to the selected sensor

Settings use 'Unit' enumeration represented as integer, which can be found in the sensor.h. Note that each sensor may provide a different Magnitude<->Unit defaults.

Unit Number
None 1
Celcius 2
Farenheit 3
Kelvin 4
Percentage 5
Hectopascal 6
Ampere 7
Volt 8
Voltampere 9
Kilovoltampere 10
VoltampereReactive 11
KilovoltampereReactive 12
Watt 13
Kilowatt 14
WattSecond 15
Joule 15
KilowattHour 16
PartsPerMillion 17
Ohm 18
MicrogrammPerCubicMeter 19
MilligrammPerCubicMeter 20
Lux 21
UltravioletIndex 22
CountsPerMinute 23
MicrosievertPerHour 24
Meter 25
Hertz 26
Ph 27

EmonSensor configuration

Configuration key Description
pwrRatioC# Ratio for the current
pwrRatioP# Ratio for the active power
pwrRatioV# Ratio for the voltage
pwrRatioE# Ratio for the energy
pwrVoltage# Nominal RMS mains voltage (125, 220, 230...). Depends on country, 230 by default

Home
Change log

Getting started

Supported hardware and options

Configuration

Integrations

Network

Developers

More around ESPurna

Clone this wiki locally