Mini-graph-card: Add more group option alternatives: week, month, quater e.t.c.

Created on 13 Mar 2020  路  17Comments  路  Source: kalkih/mini-graph-card

Hi,

it would be great if you could add support for month and quarter fr the group_by parameter.
I would use this getting a graph for power metering.

Best,
Michael

feature request

Most helpful comment

let's assume you have a sensor for realtime power usage (in W).

sensors:
  - platform: template
    sensors:
      power_instantaneous:
        unit_of_measurement: W
        value_template: "{{ states('sensor.actual_consumption_sensor') | round() }}"
        entity_id: sensor.actual_consumption_sensor
        device_class: power

then with the integration component you can create an energy sensor (in kWh):

  - platform: integration
    source: sensor.power_instantaneous
    name: energy_total
    unit_prefix: k
    unit_time: h
    method: left
    round: 2

Then with the utility_meter component you build the sensor that have the data for your mini-graph-cards:

utility_meter:
  hourly_energy_kwh:
    source: sensor.energy_total
    cycle: hourly
  daily_energy_kwh:
    source: sensor.energy_total
    cycle: daily
  weekly_energy_kwh:
    source: sensor.energy_total
    cycle: weekly
  monthly_energy_kwh:
    source: sensor.energy_total
    cycle: monthly
  quarterly_energy_kwh:
    source: sensor.energy_total
    cycle: quarterly
  yearly_energy_kwh:
    source: sensor.energy_total
    cycle: yearly

So it would be great if mini-graph-card would support all of utility_meter's cycles, so maybe instead of:

group_by: date

we could have

  group_by: hour    # or
  group_by: day     # or
  group_by: week    # or
  group_by: month   # or
  group_by: quarter # or
  group_by: year

as mentioned before here, right now only daily is doable:

  - type: custom:mini-graph-card
    name: energy today
    icon: mdi:transmission-tower
    entities: [sensor.daily_energy_kwh]
    hours_to_show: 168
    aggregate_func: max
    group_by: date
    points_per_hour: 24
    hour24: true
    show: {graph: bar}

All 17 comments

I just recognized that year also would be great to have.

I agree, right now I cannot do graph with utility meter other than daily.

It woul be great an aggregation function 'inc' that stays for last-first. I want use it to know consume in a day, in a week, in a month etc

I'd also love to see this. I'd like to graph by day, week and month with one point per unit in bar form.

Great idea ! upvote

Hi, I'm also looking for this feature.
I need to monitor my water/electricty consuption by day/month/year.
If someone has already a solution in home assistant to do that please let me know.

up!

Probably with 0.94 versione we will have a similar functionality, with new aggregation function "delta".
But it's long time a wait for it.

let's assume you have a sensor for realtime power usage (in W).

sensors:
  - platform: template
    sensors:
      power_instantaneous:
        unit_of_measurement: W
        value_template: "{{ states('sensor.actual_consumption_sensor') | round() }}"
        entity_id: sensor.actual_consumption_sensor
        device_class: power

then with the integration component you can create an energy sensor (in kWh):

  - platform: integration
    source: sensor.power_instantaneous
    name: energy_total
    unit_prefix: k
    unit_time: h
    method: left
    round: 2

Then with the utility_meter component you build the sensor that have the data for your mini-graph-cards:

utility_meter:
  hourly_energy_kwh:
    source: sensor.energy_total
    cycle: hourly
  daily_energy_kwh:
    source: sensor.energy_total
    cycle: daily
  weekly_energy_kwh:
    source: sensor.energy_total
    cycle: weekly
  monthly_energy_kwh:
    source: sensor.energy_total
    cycle: monthly
  quarterly_energy_kwh:
    source: sensor.energy_total
    cycle: quarterly
  yearly_energy_kwh:
    source: sensor.energy_total
    cycle: yearly

So it would be great if mini-graph-card would support all of utility_meter's cycles, so maybe instead of:

group_by: date

we could have

  group_by: hour    # or
  group_by: day     # or
  group_by: week    # or
  group_by: month   # or
  group_by: quarter # or
  group_by: year

as mentioned before here, right now only daily is doable:

  - type: custom:mini-graph-card
    name: energy today
    icon: mdi:transmission-tower
    entities: [sensor.daily_energy_kwh]
    hours_to_show: 168
    aggregate_func: max
    group_by: date
    points_per_hour: 24
    hour24: true
    show: {graph: bar}

This feature will be add?

+1

I'd love that too (BTW thanks few the great job)

up! please ;-)

+1

Any idea if it's planned to be implemented?

+1 here

Would love to see this!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hajo62 picture hajo62  路  6Comments

brezuicabogdan picture brezuicabogdan  路  5Comments

QkulleQ picture QkulleQ  路  7Comments

skarfacegc picture skarfacegc  路  7Comments

PipeDeveloper picture PipeDeveloper  路  4Comments