OpenZWave / open-zwave

a C++ library to control Z-Wave Networks via a USB Z-Wave Controller.
http://www.openzwave.net/
GNU Lesser General Public License v3.0
1.05k stars 918 forks source link

Ignore most significant bit kWh readings #2598

Open markruys opened 3 years ago

markruys commented 3 years ago

The Neo Coolcam NAS-WR01ZE randomly reports kWh value with the most significant bit set. This results in erroneous negative readings:

       37.86          0x00000ECA
-21474798.43  0xFFFFFFFF80000EDD
       38.26          0x00000EF2
-21474798.11  0xFFFFFFFF80000EFD
       38.40          0x00000F00

OZW expects a 32-bit signed int, hence the negative readings. According to the docs of this device, the maximum report value is 21474836.47 kWh, which is 0x7FFFFFFF. This PR resets resets the most significant bit to 0. This results in:

37.86
38.05
38.26
38.37
38.40

I expect this PR addresses issues #1724, #2062, and #2333 wrt NAS-WR01ZE.

LoukKamp commented 2 years ago

Any chance that this change is merged to the master and will be included in then next release or beta (V1.7)?

As all new models of this wall plug (Neo CoolCam NAS-WR01ZE) seem to have this nasty behavior, more and more people will benefit from this change .