A few things…
- Assuming this is a direct copy from your config, you can’t have multiple definitions/iterations of
sensor:
- You need to watch your indentations which are crucial in HA. There are a few indentation issues with your code
- Either use
'{{states("sensor.sensorname")}}'
or'{{states.sensor.sensorname.state}}'
with a preference for the first one which will handle when your sensor has an unknown state instead of throwing an error
Try this:
sensor:
# Weather prediction
- platform: yr
- platform: solaredge
api_key: <snip>
site_id: <snip>
monitored_conditions:
- current_power
- energy_today
- energy_this_month
- energy_this_year
- lifetime_energy
- platform: template
sensors:
solaredge_energy_this_year_template:
friendly_name: 'SolarEdge This Year'
unit_of_measurement: 'kWh'
value_template: "{{(states('sensor.solaredge_energy_this_year') | float / 1000) | round(2)}}"
Check your config as there may still be indentation errors (typing from phone)