kalkih / mini-graph-card

Minimalistic graph card for Home Assistant Lovelace UI
MIT License
2.87k stars 231 forks source link

Values wrong with grouping by hour to show max value #1020

Open wizbowes opened 8 months ago

wizbowes commented 8 months ago

I have a graph showing hourly rainfall. However sometimes the bars don't match the underlying data.

Here's the yaml:

type: custom:mini-graph-card
icon: mdi:weather-rainy
name: Hourly Rainfall
hours_to_show: 24
points_per_hour: 1
group_by: hour
aggregate_func: max
show:
  graph: bar
  fill: true
  icon: false
color_thresholds:
  - value: 12
    color: '#030ffc'
  - value: 7
    color: '#353ffc'
  - value: 5
    color: '#656dfc'
  - value: 3
    color: '#979dfc'
  - value: 1
    color: '#afb3fa'
  - value: 0
    color: '#ffffff'
entities:
  - entity: sensor.rainfall_hour
    state_adaptive_color: false

Here's the current output - as you can see the last hour with data is showing 1.5mm rain

image

However in the raw data you can see that it should be 0.5mm

image

Home Assistant 2023.10.3 Frontend 20231005.0 - latest Mini-Graph: v0.11.0

lowson commented 6 months ago

I also have issues with group_by: hour but using aggregate_func: diff

My source is a Helper Utility Meter that resets daily.

It seems like the usage only shows when there is 2 or more recording changes within an hour, it's not diffing the 0 -> 1 within any hour.

Here's the yaml:

type: custom:mini-graph-card
icon: mdi:gas-burner
entities:
  - sensor.gas_daily
name: Gas
line_color: Orange
group_by: hour
line_width: 8
font_size: 75
hours_to_show: 24
unit: m3
points_per_hour: 1
aggregate_func: diff
show:
  graph: bar

Delta also does the something no different

Screenshot from 2023-12-16 10-54-40