diff --git a/code/espurna/sensors/PZEM004TSensor.h b/code/espurna/sensors/PZEM004TSensor.h index 85a60f87..5f643ae9 100644 --- a/code/espurna/sensors/PZEM004TSensor.h +++ b/code/espurna/sensors/PZEM004TSensor.h @@ -116,7 +116,7 @@ class PZEM004TSensor : public BaseSensor { // If called with value = -1, the offset will be the last energy reading // otherwise, it will be the value provided float resetEnergy(unsigned char dev, float value = -1) { - _energy_offsets[dev] = value != 0 ? value : _readings[dev].energy; + _energy_offsets[dev] = value != -1 ? value : _readings[dev].energy; return _energy_offsets[dev]; }