Open-Meteo Solar Forecast

@andreas-bulling I am sorry if this is low-quality (I never used ApexCharts before and only installed it to help you out), but this seems to work fine:

type: custom:apexcharts-card
header:
  show: true
  title: ApexCharts-Card
  show_states: true
  colorize_states: true
series:
  - entity: sensor.energy_production_today
    data_generator: |
      return Object.entries(entity.attributes.wh_period).map(
        ([key, value]) => [new Date(key).getTime(), value]
      );

I’m surprised I haven’t heard of ApexCharts before, the graphs look REALLY good. (P.S. replace wh_period with watts to get 15-min power values instead).

2 Likes

Works - thanks a lot!

1 Like

thank you! much better now, here is my graph

Summary
type: custom:apexcharts-card
apex_config:
  chart:
    height: 350px
all_series_config:
  unit: ' Wh'
header:
  title: Solar forecast
  show: true
  standard_format: true
  show_states: true
  colorize_states: true
graph_span: 2d
span:
  start: day
  offset: '-0h'
now:
  show: false
  label: Now
yaxis:
  - id: kwh
    min: 0
    apex_config:
      tickAmount: 4
  - id: header_only
    show: false
series:
  - entity: sensor.pv_power
    name: Actual Power
    type: area
    float_precision: 1
    color: '#ff9800'
    opacity: 0.5
    stroke_width: 2
    yaxis_id: kwh
    unit: W
    extend_to: now
    show:
      legend_value: true
      in_header: false
    group_by:
      func: median
      duration: 5m
  - entity: sensor.energy_production_today
    yaxis_id: kwh
    type: area
    name: Forecast Power
    color: grey
    opacity: 0.3
    data_generator: |
      return Object.entries(entity.attributes.wh_period).map(
        ([key, value]) => [new Date(key).getTime(), value]
      );    
    show:
      legend_value: false
      in_header: false
    stroke_width: 2
    float_precision: 2
    extend_to: false
    group_by:
      func: median
      duration: 1m
  - entity: sensor.energy_production_tomorrow
    yaxis_id: kwh
    type: area
    name: Tomorrow
    color: light_grey
    data_generator: |
      return Object.entries(entity.attributes.wh_period).map(
        ([key, value]) => [new Date(key).getTime(), value]
      );
    show:
      legend_value: false
      in_header: false
    stroke_width: 3
    float_precision: 2
    extend_to: false
  - entity: sensor.solar_goodwe
    yaxis_id: header_only
    name: PV Today
    color: orange
    show:
      legend_value: true
      in_header: true
      in_chart: false
  - entity: sensor.energy_production_today
    yaxis_id: header_only
    name: Forcast Today
    color: orange
    show:
      legend_value: true
      in_header: true
      in_chart: false
  - entity: sensor.energy_production_today_remaining
    yaxis_id: header_only
    name: Remaining Today
    color: orange
    show:
      legend_value: true
      in_header: true
      in_chart: false
  - entity: sensor.energy_production_tomorrow
    yaxis_id: header_only
    name: Forecast Tomorrow
    color: grey
    show:
      legend_value: true
      in_header: true
      in_chart: false
4 Likes

Thanks a lot for this, do you mind if I add this to my README? It looks really sleek

offcourse you can add it :blush:

1 Like

you could add a

now:
  show: true
  color: red
1 Like

I’ll be sure to add that as well; very helpful! Thanks for bearing with me. I’m new to this ApexCharts thing

I’ll also use the watts attribute instead of wh_period in the README, I prefer to get the 15min data because the graph looks more smooth this way (and more information is always nice).

Is the difference between these two only the temporal resolution? Then I suggest a change in name - Wh denotes energy, W denotes power. These are two different things.

Wh_period attribute seems to be Wh generated in one hour, which is naturally the same value as the average W during that hour.I think the author of this integration is very well aware of the difference between the two units :stuck_out_tongue:.

I started using this integration a couple days ago and I still can’t believe how incredibly accurate it is. I was going to ask about having the inverter limit in there, but it was just added, perfect.

Now the only thing that’s causing noticeable differences between the forecast and my actual production is there overvoltage protection disabling the inverter, sadly this happens here regularly, especially during peak production. But that can’t really be estimated without a different source of data for the expected power demand and production in my area.

1 Like

No offense but if you frequently run into overvoltage protection then your solar system is not properly setup/designed. This should not happen.

1 Like

No offence, but I didn’t ask for your opinion. I think you don’t know what you are talking about.

Sure, have fun.

The name is different though, the attribute is called “watts” and is power at instant. It’s a bit confusing because the data is taken from an energy sensor, though.

wh_period is actually a bit different, it takes the average over a 15 minute period and then provides an estimate for Wh over an hour. The reason why I’m not returning data at 15 minute intervals for both is for compatibility with the old Solcast integration.

1 Like

Do we need it to be backwards compatible with Solcast integration? Thanks!

I don’t care, I was under the impression that people want the hourly data to do things they did with Solcast integration but if it doesn’t matter I could just… not do that.

Besides the ApexCharts thing, is there another use for these sensor attributes? If I return 15min data for wh_period, will it cause breakages?

I could do something like wh_period_15min, wh_period_hourly, watts. watts is unchanged and the change in wh_period is obvious from the name. Thoughts?

What a great job by Rany - thanks to him we are nearly there with a complete (and better) Solcast replacement !
Unfortunately, I have east/west PV arrays, so at the moment I have to use 2 instances of Open-Meteo solar forecasts.
I would like these combined into ONE display on the Apexcharts graph.
I am a complete novice when it comes to Javascript - anyone happy to supply the data generator code for the addition of the 2 arrays ?
Thanks

1 Like

I’m planning to provide some option to handle this configuration. The biggest hurdle for this is the config flow system in Home Assistant. I think in the worst case, I could allow it via configuration.yaml easily.

2 Likes