I always get these found character ‘%’ errors. I wrote the code with VS code and the Jinja Yaml plugin. Everything looks good in the editor so far. I converted all tabs to spaces and indented each by 2 spaces. I don’t know where to go.
This is the automation script:
alias: "Dimm down Bath"
initial_state: 'on'
trigger:
platform: state
entity_id: group.bathroom_downlights
from: 'unavailable'
to: on
action:
service: light.turn_on
entity_id: group.bathroom_downlights
data_template:
brightness_pct:
{% if ((now().hour <= 6) or (now().hour >= 22)) %}
10
{% else %}
100
{% endif %}
This is the error:
Error loading /home/homeassistant/.homeassistant/configuration.yaml: while scanning for the next token found character '%' that cannot start any token in "/home/homeassistant/.homeassistant/automations/dimming_down_bahroom.yaml", line 13, column 8
What am I doing wrong?
Thank you for your help