Script condition if else

Hi

Is there’s any chance I can set script condition like IF … ELSE … ?
For now if the condition returns false, so the script is finishing.
How I can continue with “else”?

When firing, my script should turn on one switch if sensor value X or turn on second switch if sensor value not X…

Thanks

There’s not a way to do this currently with straight-up YAML. You can achieve something along those lines with templates. You can use a service_template and some if/else logic within it to choose a script based on logic.

2 Likes

Figured out but firing 2 scripts with different conditions…

1 Like