As a newbie I am struggling with the syntax of HA configuration files for sensor templates.
I am running the following:
HA OS: 17.3
HA Core: 2026.6.0b0
Currently, my configuration.yaml includes the line:
sensors: !include sensors.yaml
And my sensors.yaml file is structured as follows:
platform: template
- sensor:
porteauto_g_etat_raw:
unique_id: "PorteAuto-G-Etat_Raw"
friendly_name: "Porte Garage G État Raw"
value_template: >-
{% if states('sensor.porte_garage_g_fermee') == 'unknown'
or states('sensor.porte_garage_g_ouverte') == 'unknown' %}
{{3}}
{% else %}
{{ int(states("sensor.porte_garage_g_fermee"))
+ int(states("sensor.porte_garage_g_ouverte")) }}
{% endif %}
porte_auto_g_etat:
unique_id: "PorteAuto-G-Etat"
friendly_name: "Porte Garage G État"
value_template: >-
{% set values = {0:'ouverte', 1:'entrouverte', 2:'fermée', 3:'inconnu',4:'inconnu'} %}
{{ values[int(states("sensor.porteauto_g_etat_raw"))] }}
Upon restarting HA, I am getting the following error message about the above:
Enregistreur: homeassistant.config
Source: config.py:352
S'est produit pour la première fois: 12:24:54 (1 occurrence)
Dernier enregistrement: 12:24:54
Invalid config for 'template' at sensors.yaml, line 2: 'sensors' is an invalid option for 'template', check: sensors
I tried several variations with the placing of the keywords 'template', 'sensor(s), indentation, etc., but I failed to find the correct one.
Could someone please help me correct my mistakes?
Thanks in advance!