PROBLEM
Jump directly to “SOLUTION/SUGGESTION” if bored!
Before introduced to Home Assistant half a year ago I used to implement my customized automations via a few SIEMENS Logos. For those who don’t know: This devices are equipped mostly with a handful of digital (and/or analogue) inputs and relay outputs, extendable via modules. The programming inbetween is based mostly on logic modules (such as AND, OR, NOR etc.) as well as time function blocks (time delay, impulse etc) and so on.
After installing Home Assistant I integrated these Logos via Modbus and moved some of the automations to Home Assistant while others are still done by the Logos to preserve a basic independency.
While working with Home Assistant I noticed that sometimes doing automations is a bit complicated because there could be a confusion between triggers and conditions.
I wanna give you an example:
I want to be the climate preset be ‘comfort’ when I am at home between 1 P.M. and 10 P.M., otherwise it should be ‘eco’. I want it also to be ‘eco’, if any window is open.
Here we go:
- When I am at home at 1 P.M. already, the heat schedule is the trigger;
my home state and the closed window states are the confirming conditions. - When I come home later, my home state is the trigger;
the heat schedule and the closed window states are the confirming conditions. - When I open any window and close it again, the window state change becomes the trigger
and so on. I think you got the idea.
And, of course, the opposite state changes (me leaving home, heat schedule runs out or any window state changes to ‘open’) should be the trigger to change the climate preset back to ‘eco’.
Just for comparison: To implement this very automation via Logo would just have been:
Combining my ‘home’ state, the heat schedule and each window’s ‘closed’ state via AND function, the output would be the climate preset (1 = comfort, 0 = eco). Done!
Another example:
I also use the window state to switch on a little signal light next to the front door via automation to remind me to close the window again before leaving the house. So the light has to be on if any window is open.
To automate this in Home Assistant I had to create two automations:
Automation No. 1: Any window state is set as trigger (change to ‘open’) to turn on the light.
Automation No. 2: Any window state is set as trigger (change to ‘closed’) as well as condition (state ‘closed’) to turn off the light. (Without the conditions the light would be turned off by closing any window even if other windows are still open!).
Again for comparison: To implement that very automation via Logo would just have been:
Combining the ‘open’ states of each window via OR function, the output would be the lamp. Done!
SOLUTION / SUGGESTION
So I’d like to suggest to add a new type of Automation, the “Condition based Automation” without triggers and just conditions that are permanently (or optional periodically) checked. You can interlace multiple layers of logic functions to make any constellation desired.
Because of the missing trigger we now need two actions to configure:
The ‘Action when the result of the conditions turn to TRUE’ and
the ‘Action when the result of the conditions turn to FALSE’.
Because of that I’d like to have a little switch to link both so that, if turned on, every action entry I add to one of the action fields will appear reversed on the other field automatically.
So if I add the ‘Turn light x on’ entry to ‘Action when […] the conditions turn to TRUE’,
the ‘Turn light x off’ entry will automatically be added to ‘Action when […] the conditions turn to FALSE’.