Lovelace custom Mini Graph Card - bar

After setting up my utility meter (power consumption - kWh), for day, week, and month, it was time to use the mini-graph-card.

I was hoping to display three mini-graph-cards. One card for daily having 360 bars displaying one bar for each day. One card for weekly having 52 bars displaying one bar for each week. And one for monthly having 12 bars displaying one bar for each month. -The cards may be limited with fewer bars where the last measurement is to the right in the card .

Turns out, when using the sensors with the mini-graph-card, it did not turn out how I expected. No wonder, since the utility meter sensors are topped up continually by the power consumption sensor (sensor.energy_consumption2).

So, I created three new template sensors, sensor.energy_hotwater_daily_end, sensor.energy_hotwater_weekly_end and e sensor.nergy_hotwater_monthly_end. This sensors gets their value when the utility meter sensors are reset for a new period, and the _end-sensors then get the attributes.last_period from the utility meter sensors. – Which did not work any better when it came to display the graph.

My question is, is it possible to achieve what I am looking for with the mini-graph-card, and if so, how?

####################################################
# UTILITY METER - ENERGY                           #
####################################################

energy_hotwater_daily:
  source: sensor.energy_consumption2
  cycle: daily

energy_hotwater_weekly:
  source: sensor.energy_consumption2
  cycle: weekly 

energy_hotwater_monthly:
  source: sensor.energy_consumption2
  cycle: monthly

####################################################
# ENERGY HOTWATER DAY/WEEK/MONTH TOTALS            #
####################################################
  - platform: template
    sensors:
      energy_hotwater_daily_end:
        friendly_name: 'Energy hotwater daily total'
        unit_of_measurement: 'kWh'
        icon_template: mdi:counter
        value_template: '{{ states.sensor.energy_hotwater_daily.attributes.last_period | float }}'
      energy_hotwater_weekly_end:
        friendly_name: 'Energy hotwater weekly total'
        unit_of_measurement: 'kWh'
        icon_template: mdi:counter
        value_template: '{{ states.sensor.energy_hotwater_weekly.attributes.last_period | float }}'
      energy_hotwater_monthly_end:
        friendly_name: 'Energy hotwater monthly total'
        unit_of_measurement: 'kWh'
        icon_template: mdi:counter
        value_template: '{{ states.sensor.energy_hotwater_monthly.attributes.last_period | float }}'
2 Likes

hey @Tomahawk, did you ever find a solution to this? Struggling with the same thing here.

There is no way to get long term data from HA without using Influxdb or some other database. By default HA stores its history for 10 days. That’s where the Mini Graph card gets its data from.
I have created a modified version of MGC together with Influxdb + Appdaemon to get daily power generation graph.
This is useful only if you have Influxdb and Appdaemon running.
Have a lookhere for a picture.