Is the else part mandatory

Hi, I’m wondering if it is mandattory to have an else part in the if clause
Can I do it like this?

- if: "{{ states('sensor.lichtsensor_aussen_illuminance') | int(default=100) < 20 }}"
  then:
        - service: light.turn_on
          entity_id: light.eingang
          data:
            brightness: 220
            color_temp: 443
 - service: script.turn_on
   entity_id: script.update_blink_eingang
````

Only in jinja templates.

For the yaml test you are using it is optional.

https://www.home-assistant.io/docs/scripts#if-then

1 Like