Meter reset and overflow
What does "Device reset detected" mean and how does reset detection work?
In short: "Device reset detected" is a warning, not an error. SourceAnalytix noticed that the meter reading of your source dropped sharply (restart, power failure, overflow or meter swap), and from now on it keeps counting on top of the previous total. No consumption is lost and no negative values appear.
The terms
These terms apply throughout the documentation.
| Term | Meaning |
|---|---|
| Target unit | The unit of the price definition you assigned to the source, e.g. kWh. SourceAnalytix calculates everything in it: total, start values and threshold. |
| Device value | The value of your source datapoint, converted to the target unit. It can fall back, e.g. after the device restarts. |
| Total | SourceAnalytix's own meter reading in the state sourceanalytix.0.<device>.cumulativeReading. With reset detection on, it never drops by itself. |
| Offset | The value valueAtDeviceReset in the SourceAnalytix settings of the source. The rule is: total = device value + offset. Without a reset it is 0. Up to v0.6.x no dialog shows it. From v0.7.0 it is on the source under "For experts". |
| Start value | The total at the beginning of a period ("Day", "Week", "Month", "Quarter", "Year"). Consumption of the period = total − start value. |
| Threshold | The field "Threshold" in the settings of the source. The largest drop that still counts as measurement noise. In the target unit, default 1. |
| Reset | The device value falls by more than the threshold. The cause can be a restart, an overflow or a new meter. |
How detection works
With every new device value, SourceAnalytix calculates device value + offset and compares the result with the last total:
- Equal or higher: The value is accepted.
- Lower, but by no more than the threshold: This counts as measurement noise. The total stays where it is and the value is ignored.
- Lower by more than the threshold: This is a possible reset. SourceAnalytix keeps the total, writes "Waiting for another reading before confirming a possible device reset" to the log and waits for the next value.
- The next value decides:
- If it is close to the old value again (within the threshold) or has climbed back more than halfway, the low value was an outlier. It is discarded, and the log says "Rejected a possible device reset".
- If it is equal to or higher than the low value but still low, the reset is confirmed. SourceAnalytix sets the offset to old total − low device value and reports "Device reset detected for … preserving cumulative value … with new offset …". From now on, the device value keeps counting on top of the old total.
- If it is even lower, SourceAnalytix keeps waiting.
An example with a threshold of 1 kWh: The meter reads 1,000 kWh and restarts at 0 after a power failure.
| Device value | Offset | Total | Log |
|---|---|---|---|
| 1,000 kWh | 0 | 1,000 kWh | – |
| 0 kWh | 0 | 1,000 kWh | "Waiting for another reading …" |
| 0.4 kWh | 1,000 | 1,000.4 kWh | "Device reset detected …" |
| 1.0 kWh | 1,000 | 1,001 kWh | – |
The only thing lost is what the device counted between its last value before the reset and its first value after it, because the device itself no longer reported that part.
NOTE
If the first value after a real reset has already climbed back more than halfway, SourceAnalytix takes it for an outlier. The consumption since the reset is then not counted, and the log says so with "Rejected a possible device reset … If the device was really reset, consumption since the reset was not counted". You can correct this as described in Correct wrong values.
Overflow, power failure and restart of SourceAnalytix
- Overflow: A meter that starts again at 0 after reaching its maximum is an ordinary reset for SourceAnalytix.
- Power failure at the device: If the device starts at 0 or a lower value, that is also a reset.
- SourceAnalytix was stopped: The total is stored in the state
cumulativeReading. A reset that happened in that time is detected at the first value after the start, as long as device value + offset is then still lower than the stored total by more than the threshold. - Power sources (W): They have no reset detection. They don't deliver a meter reading that SourceAnalytix could compare.
When reset detection is off
Without the checkbox "Device value reset detection Enabled", SourceAnalytix accepts every drop. Total and period values then drop with it, and consumption can go negative. This is meant only for sources that are allowed to drop on purpose. The log says "Cumulative reading for … decreased while reset detection is disabled" with every drop.
Up to v0.6.1: This message is logged at info level and can flood the log for sources that drop. From v0.6.2, it appears only in the debug log (#1262).
The older message "Device reset detected … feature disabled (or below threshold)" exists only up to v0.4.x. Since v0.5.0 it has been replaced by the messages above. If you still see it, update SourceAnalytix.
What changes from v0.6.2
From v0.6.2: A confirmed reset is rolled back if the old device value returns in one step. Example: A device reports 1,000, then 0 twice, then 1,000 again. Up to v0.6.1, the total doubled to 2,000 in this case. From v0.6.2, SourceAnalytix restores the old offset, the total stays at 1,000, and the log says "Rolled back the device reset of …" (#1258).
From v0.6.2: If the offset is larger than the total (usually after a manual correction or a meter swap), the source keeps running. SourceAnalytix warns "Known valueAtDeviceReset … is larger than the known cumulative value …" and sets the offset to total − device value at the next value. Up to v0.6.1, the source stopped instead with the error "Check settings for … Known valueAtDeviceReset … > known cumulative value … cannot proceed" (#1257).
See also: Threshold and turning off reset detection · Meter starts at 0 after a power failure · Error "Known valueAtDeviceReset > known cumulative value"
Counter that is reset to 0 every day: what happens internally?
In short: With reset detection on, SourceAnalytix treats the nightly drop to 0 like any other reset: It waits for the next value, then sets the offset and keeps counting the total. Only a small remainder is missing each night. With reset detection off, SourceAnalytix accepts the drop, and the previous day's consumption is subtracted again the next day.
What happens during the night
An example with a threshold of 0.1 kWh. The daily counter read 4.2 kWh in the evening, and the offset from earlier nights is 1,000 kWh.
| Time | Device value | Offset | Total | What happens |
|---|---|---|---|---|
| 23:58 | 4.2 kWh | 1,000 | 1,004.2 kWh | – |
| 0:00 | – | 1,000 | 1,004.2 kWh | Period rollover: "Day" start value becomes 1,004.2 kWh |
| 0:01 | 0 kWh | 1,000 | 1,004.2 kWh | Log "Waiting for another reading …" |
| 0:10 | 0.05 kWh | 1,004.2 | 1,004.25 kWh | Log "Device reset detected …", today 0.05 kWh |
The period rollover at 0:00 system time does not depend on the device. It sets the start values to the total, and because the total does not drop, the new day starts cleanly at 0. It therefore doesn't matter whether the device drops back shortly before or shortly after midnight. Only what the device counted between its last value before the drop and the drop itself is missing.
When it goes wrong
| Setting | What happens | Result |
|---|---|---|
| Reset detection off | The total drops by the device's daily value | Daily value negative, month and year lose the previous day's consumption |
| Threshold larger than the daily consumption, e.g. 1 kWh with 0.6 kWh the day before | The drop counts as measurement noise, new values are ignored until they exceed the old reading | The start of the new day is missing |
For the right setting, see My meter restarts at 0 every day.
From v0.7.0: The "Add source" wizard marks datapoints whose ID or name looks like a daily value with "daily counter". If you choose one anyway, it advises you to answer the question "Does the value sometimes drop to 0?" with "Yes". That switches reset detection on. If it is off for a source that drops, the "Problems" tab reports "Meter drops to 0, reset detection is off".
Better: a meter that doesn't drop back
A daily counter works, but a total counter is more accurate. If there is none, you can use the device's power as the source, or write your own continuously rising datapoint with a script and evaluate that.
See also: What does "Device reset detected" mean and how does reset detection work? · Which datapoint do I activate: meter (kWh) or power (W)? · Script datapoints for unreliable sources