Hi, I’m a little confused.
As an example here two typical and simple sensors I use:
- platform: template
sensors:
throughput_in_kb:
friendly_name: Durchsatz in Kb
value_template: "{{ (states('sensor.network_throughput_in_eth0') | float * 1000) |round(1) }}"
outside_temperature_trend:
friendly_name: "Temperatur Trend"
value_template: >
{% if states('binary_sensor.outside_temp_rising') == 'on' %}
up
{% elif states('binary_sensor.outside_temp_falling') == 'on' %}
down
{% else %}
stable
{% endif %}
Now I’ve read in the docs, that value_template is not used anymore and can be replaced by value, which works in automations and scripts.
And I’ve read in the docs, that a template sensor is state based or trigger based like this example mentioned in the community docs:
template:
- sensor:
- name: "Average temperature"
unit_of_measurement: "°C"
state: >
{% set bedroom = states('sensor.bedroom_temperature') | float %}
{% set kitchen = states('sensor.kitchen_temperature') | float %}
{{ ((bedroom + kitchen) / 2) | round(1, default=0) }}
When I no replace “value_template” with “state” I get an error that state is an invalid expression. Even when I replace “value_template” with “value” it is the same error. So by now, I still work with value_template.
What did I misunderstood?