Browse Source
sns: power factor fixes (#2303)
* Update PZEM004TV30Sensor.h
See table above for the correct scale
* Power factor has no unit
mcspr-patch-1
Max Prokhorov
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
2 additions and
3 deletions
-
code/espurna/sensors/BaseSensor.h
-
code/espurna/sensors/PZEM004TV30Sensor.h
|
|
@ -95,8 +95,7 @@ class BaseSensor { |
|
|
|
switch (type(index)) { |
|
|
|
case MAGNITUDE_TEMPERATURE: |
|
|
|
return sensor::Unit::Celcius; |
|
|
|
case MAGNITUDE_HUMIDITY: |
|
|
|
case MAGNITUDE_POWER_FACTOR: |
|
|
|
case MAGNITUDE_HUMIDITY: |
|
|
|
return sensor::Unit::Percentage; |
|
|
|
case MAGNITUDE_PRESSURE: |
|
|
|
return sensor::Unit::Hectopascal; |
|
|
|
|
|
@ -402,7 +402,7 @@ class PZEM004TV30Sensor : public BaseEmonSensor { |
|
|
|
|
|
|
|
// - Power Factor: 2 bytes in 0.1% (we return %) |
|
|
|
_power_factor = take_2(); |
|
|
|
_power_factor /= 10.0; |
|
|
|
_power_factor /= 100.0; |
|
|
|
|
|
|
|
// - Alarms: 2 bytes, (NOT IMPLEMENTED) |
|
|
|
// XXX: it seems it can only be either 0xffff or 0 for ON and OFF respectively |
|
|
|