Template sensor for first time

Hi all. I try to make a template sensor and in the Template editor it’s working great.
In the ‘configuration.yaml’ I have added
template: !include_dir_list template , then make ‘sensor_name.yaml’ file in template folder. Here is the code:

- sensor: 
    - name: "Battery PV Percentage"
      icon_template: "mdi:battery-charging-high"
      unit_of_measurement: "%"
      state: >
        {% if states('sensor.bank_1_total_voltage') | float(0) > 28.7 %}
        {% else %}
        {{ ((states('sensor.bank_1_total_voltage') | float(0)-22.5) / 0.062) | round(0) }}
        {% endif %}

When I check the Configuration Validation the result is Configuration valid!
When I check for entity ‘battery_pv_percentage’ it doesn’t exist.

Can you help me fix that, please?

Are you sure you don’t want to use:

template: !include_dir_merge_list template/

I will try that. Thanks for your reply!

Thank you. :+1:

1 Like