Plugwise component cumulative electricity sensor reporting

I was working on integrating the utility_meter and plugwise components into my set-up. I managed to get correct readings from the plugwise P1 DSMR sensors and added the entities to the utility_meter component along with the costs for gas and electricity.

I noticed that gas usage is reported as m3 with a 2 decimal float precision. The electricity sensors sensor.p1_electricity_consumed_peak_cumulative and sensor.p1_electricity_consumed_off_peak_cumulative (and maybe others) are reporting rounded kWh integers.

Is there a rationale behind this? The P1’s own interface is reporting kWh with a 2 decimal float precision, instead of the int in the plugwise component? I edited /plugwise/sensor.py line 383 (locally) and changed the int-function to float and the sensor readings are much more refined and now reflect P1 interface readings, without breaking anything in my set-up. utility_meter now also reports exact same values as the P1 interface.

I’m unfamiliar with GitHub, but tried to make a pull request, but got lost there. Am I onto something here?

Hi Jason it appears to be a known issue. @CoMPaTech submitted this PR already, which has your suggestion included.
At the moment it’s waiting for review and approval by the HA developers. Hopefully it will be accepted soon and be part of the 0.118 release.
Thanks for reporting.

Hi @mcormick!

There have been some revisions based on feedback by the community where the display of certain entities was changed. In a broader perspective, the P1 obviously only has a limited dataset, we select certain values from the XML output of the Plugwise devices and preselect those for interpretation. The python module mostly just forwards those readings (and as such you could ‘just change sensor’. The rationale for decisions lie are mostly personal at first, then corrected by the community (by people such as yourself). So if we cooked up something that needs improvement we’ll be (insert evaluation and such here, mostly) happy to oblige.

As @brefra indicates we have some outstanding PRs and a backlog of things to include in upcoming PRs. Specifically for kWh I’d deem it less neccesary to have it as a float, it would make more sense if we would offer a Wh? (As on the line indicated we indeed just /1000 the value). Is there a specific reason to have the Wh on display? For energy measurement I would suggest that the other measurements are present to indicate current usage and such?