system-flow-card icon indicating copy to clipboard operation
system-flow-card copied to clipboard

Rounding of values is incorrect

Open getget1980 opened this issue 2 years ago • 2 comments

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

getget1980 avatar May 09 '23 20:05 getget1980

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

  • name: "Propane 1 Level" unique_id: "mopeka_propane1_level" unit_of_measurement: "%" state: > {{ (states('sensor.mopeka_propane1_tank_level')|float / 23 * 100) | float }}`

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

flyrmyr avatar Jul 12 '23 21:07 flyrmyr

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

askpatrickw avatar Jan 02 '24 01:01 askpatrickw