Is there an “easy” way to create an automation trigger that requires a combine ms condition to trigger?
Specific;
Trigger:
There is still solar energy over
AND
The car is already charging
Action;
Increase charging power.
Or generic
Trigger
A AND B
Action
C
I can of course create an automation with both conditions as triggers and then add both as a condition.
Generic
Triggers
A (implit OR)
B
Condition
A AND B
Action
C
The problem with the latter approach is that it is less readable and in the tracing the automation gets fired a lot which is not needed.
So is there a more ‘easy’ approach?
Note I found an old thread that concluded on the approach to put logic in the conditions (like I described); but i am looking for a more easy approach.
A helper is an approach but I dont think there a GUI supported way to create a conditional helper.
The state trigger from “on” to “off” can stay in the triggered state “off” indefinitely, where a condition can check it. And conditions are AND logic by default. So…
I tried to explain something about when the trigger will occur, but I could not formulate the text good enough.
I deleted the posts, so the confusion is less.
that is not true:
In this case I am checking if a power consupmtion is above a certain threshold: Once it reaches the threashold, the trigger is not fired as long as the power is not going below the threshold again.
Or differently: the trigger is not checking when a variable in the condition is changing.
Note: at least this is how I understand triggers and conditions ;-). If I am wrong, can you point to where this is in the documentation?
needs careful thinking to decide exactly what the triggers are. You’ll need to rethink your logic. This might be a rare occasion where a “check every x minutes” is appropriate. Something like:
I do not think so. There are two ways the situation can occur: the solar production increases while the car is charging, or the car starts charging while the solar production is already high enough to cover it. Maybe you could throw in HA restarts, that’s it.
As said: this is harder to read -especially when you list of condition is bigger), and the automation gets triggered a lot (making checking what happened more difficult as it gives a lot of ‘traces’ when A or B happen a lot).
And also: when in the time between the triggered is fired, the conditions change (for example triggered from A and A becomes untrue when checking the condition -is this possible? in the framework is the thread of an automation first reading all the variable before applying the logic or is it only reading the variable when needed?), I might miss a ‘trigger’.
I can agree this is for the logic I want to implement not relevant (as I don’t care about short lived events here). But I believe formally
Trigger A
Trigger B
Condition A is true
Condition B is true
Action C
is not the same as
Trigger A AND B
Action C
(since as said A and B can change when we go to checking the condition).
It is rather the other way; of solar excess > 0W for 1 minute or so… then increase charging power.
Some of my power consuming machines have a very heratic behaviour that making it important that the excess has been ‘stable’ for some time.
I require anyway a logic because part of the logic of increasing the power (and the decrease) requires access to an integration that only allows a limited number of calls per day.
The HA automation setup might not be perfect, but changes have huge effects, so what you might see as a logic improvement will be step back for many others.
HA is open, so there are other options.
I think you can use something like pyscript for a writing in Python, or you could use NodeRed with a catch all event node connected to a function node where you are using JavaScript to write the code.