Mini-graph-card: Data not correct when group by date

Created on 27 Apr 2020  路  12Comments  路  Source: kalkih/mini-graph-card

energy
Hi, awesome job on this card, really is good.

I have found what appears to be a bug. I use a card to show energy consumption using efergy energy monitor, that all works (i.e the efergy integration).

What I am finding is that if I group by date and remove hours_to_show: I get of course 1 day, and that day shows the correct kwh consumption (ie right now 25.42, i have that showing in another guage and also checked on the efergy cloud site, so it is correct. In the line chart it shows correctly when setup like that.

If I then put hours to show as say 120 (5 days) it gives incorrect values for the the nearest 4 hours and only actually correct on the 1st day, it shows 16kwh for today, even tho it is 25.42, and it is the same for all prior days, not the same value but out by a factor of almost half.

I have this:

align_state: center
entities:

  • color: '#66bb6a'
    entity: sensor.energy_cost
  • entity: sensor.energy_consumed
    group_by: date
    hour24: true
    hours_to_show: 144
    line_width: 1
    name: ENERGY CONSUMPTION
    show:
    fill: true
    graph: bar
    type: 'custom:mini-graph-card'

the alignment is all ok as the chart shows just fine,just wrong values on 5 of these 6 days,i have messed around with numbers of days to shows etc

I have attached a screenshot,, my daily usage is pretty consistant and about the same as the first bar in the chart. I have teamviewer/zoom etc if you wanted to ever see it first hand.

all the best
Darren

bug

All 12 comments

Same problem!

I have the same issue as well. The data behind the card is correct, but the group_by: date is displaying it incorrectly (interval and hours both work correctly).

I created a sensor to sum my GEM CTs, then feed that into an integration sensor to get kw, then use the Utility Meter.

Screen Shot 2020-05-06 at 12 38 15 AM
Screen Shot 2020-05-06 at 12 38 45 AM

Hello,
Please try using the aggregate_func: max option, the default aggregation is set to avg (average).

Hello,
Please try using the aggregate_func: max option, the default aggregation is set to avg (average).

Already using it:

- type: custom:mini-graph-card
  entities:
    - sensor.home_daily_energy
  show:
    graph: bar
  line_color: orange
  group_by: date
  aggregate_function: max
  hours_to_show: 240
  points_per_hour: 6

The aggregate function could explain OPs issues.

it shows 16kwh for today, even tho it is 25.42, and it is the same for all prior days, not the same value but out by a factor of almost half.

@fedebruni84
Need more data from you if possible

The aggregate function could explain OPs issues.

it shows 16kwh for today, even tho it is 25.42, and it is the same for all prior days, not the same value but out by a factor of almost half.

@fedebruni84
Need more data from you if possible

I have the same behavior, the card shows correct value (it's 0.4 kWh) but if I click on a single bar it's not correct, same thing for previous days

IMG_0468

IMG_0469

I tried aggregate_function: max no change. even using the same sensor gives different results on different cards.

Right now, on a guage card my sensor.energy_consumed shows 9.04kwh

on the mini-graph card it shows 8.73kwh, and loses throughout the day, by the end of most days I am around 25-30wh (according to the guage card AND the efergy cloud app but mini graph shows usually 14-16kwh for any given day, it only then seems to get it right on the last bar on the chart (last bar to the left, in my case 6 days ago, so looking at the bar for 6 days ago, it shows 29.87kwh, so the data is in there somewhere, it is just not calculating correctly.

aggregate function made no difference.

thanks
Darren

Already using it:

- type: custom:mini-graph-card
  entities:
    - sensor.home_daily_energy
  show:
    graph: bar
  line_color: orange
  group_by: date
  aggregate_function: max
  hours_to_show: 240
  points_per_hour: 6

You have misspelled the option name aggregate_function -> aggregate_func

Please do also try aggregate_func: last and see if that changes things.

yeah, aggregate_func: (spelt func not function) and putting it last has worked :-) thanks

aggregate_func: max worked for me as well. Thanks!

sorry its not fixed :-( checking this morning, new day, i have:

yesterday shows 27,95kwh (about right), today (fresh day) shows 27.15kwh but on the guage shows 6.37kwh - so the aggregate is causing other problems :-(

thanks

Was this page helpful?
0 / 5 - 0 ratings