Hi,
I am new to Home Assistant and try to compensate wrong values of Sonoff SNZB-02 with an offset.
Therefore I wrote following Code in the developer tool which is working.
sensor:
- platform: template
sensors:
{% set min_value = 25 %}
rf_wohnzimmer_korrigiert:
{% if (states('sensor.temperatursensor_wohnzimmer_humidity') | float > min_value) %}
unit_of_measurement: '%'
value_template: "{{ states('sensor.temperatursensor_wohnzimmer_humidity') | float - 20.0 | float }}"
{% endif %}
Output is value_template: “43.8”.
If I add this code in the configuration.yaml it produces errors:
sensor:
- platform: template
sensors:
{% set min_value = 25 %}
{% set min_value = 25 %}
rf_wohnzimmer_korrigiert:
{% if (states('sensor.temperatursensor_wohnzimmer_humidity') | float > min_value) %}
unit_of_measurement: '%'
value_template: "{{ states('sensor.temperatursensor_wohnzimmer_humidity') | float - 20.0 | float }}"
{% endif %}
Error message:
Error loading /config/configuration.yaml: while scanning for the next token
found character ‘%’ that cannot start any token
- in “/config/configuration.yaml”, line 38, column 6*
I don’t know what I did wrong. Could someone give me advice please?
Thank you in advance,
Ben