Open-Meteo Solar Forecast

Hello and thanks for the integration as well as the code to merge more than one sensor. I am experiencing a strange behavior on the Apex chart: the forecasted and remaining Wh differ.

It looks like the template sensor for today’s forecast is missing one string. Here is the template code for three strings:

    - name: "Energy Production today all (Template)"
      unique_id: energy_production_today_all
      state: >
        {{ (states('sensor.energy_production_today_3') | float(default=0) + states('sensor.energy_production_today_4') | float(default=0) + states('sensor.energy_production_today_5') | float(default=0)) | round(2) }}
      unit_of_measurement: "kWh"
      device_class: energy
      attributes:
        watts: >-
         {% set sensor1 = state_attr('sensor.energy_production_today_3', 'watts') %}
         {% set sensor2 = state_attr('sensor.energy_production_today_4', 'watts') %}
         {% set sensor3 = state_attr('sensor.energy_production_today_5', 'watts') %}
          {% set ns = namespace(output={}) %}
          {% for time, value in sensor1.items() %}
            {% set sum_value = value + sensor2[time] + sensor3[time] %}
            {% set ns.output = dict({time: sum_value}, **ns.output) %}
          {% endfor %}
          {{ ns.output }}
        wh_period: >-
         {% set sensor1 = state_attr('sensor.energy_production_today_3', 'wh_period') %}
         {% set sensor2 = state_attr('sensor.energy_production_today_4', 'wh_period') %}
         {% set sensor3 = state_attr('sensor.energy_production_today_5', 'wh_period') %}
          {% set ns = namespace(output={}) %}
          {% for time, value in sensor1.items() %}
            {% set sum_value = value + sensor2[time] + sensor3[time] %}
            {% set ns.output = dict({time: sum_value}, **ns.output) %}
          {% endfor %}
          {{ ns.output }}

and here the code for the remaining sum sensor:

    - name: "energy production remaining day (Template)"
      unique_id: energy_production_remaining_day
      state: >
        {{ (states('sensor.energy_production_today_remaining_3') | float(default=0) + states('sensor.energy_production_today_remaining_5') | float(default=0) + states('sensor.energy_production_today_remaining_4') | float(default=0)) | round(2) }}
      unit_of_measurement: "kWh"
      device_class: energy

I just double-checked that the sensors are available… Any idea why this happens?

New Release: Release 0.1.16 · rany2/ha-open-meteo-solar-forecast · GitHub

  • Improves cell temperature calculation (should reduce over/under-estimations)
  • Add damping support for morning and/or evening
2 Likes