Solar Inverter "Daily yield" Graph

I just connected my Solar inverter to HA and want to plot daily yield as given by sensor. But i noticed data provided by sensor is very strange like in below picture.


It shows total yield for the hour at exactly 59th minute and becomes zero at 00th minute in every hour.

It obviously looks very bad in dahboard when i tried to plot using bar graph.

Can somebody explain me how to use only the value at 59th minute for the graph please? Im planning to use plotly-graph card.

I did scratch my head for quite a while wondering why you wanted to do this, rather than plot actual power, and then wondering how to go about doing it, but in the end it only took about five minutes to set up in apex charts.

First up - that is what ‘utility meters’ do. They record an ever increasing figure, and reset to zero every hour / day / week / month. The HA utility meter integration does this, and your inverter does it too. My inverter has a figure for total energy generated since it was first turned on, and a figure for this year, this month, today (as well as last year, last month, and yesterday). All done in the same way, track and reset on the hour / day / week / month / year. Not seen one for hourly yield before, but very easy to make one up.

As to plotting this on a sensible graph in Apex Charts card …

The secret seems to be

  • use the standard ‘from history’ graph plot of the ‘hourly energy’ sensor
  • group the data by (default) hour
  • use a group transform function max to get the largest value for the hour
  • use a series offset to shift the plot by 60 minutes to make the output timestamp match the end of the hour

This, rather to my surprise, works.

plotting utility meter hourly figures as a smooth curve in an apex charts card

There is for me a question of how the default ‘hour’ grouping works, and I am assuming that this is over a given time-hour 00 to 59 minutes (not a rolling 60 minutes), so the max value will always be the final one just before the hourly reset. This value is placed into the hour ‘bucket’ and is plotted at the start of the hour, hence the two graphs appear out of step by 60 minutes. To make them match, I am using a series offset -60 minutes, however it might be more appropriate to use -30 minutes. The graphs would not match, but the bucket value for the hour (the one you want) would be plotted around the middle of the hour. Something to experiment with.

During the solar day, I have to use “entend_to: false” so as to stop the graph from plotting beyond the last point. The end point will start at zero each hour, and rise to the maximum value at the end of the hour, so the last plotted point is always going to be dynamic.

solar hourly plot using apex charts card

I only use Apex charts card so I can’t help you with plotly, but this is the configuration I used. Obviously you can remove the direct entity plot and adjust the span to tidy the graph.

type: custom:apexcharts-card
header:
  show: true
  title: Solar Hourly Yield - Experimental Card
show:
  last_updated: true
graph_span: 24h
span:
  start: day
series:
  - entity: sensor.help_um_solar_by_hour
    curve: smooth
    name: Hourly
    show:
      legend_value: false
    extend_to: false
    stroke_width: 1
    color: blue
  - entity: sensor.help_um_solar_by_hour
    group_by:
      func: max
    offset: '-60min'
    curve: smooth
    name: Solar
    show:
      legend_value: false
    extend_to: false
    stroke_width: 2
    color: orange

Since I think that you wanted a bar chart, here is what I finally ended up with. Looks quite good I think.

solar hourly utility meter yield as bar chart in apex charts

type: custom:apexcharts-card
header:
  show: true
  title: Solar Hourly Yield - Experimental Card
show:
  last_updated: true
graph_span: 17h
span:
  start: day
  offset: +5h
series:
  - entity: sensor.help_um_solar_by_hour
    type: column
    group_by:
      func: max
    offset: '-60min'
    name: Solar
    color: orange

Hope that helps.

Thank you very much for detailed explanation. I exactly wanted that. :star_struck: