I am still not comfortable in configuration.yaml, is there something more I have to do in order to make this work?
That’s my sensor config for PVOutput.
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"
You need a customize.yaml file if you want the energy tab to pick up PVOutput sensors.
sensor.powerpal_output_total:
state_class: total_increasing
sensor.powerpal_output_actual:
state_class: measurement
To use a customize.yaml file you need to add the customize line to your config.yaml. (packages is unnecessary, although useful for making a PVOutput_Sensors.yaml etc)
homeassistant:
packages: !include_dir_named packages
customize: !include customize.yaml
Worth checking your logs too to occasionally you can cap out the hour limit on requests.
I’m having a hard time making this work, the sensors are not being created. I have created the customize.yaml, this is my configuration.yaml:
system_id: xxxx
api_key: xxx
- platform: template
sensors:
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" ```
Hmm that is my whole pvoutput_sensor.yaml. its in a separate package file. That shouldn’t matter if you are under the sensor spot in config.yaml. My dev tools output is below. You have restarted HA? any errors in the logs?
sensor:
- platform: pvoutput
system_id: YOUR_SYS_ID
api_key: YOUR_PVO_API_KEY
- 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"
Thanks, I had to clean my configuration-file, it was messy due to my lack of understandig how it works.
I’ve got it working now, thanks a lot!