Bug: Is it device, ZwaveJS2MQTT or HA

I am observing a bug and I can’t figure out whether it is device’s issue, ZwaveJS or Home Assistant.
I am using Aeotec Heavy Duty switch connected inline to my water pump to monitor consumption (W) and energy usage (kWh). Those are, as usual, 2 different entities on the device.
What happens occasionally is that it reports very high actual power (W) - instead of typical ~1000W it spikes to 135000W. Actually I don’t know if it reports, but that is what HA is saying. I have not been able to capture it in ZwaveJS debug as it really happens very ocasionally.
However what I can’t understand is - it also screws energy usage, despite it is separate entity.
When I look at ZwaveJS and refresh values on device, consumption is what it should be:

But within HA, I use utility meter for daily/monthyl consumption, and that is far off when this happens:
image

image

Anyone encountered anything similar? Shall I open a case with Aeotec? Is it even possible that it would send wrong report at certain time (for both energy and active power) and minute later, send correct value?

I have seen something similar on many devices with a rolling counter.
A rolling counter is always counting up, which means you can read the counter at two different points in time and then can calculate a value per time unit with those.

The issue is that in the computer world your just can’t keep counting up, so at one point you will hit max and then the counter will simply continue counting from the lowest value again which might be zero, but could also be some negative value.

The counter can be like a 8, 16, 32 or 64bit value and it can be signed or unsigned.

8bit gives 256 possible values.
If it is unsigned then it will be from 0 to 255 and if it is signed then it will be from -128 to 127.

16bit is 256^2
32 is 256^4
64bit is 256^8

You need to read the value directly at the device to see if this might be the issue.
HA might do some handling on the values read and thereby hidding the issue.

However my issue is slightly different. Device, when not used, is reporting consumption in kWh that it accumulated so far within the device.
It was 173,7 kWh

4 minutes later, it was reported as 15270 kWh and 4 minutes later, back to 173,7kWh.

I am trying to figure out if this is device sending wrong value (if yes, why?) or could it be misinterpretaion by either HA or ZwaveJS2MQTT

Ok,that sounds like a true bug.
Can you log the MQTT messages?
I use MQTT explore for Windows.

I am running a debug on ZwaveJS to file, however this doesn’t happen all the time. So it may or may not reoccur any time soon.

So I ran a ZwaveJS debug to file until I captured error again.

2022-07-26 20:28:14.834 DEBUG MQTT: Publishing to zwave/Outside/Well_Pump/50/0/value/65537: { time: 1658860094834, value: 257.353 } with options { qos: 1, retain: true }
2022-07-26 20:28:14.834 INFO ZWAVE: Node 8: value updated: 50-0-value-65537 191.816 => 257.353
2022-07-26 20:28:14.882 DEBUG MQTT: Publishing to zwave/Outside/Well_Pump/50/0/value/65537: { time: 1658860094882, value: 191.816 } with options { qos: 1, retain: true }
2022-07-26 20:28:14.882 INFO ZWAVE: Node 8: value updated: 50-0-value-65537 257.353 => 191.816

Looks to me like device is sending energy usage, then at the same time, sends false report (+ ~60kWh more) followed by report with correct value right after.
I have opened a ticket with Aeotec