I want to know when to switch my electricity contract from summer to winter based on when my average solar PV generation for the week ahead is less than my average consumption for the past week. Using the Solcast integration I have created this template sensor which appears to pass all format and pre-restart checks:
- sensor:
- name: "Solar PV Forecast Week Ahead"
unit_of_measurement: kWh
unique_id: solarpvforecastweekaheadavg
device_class: energy
icon: mdi:sun-clock
state: >
{{ ((states('sensor.solcast_pv_forecast_forecast_today')|round(2)
+ states('sensor.solcast_pv_forecast_forecast_tomorrow')|round(2)
+ states('sensor.solcast_pv_forecast_forecast_day_3')|round(2)
+ states('sensor.solcast_pv_forecast_forecast_day_4')|round(2)
+ states('sensor.solcast_pv_forecast_forecast_day_5')|round(2)
+ states('sensor.solcast_pv_forecast_forecast_day_6')|round(2)
+ states('sensor.solcast_pv_forecast_forecast_day_47)|round(2)
) /7)|round(2)}}
The template works in the developer tools
But no sensor is created. There is nothing obvious in the logs. How can I debug this? TIA