If you want to debug this. I would suggest adding a print(payload)here.
Then you can see if there is anything suspicious with the values when the values are incorrect. I have never got any incorrect values, so I am not able to solve this without help from others.
I’m sorry, I assume you are connected to the core component dev of the RM2?
Anyway - in the component code it would be nice if the logging mechanism (_LOGGER example below) issued the relevant debug prints such as what you suggested when the following is added to the configuration file (emphasis last line):