RFX Meter / Uint32_t overflow Topic is solved

Please use template to report bugs and problems. Post here your questions when not sure where else to post
Only for bugs in the Domoticz application! other problems go in different subforums!

Moderators: leecollings, remb0

Forum rules
Before posting here, make sure you are on the latest Beta or Stable version.
If you have problems related to the web gui, clear your browser cache + appcache first.

Use the following template when posting here:

Version: xxxx
Platform: xxxx
Plugin/Hardware: xxxx
Description:
.....

If you are having problems with scripts/blockly, always post the script (in a spoiler or code tag) or screenshots of your blockly

If you are replying, please do not quote images/code from the first post

Please mark your topic as Solved when the problem is solved.
Post Reply
qqlapraline
Posts: 21
Joined: Saturday 11 January 2014 16:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

RFX Meter / Uint32_t overflow

Post by qqlapraline »

Hello everyone,

I've been using Domoticz for the past ... 13 years at least now.
My setup is somehow specific because I've been using numerous MySensors devices.

One of these devices is sending the actual usage of wooden pellet for my Mom's stove.
It is base on the V_VOLUME device for the MySensors family that is relying on .. RFXMeter devices on demotics.

I've been using 2025.1 (build 16598) for a while now because it took me some time to upgrade to Trixie on my Raspberry PI.
Once I've done the migration (to the lastest beta version), my famous V_VOLUME device had been having some trouble.
The updating value was: 3439258 but after a couple of minutes, Domoticz gave me a strange error:

Code: Select all

Error: GetJSonDevices: exception occurred: 'stoll' (3048/Conso Pellet Moteur)
I've been digging in to see what could be the error. After a while, I realized that the updated value was transformed to: 18446744072853842432
Which is basically: 2^64-855709184 ... and -855709184 is the int32 version of 3439258112 (the transformed float version of 3439258*1000.0f).
So, in a nuttshell, it comes from a bady typed conversion.

I've created a small fix on my setup. To do so, I've change the

Code: Select all

decode-RFXMeter
function in

Code: Select all

mainworker.cpp
.

I've replaced this line:

Code: Select all

unsigned long counter = (pResponse->RFXMETER.count1 << 24) + (pResponse->RFXMETER.count2 << 16) + (pResponse->RFXMETER.count3 << 8) + pResponse->RFXMETER.count4;
by this line:

Code: Select all

uint32_t counter = (static_cast<uint32_t>(pResponse->RFXMETER.count1) << 24) + (static_cast<uint32_t>(pResponse->RFXMETER.count2) << 16) + (static_cast<uint32_t>(pResponse->RFXMETER.count3) << 8) + static_cast<uint32_t>(pResponse->RFXMETER.count4);
And... it works for me !
I've looked back to the history of code and I really don't understand what could have changed. May be it's a matter of compilation on my raspberry pi ... any hint ?

Regards,

Qq.
Last edited by qqlapraline on Friday 22 May 2026 14:37, edited 1 time in total.
3 Raspberry PI (Raspbian + Rfxcom, teleinfo or mysensors gateway)
Bunch of OS THGR810n (5)
Some THN122
1 WGR800 and PCR800
Some BMP085
Bunch of TS34C (4)
Bunch of DIO plugs (3)
Teleinfo
Many Mysensors devices (Temp, Hygro, ...)
User avatar
gizmocuz
Posts: 3026
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: RFX Meter / Uint32_t overflow

Post by gizmocuz »

Thank you for reporting.

The patch is implemented in beta 17965
Quality outlives Quantity!
qqlapraline
Posts: 21
Joined: Saturday 11 January 2014 16:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: RFX Meter / Uint32_t overflow

Post by qqlapraline »

Tested and validated on my side !
Thanks, Gizmo.

Qq.
3 Raspberry PI (Raspbian + Rfxcom, teleinfo or mysensors gateway)
Bunch of OS THGR810n (5)
Some THN122
1 WGR800 and PCR800
Some BMP085
Bunch of TS34C (4)
Bunch of DIO plugs (3)
Teleinfo
Many Mysensors devices (Temp, Hygro, ...)
Post Reply