The use of automations with the new app 2021 I think deserves a separate thead to point out the new things that can be done and how to do them correctly. Also to comment on experiences about its local operation and others functions.
If someone wants to move to another category or change the title, feel free
I will start with the correct use of the Precondition. When migrating automations from smart lighting I have seen that it has its peculiarities and some do not work as I thought they would.
I have come to the conclusion, I do not know if it is true, that the precondition looks at the state of the device and does not trigger with a state change event as Conditions do. An example:
I want to migrate a smart lighting automation: IF X door is opened and the Z light is off Then the Z light turn on and turn off after 1 minute.
Three ways to do it and only one works well:
- With the condition Door X open AND light Z is OFF: It works bad:
- The Z light comes on when the door is opened, but turns ON in a loop when the Z light goes off and the X door still open.
- With Precondition Door X Open : It works bad:
- The light never comes on when the door is opened
- When you turn off the Z light, it turns on again in a loop while the door is open.
- With Precondition the Light Z off: Works Well
- The Z light only comes on when the door is opened and the Z light is off.
- If the Z light goes off, it does not come back on until the door is closed and reopened.