Group stesments in template

Can somebody show an example how to group statesment in a template?
I want to have both lights off and time of day EITHER evening OR night

payload: >
        {% if is_state("light.fibaro_system_fgd212_dimmer_2_level_11_0", "off") and is_state("light.fibaro_system_fgd212_dimmer_2_level_12_0", "off") and is_state("sensor.day_night", "Evening") or is_state("sensor.day_night", "Night") %}

Use parentheses to group.

payload: >
        {% if is_state("light.fibaro_system_fgd212_dimmer_2_level_11_0", "off") and is_state("light.fibaro_system_fgd212_dimmer_2_level_12_0", "off") and ( is_state("sensor.day_night", "Evening") or is_state("sensor.day_night", "Night") ) %}
1 Like