I migrate my old code to the new code, but I’ve an error that can’t solve…
in my configuration.yaml i’ve:
sensor: !include sensors.yaml
And in the sensors.yaml:
template:
- default_entity_id: sensor.aemet_dir_viento_texto
name: "Dirección viento"
state: >-
{% if ( states('sensor.aemet_wind_bearing') | float < 22.5 ) %}
Norte
{% elif ( states('sensor.aemet_wind_bearing') | float < 67.5 ) %}
Noreste
{% elif ( states('sensor.aemet_wind_bearing') | float < 112.5 ) %}
Este
{% elif ( states('sensor.aemet_wind_bearing') | float < 157.5 ) %}
Sureste
{% elif ( states('sensor.aemet_wind_bearing') | float < 202.5 ) %}
Sur
{% elif ( states('sensor.aemet_wind_bearing') | float < 247.5 ) %}
Suroeste
{% elif ( states('sensor.aemet_wind_bearing') | float < 292.5 ) %}
Oeste
{% elif ( states('sensor.aemet_wind_bearing') | float < 337.5 ) %}
Cierzo
{% else %}
Norte
{% endif %}
- default_entity_id: a_a_recibidor_planta_baja_estado
name: "Estado del A/A del recibidor de la planta baja"
state: >-
{% if ( states('sensor.medidor_corriente_a_a_planta_baja_power_a') | float > 0 ) %}
on
{% else %}
off
{% endif %}
- default_entity_id: a_a_rellano_1a_planta_estado
name: "Estado del A/A del rellano de la 1ª planta"
state: >-
{% if ( states('sensor.medidor_corriente_a_a_1a_planta_power_a') | float > 0 ) %}
on
{% else %}
off
{% endif %}
- default_entity_id: sensor.a_a_buhardilla_escaleras_estado
name: "Estado del A/A de la buhardilla y escaleras"
state: >-
{% if ( states('sensor.medidor_corriente_a_a_buhardilla_power_a') | float > 0 ) %}
on
{% else %}
off
{% endif %}
But now I’ve a new error: Invalid config for ‘sensor’ at configuration.yaml, required key ‘platform’ not provided.
I read the docs in Sensor - Home Assistant, and include as it’s says, but i’m wrong, sure, but I can’t find my mistake…
Anyone with the same problem?
Regards
Hello @tom_l ,
First of all, thanks for your quick response,and sorry for my late reply (I was sick).
I read about template.yaml, but I thought, it can works too in sensors (my fault).
After this change, works perfectly (I changed to binary_sensors the on/off sensors).
Thank you one more time for your time (and your patience).
Regards