PVOutput issues

Hello everybody,

After some trial and error I managed to get some sensors on the Lovelace UI.
Unfortunately I have some trouble with them. I spent some hours looking for the anser here in de community and other places on the Internet.
This is happening:

My overal sensor is displaying the right values (just like the ones I receive from PVOutput when I do an API call.
Schermafdruk%20van%202019-12-02%2011-41-04

But my individual sensors are displaying no data:
Schermafdruk%20van%202019-12-02%2011-41-33

This is my setup in configuration.yaml

sensor:
  - platform: pvoutput
    name: Zonnepanelen
    system_id: 28710
    api_key: *my API key*
    scan_interval: 300
  - platform: template
    sensors:
      power_consumption:
        value_template: >
          {% if is_state_attr("sensor.pvoutput", "power_consumption", "NaN") %}0{% else %}{{ state_attr('sensor.pvoutput', 'power_consumption') }}{% endif %}
        friendly_name: 'Using'
        unit_of_measurement: 'Watt'
      energy_consumption:
        value_template: >
          {{ "%0.1f"|format(state_attr('sensor.pvoutput', 'energy_consumption')|float/1000) }}
        friendly_name: 'Used'
        unit_of_measurement: 'kWh'
      power_generation:
        value_template: >
          {% if is_state_attr("sensor.pvoutput", "power_generation", "NaN") %}0{% else %}{{ state_attr('sensor.pvoutput', 'power_generation') }}{% endif %}
        friendly_name: 'Generating'
        unit_of_measurement: 'Watt'
      energy_generation:
        value_template: >
          {% if is_state_attr("sensor.pvoutput", "energy_generation", "NaN") %}0{% else %}{{ "%0.2f"|format(state_attr('sensor.pvoutput', 'energy_generation')|float/1000) }}{% endif %}
        friendly_name: 'Generated'
        unit_of_measurement: 'kWh'

Could someone give me a little help please?

Franklin

Are you sure that your “main” sensor is called sensor.pvoutput and not sensor.zonnepanelen?

look at the states page as well. Verify that your attributes are correct.

You are absolutely right. This is because I am not so good in programming but awesome in copying :crazy_face:
Problem solved, thank you very much.

Franklin

1 Like