I can´t get data_template with IF, ELSE working

Hi,
I want to have different brightness on my lamp depending on time.

My code:

I get this error code:

image

I can´t see why it´s not working.
Thanks

Delimit the template with double-quotes.

data_template:
  brightness: "{% if now().hour < 22 %} 255 {% else %} 56 {% endif %}"

or do this:

data_template:
  brightness: >
    {% if now().hour < 22 %} 255 {% else %} 56 {% endif %}

NOTE: If you wish, you can make the template more compact by using the inline version of an if-else statement.

data_template:
  brightness: "{{ 255 if now().hour < 22 else 56 }}"

Thanks. I will test whis tomorrow :blush:.