When you open the UI automation tool you always get a If then block first after the trigger. How can I get a then do block before the if block? I want something to always happen when the automation runs and then I want some conditional things to happen. Thank you for your comments, they are appreciated.
Automations only tun after a trigger. If no trigger, it doesn’t run.
You may be looking for a script.
When you call a script, it always runs.
There is a UI editor for scripts as well.
@Sir_Goodenough thank you for your response. No I do want a automation that has a trigger. I just don’t want a condition to be have to be met also.
For example, a door opens the hallway light always goes on but if it’s night time the kitchen light also goes on. In this scenario there’s no if condition for the hallway light but there still is a trigger that the door opened. The kitchen light is only going to go on if the door opens and it’s night time.
Well think thru the logic then.
You do want the trigger, so the door opens and the stuff starts happening.
In this case you DO NOT want a condition, so that (And If) stays blank.
You do always want
So that is your first action (Then Do).
You then wast this to happen sometimes:
So for your next {Then Do} you select a choose statement.
These start with a condition, so put your ‘if it’s night’ logic there and the action for that do your ‘turn on the kitchen light’.
My issue here turns out to be with the UI. Leaving something “blank” just seems wrong to me. I want to manipulate the default UI in a way that is not possible. In order to get what I want I have to first make a “Then do” and only then can I add an “If Then block” after that which is effectively an “And if” for which there is no such option under “ADD BUILDING BLOCK”.
I understand why the UI is presented this way to help a new user understand the basic concept but there are no such building blocks such as “And if” and “Then do” which creates confusion to the newbie. The alternative? Not really sure at this point. When I get more familiar with HA maybe I will.
There is a reason that ‘(optional)’ is behind ‘And if’. It can be left blank.
If you use the ‘And if’ then it is for the whole automation. But you only want part of the automation to be IF’d. So that goes in the ‘Then do’.