Help to create a power generation prediction sensor

Hello, I would like to create a sensor that would show the predicted value of solar energy generation according to the month we are in. For example, January is expected to generate 500kw/h, February 520kw/h and so on. I wanted to create something that would automatically update according to the month we are in.

I guess you mean kWh (i.e. energy), not kW/h (that would be rate of change in power).

I think a template sensor should suffice.

template:
  - sensor:
      - name: "Power generation prediction"
        unit_of_measurement: kWh
        device_class: energy
        state: >
          {%
            set energy_in_month = {
              1: 500,
              2: 520,
              3: 0,
              4: 0,
              5: 0,
              6: 0,
              7: 0,
              8: 0,
              9: 0,
              10: 0,
              11: 0,
              12: 0,
            }
          %}
          {{ energy_in_month[now().month] }}

Forecast.Solar - Home Assistant (home-assistant.io)

1 Like