Trying to get through templating. Followed an example for template sensor - but with no luck. All i get is a
homeassistant.components.sensor.template: UndefinedError: ‘sensor’ is undefined
- platform: template
sensors:
takeoff_landing:
friendly_name: 'Takeoff and landing'
value_template: >-
{%- if sensor.dark_sky_wind_bearing > 200 and sensor.dark_sky_wind_bearing < 300 %}
Landing
{% elif sensor.dark_sky_wind_bearing > 40 and sensor.dark_sky_wind_bearing < 120 %}
Takeoff
{% else %}
Other runway
{%- endif %}
Yes thank you. Learnt my lesson here. Impressive the amount of things that can be done on HA with ease. Now have almost everything moved from OH2.
Sensor finished up like this.
- platform: template
sensors:
takeoff_landing:
friendly_name: 'Takeoff and landing'
value_template: >-
{%- if states('sensor.dark_sky_wind_bearing') | int > 200 and states('sensor.dark_sky_wind_bearing') | int < 300 %}
Takeoff
{% elif states('sensor.dark_sky_wind_bearing') | int > 40 and states('sensor.dark_sky_wind_bearing') | int < 120 %}
Landing
{% else %}
Other runway
{%- endif %}