* Use isExternalStatistic helper for consistency
* Remove redundant if condition
We have `band = drawBands && ...`, so there is no point checking if `drawBands` is true inside `if (band && ...)`.
* Skip plotting state value on statistic graph if units mismatch
For example plotting a *F sensor on a *C chart - statistic data will be converted to *C, but the state value will still be in *F so the displayed point is wrong. Similarly if plotting a kW sensor on a W chart, the same is true - statistics get converted to W by recorder, but the state value would still be in kW. In other words the plotted state point is complete nonsense.
If the units of the statistic state don't match the units of the graph, we should not be displaying the value on the graph.
* Remove redundant this.unit check
Co-authored-by: Petar Petrov <MindFreeze@users.noreply.github.com>
---------
Co-authored-by: Petar Petrov <MindFreeze@users.noreply.github.com>
* Preserve entity unit_of_measurement in gas and water flow rate badges
The gas and water total badges on the energy dashboard Now tab previously
converted all flow rate values to L/min and then formatted them as either
L/min or gal/min based on the unit system. This meant entities reporting
in m³/h or other units always displayed incorrectly.
Now the badges preserve the unit_of_measurement from the entities. If all
entities share the same unit, the raw values are summed directly. If they
differ, values are converted through L/min as an intermediate and displayed
in the first entity's unit.
* Extract shared computeTotalFlowRate to energy.ts
When displaying the "now" value on statistics graphs, don't include a "null" data point for sum/change type graphs, just skip entirely.
Otherwise for you get a messy null data point in the tooltip.
* Correct missing ha-tooltip CSS variable
We were missing a default for the `--wa-tooltip-border-width` variable which meant the arrow from the tooltip disappeared in WA 3.3.1.
* Fix tooltip in ha-slider
Skip fetching hourly statistics when hours_to_show < 1 since hourly
aggregates produce stale outlier points in sub-hour chart windows
(e.g. hours_to_show: 0.1 or 0.05).
Also fix Date object handling in ha-chart-base downsampling bounds
extraction.