kalkih / mini-graph-card

Minimalistic graph card for Home Assistant Lovelace UI
MIT License
2.96k stars 232 forks source link

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

Open Moneybox76 opened 4 years ago

Moneybox76 commented 4 years ago

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 commented 4 years ago

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

dzikus commented 4 years ago

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

finix77 commented 4 years ago

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

tungmeister commented 4 years ago

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.

gw1gw1 commented 4 years ago

Great idea ! upvote

ced1442 commented 4 years ago

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.

dzikus commented 4 years ago

up!

finix77 commented 4 years ago

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.

tbrasser commented 4 years ago

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}
shirou93 commented 4 years ago

This feature will be add?

robinostlund commented 4 years ago

+1

utkiupe commented 4 years ago

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

Kirorus commented 3 years ago

up! please ;-)

rcsmota commented 3 years ago

+1

dragouf commented 3 years ago

Any idea if it's planned to be implemented?

joristhiels commented 3 years ago

+1 here

wltng commented 3 years ago

Would love to see this!

allacArneo commented 3 years ago

+1, usefull feature

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

tecknojock commented 3 years ago

Very much looking for this.

chivagio commented 3 years ago

+1 this would be awesome :)

guevara777 commented 3 years ago

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

xrado commented 2 years ago

+1

jlsjonas commented 2 years ago

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.

feanor12 commented 2 years ago

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?

KidA001 commented 1 year ago

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

andynash commented 1 year ago

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!).