#─────────────────────────────────────────────────────────────────────────────── # Description: #─────────────────────────────────────────────────────────────────────────────── # Card to display solar production forecast for the next 24 hours including # details on energy import and export rates. # # A sensor with the hourly weather forecast stored as attributes is required. # As of version 2024.4, the weather integration no longer includes forecast data # as attributes. A new template sensor must be created to get the forecast data. # See more here: # # https://community.home-assistant.io/t/update-from-using-weather-attributes-with-the-new-service-weather-get-forecasts/702736/1 # # Solar forecast is based on the Solcast integration: # # https://github.com/oziee/ha-solcast-solar # # Energy import and export rates are based on the Energi Data Service # integration: # # https://github.com/MTrab/energidataservice #─────────────────────────────────────────────────────────────────────────────── type: markdown content: > {%- set import_rates = "sensor.import_rates" -%} {%- set export_rates = "sensor.export_rates" -%} {%- set solar_forecast0 = "sensor.solcast_pv_forecast_forecast_today" -%} {%- set solar_forecast1 = "sensor.solcast_pv_forecast_forecast_tomorrow" -%} {%- set hourly_weather = "sensor.weather_hourly" -%} {% if (state_attr(hourly_weather,"forecast")[0].datetime | as_datetime | as_local).hour != now().hour -%} {% endif -%} {% for w in state_attr(hourly_weather,'forecast') -%} {% set h=w.datetime | as_datetime | as_local -%} {% if h.day==now().day -%} {% set d='I dag' -%} {% else %} {% set d='I morgen' -%} {% endif -%} {% if d=='I dag' %} {% else %} {% if (state_attr(import_rates,"tomorrow_valid") == true) and (state_attr(export_rates,"tomorrow_valid") == true) %} {% else %} {% endif %} {% endif %} {% endfor -%}

Tidspunkt
Timepris for
køb / salg
Estimeret
produktion
Nu {{ "%.2f"|format(state_attr(import_rates,"raw_today")[now().hour].price)}} / {{ "%.2f"|format(state_attr(export_rates,"raw_today")[now().hour].price)}} {{"%.0f"|format((state_attr(solar_forecast0,"detailedHourly")[now().hour].pv_estimate*1000))}} W
{{ d }} {{w.datetime | as_timestamp | timestamp_custom('%H.00', local=True) -}}{{ "%.2f"|format(state_attr(import_rates,"raw_today")[h.hour].price)}} / {{ "%.2f"|format(state_attr(export_rates,"raw_today")[h.hour].price)}} {{ "%.0f"|format((state_attr(solar_forecast0,"detailedHourly")[h.hour].pv_estimate*1000))}} W
{{ "%.2f"|format(state_attr(import_rates,"raw_tomorrow")[h.hour].price)}} / {{ "%.2f"|format(state_attr(export_rates,"raw_tomorrow")[h.hour].price)}}{{ "%.0f"|format((state_attr(solar_forecast1,"detailedHourly")[h.hour].pv_estimate*1000))}} W