To check if overnight backup was running well I intended to create a binary sensor. After some trial and error the Syntax check in the Developer was running well with result type: String and an expected “1”
{% if ("now().day", "states.sensor.samba_backup.attributes.last_backup[8:-6]") -%}
1
{%- else -%}
0
{%- endif %}
If I enter this as state in configuration.yaml under template / binary_sensor
- name: samba_ba
unique_id: binary.sensor_samba_ba_ok
state: >-
{% if ("now().day" , "states.sensor.samba_backup.attributes.last_backup[8:-6]") %}
1
{% else %}
0
{% endif %}
device_class: update
I get an error for the first state line starting: {% if (…
"missed comma between flow collection entries at line 178, column 10:
{% if (“now().day” , “states.sens …
^…”
Do you have an idea what is missing and why it works in the template check but not in the config ?
Thank you for your help.