flyrmyr / system-flow-card

A system flow card inspired by the official Energy Distribution card for Home Assistant
41 stars 2 forks source link

Rounding of values is incorrect #51

Open getget1980 opened 1 year ago

getget1980 commented 1 year ago

Hello, first thanks for your work.

Should add a way to set elements values in kW or W as input, and kW or W to display (and calculate).

Some of my sensors are in W (no problem), but others are in kW, and values are rounded to the closest integer.

As a result, power calculation is not good and values are unreadable.

Also, if using an extra, should be able to determine also how to round the value (see atached image, for the dishwasher and washing machine), or at least set a trigger value to display not null values.

image

Here the result is incorrect.

Compare to my other flow (values are good on this one) image

Solar shows 0, because value is 0.2kW, rounded to 0. Grid shows 1kW because value is 0.640kW

Center value should display 2180w

flyrmyr commented 1 year ago

The first thing I'm seeing is that some of these values are kWh, which is an energy (power over time) measure, while kW / W is just a power measurement. So those two cant really be compared without calculating from the difference over time.. kWh just accumulates steadily over the period (day?) while kW would fluctuate based on live usage.

Since this is a "measured thing" agnostic card, I was hoping to avoid hardcoding specific units and calculating on them. I'm not sure I could compile a good list of every measurable unit and write calculations.

My hope was that people could either use the new HA feature of entity units to make them all the same unit:

Screenshot 2023-07-12 at 3 15 45 PM

Or write templates to force them all to be the desired standard unit: `# Template additional Mopeka sensors

Please let me know how this works for you and hopefully helps!

askpatrickw commented 8 months ago

Another angle on this... the card doesn't reflect the suggested_display_precision set on a MQTT Sensor.

HA Blog Feb 2023 The number of decimals used when displaying a sensor state is now configurable