Automation turns on / off the fan at a certain humidity difference between the two sensors. When calling the service, an error appears in the log. But automation works. Incorrect syntax? I ask for help.
Error executing script. Error for call_service at pos 1: Template rendered invalid service:
action:
service: >
{% if states('sensor.ble_humidity_a4c1385a4a7a') | int >= states('sensor.ble_humidity_a4c1388a4303') | int + 6 %}
switch.turn_on
{% elif states('sensor.ble_humidity_a4c1385a4a7a') | int <= states('sensor.ble_humidity_a4c1388a4303') | int + 4 %}
switch.turn_off
{% endif %}
entity_id: switch.ventvanna_2
The problem with doing it that way is that if the first condition is false, nothing will happen. Execution of the actions stops there. Use the choose action. Having none of the choices happen is valid and will not generate an error.