mini-graph-card icon indicating copy to clipboard operation
mini-graph-card copied to clipboard

Add more group option alternatives: week, month, quater e.t.c.

Open Moneybox76 opened this issue 4 years ago • 26 comments

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

Moneybox76 avatar Mar 13 '20 11:03 Moneybox76

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

Moneybox76 avatar Mar 16 '20 08:03 Moneybox76

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

dzikus avatar Mar 16 '20 12:03 dzikus

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

finix77 avatar Mar 18 '20 17:03 finix77

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.

tungmeister avatar Apr 13 '20 15:04 tungmeister

Great idea ! upvote

gw1gw1 avatar Apr 29 '20 20:04 gw1gw1

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.

ced1442 avatar May 22 '20 21:05 ced1442

up!

dzikus avatar May 29 '20 09:05 dzikus

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.

finix77 avatar May 29 '20 09:05 finix77

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}

tbrasser avatar May 30 '20 21:05 tbrasser

This feature will be add?

shirou93 avatar Aug 03 '20 07:08 shirou93

+1

robinostlund avatar Aug 04 '20 10:08 robinostlund

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

utkiupe avatar Aug 20 '20 07:08 utkiupe

up! please ;-)

Kirorus avatar Sep 25 '20 11:09 Kirorus

+1

rcsmota avatar Sep 30 '20 08:09 rcsmota

Any idea if it's planned to be implemented?

dragouf avatar Oct 12 '20 09:10 dragouf

+1 here

joristhiels avatar Nov 14 '20 09:11 joristhiels

Would love to see this!

wltng avatar Nov 23 '20 17:11 wltng

+1, usefull feature

And the ability to use color_thresholds option in bar charts would be so nice too !

allacArneo avatar Dec 11 '20 14:12 allacArneo

Very much looking for this.

tecknojock avatar Dec 13 '20 05:12 tecknojock

+1 this would be awesome :)

chivagio avatar Dec 14 '20 22:12 chivagio

+1 here, too. Would love to see that! :)

guevara777 avatar Dec 15 '20 17:12 guevara777

+1

xrado avatar Jan 13 '22 19:01 xrado

Please avoid commenting a +1 but instead use the :+1: reaction to indicate your support.

That being said, this is something we'll look in to during the configuration update (next release).

Do note that the available history might be limited by HA itself, thus it might depend on #641 to actually be useful.

jlsjonas avatar Jan 23 '22 18:01 jlsjonas

Can Date.getMonth (https://www.w3schools.com/jsref/jsref_getmonth.asp) be used at https://github.com/kalkih/mini-graph-card/blob/071f649861efcc320f2f1e960368abcb48102190/src/main.js#L987-L1000

Which places must be modified to set a grouping interval? Is it correct that the biggest change might be the points_per_hour setting as this is not constant for the different months?

feanor12 avatar Apr 01 '22 21:04 feanor12

+1 would love what @tbrasser shared here https://github.com/kalkih/mini-graph-card/issues/302#issuecomment-636386722

KidA001 avatar Dec 03 '22 07:12 KidA001

Half-hourly would also be useful, Electricity is often priced by the half hour, so this would allow plotting of consumption/charging in line with periods of different pricing.

In the UK at least, it is possible to consume electricity based on wholesale half-hour pricing, but also use simpler peak/off-peak tariffs. Those tariffs can run for example between 00:30 to 04:30, so again half-hourly makes sense.

The utility meter suggestion shown above is a good one, though some custom config is required for half-hourly with utility meter, so simply mirroring utility meter may not be helpful for half-hourly (unless utility_meter adds half-hourly - weirdly it offers quarter-hourly!).

andynash avatar Mar 22 '23 08:03 andynash