PV Output templates not longer working?

Have been using te pvoutput platform for quite some time in hassian. I change a month ago to hassio and the pvoutput platform worked perfect. And it still does because in the state overview I still see sensor.pvoutput with all the values. But suddenly all my template sensor do not work anymore. The only change I made is adding a custom-card for a wind compass in my www directory.

What went wrong ??

- platform: pvoutput
  system_id: xxxx
  api_key: zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
  scan_interval: 180

- platform: template
  sensors:
    power_generation:
      value_template: '{% if is_state_attr("sensor.pvoutput", "power_generation", "NaN") %}0{% else %}{{ states.sensor.pvoutput.attributes.power_generation }}{% endif %}'
      friendly_name: 'Generating'
      unit_of_measurement: 'Watt'
      icon_template: >-
          {% if states('sensor.power_generation')|float < 50 %}
            mdi:weather-night
          {% elif states('sensor.power_generation')|float < 1000 %}
            mdi:weather-partlycloudy
          {% else %}
            mdi:weather-sunny
          {% endif %}

    energy_generation:
      value_template: '{% if is_state_attr("sensor.pvoutput", "energy_generation", "NaN") %}0{% else %}{{ "%0.2f"|format(states.sensor.pvoutput.attributes.energy_generation|float/1000) }}{% endif %}'
      friendly_name: 'Generated'
      unit_of_measurement: 'kWh'
      icon_template: >-
          {% if states('sensor.power_generation')|float < 50 %}
            mdi:weather-night
          {% elif states('sensor.energy_generation')|float < 10 %}
            mdi:weather-partlycloudy
          {% else %}
            mdi:weather-sunny
          {% endif %}
          
    tempdif2:
      value_template: '{{(states.sensor.temperature_zonnecollector.state | float | round(1)) - (states.sensor.temperature_zonneboiler.state | float) | round(1)}}'
      friendly_name: 'Temperatuurverschil'
      unit_of_measurement: 'ÂşC'


    tempdif7:
      value_template: '{{((states.sensor.temperature_zonnecollector.state | float ) - (states.sensor.temperature_zonneboiler.state | float)) | round(1) }}'
      friendly_name: 'Temperatuurverschil'
      unit_of_measurement: 'ÂşC'
      icon: mdi:thermometer

what do your logs say?

Thanks for replying to my question.
The log said that there was an error in tempdiff7, and that “icon” should not be used.

After removing the icon statement the template works again…

So I made a change…,…which cause that all the sensor templates did not work anymore.

so you fixed it?

Yes, I did.
Thanks

1 Like