How do I write a Condition Template to trigger an Action if an Automation was not triggered in a specific time?
Example. I know that this condition below will trigger an action if the Automation_2 was triggered in the last 15 seconds, right?
But how do you make the opposite of this condition? What if I want the Automation_1 to trigger IF Automation_2 was not triggered in the last 15 seconds?
That is asking if the actual state of the entity is equal to āhomeā.
That is asking what is the value of the entityās attribute āhomeā?
they arenāt the same thing.
As a matter of fact the second one will likely always be 0 because the if the attribute is not defined so it will default to 0 (which is what the int(0) does - it defaults the returned value to 0 if the value is not an integer).
And even if on the off chance that the entity did have an attribute called āhomeā itās likely not going to be a datetime object and so it canāt extract a timestamp from it. So again the value would default to 0.
Unless of course, the entity ādevice_tracker.iphoneā does actually have an attribute called āhomeā and it is in fact a valid datetime object then that will work fine.
But again those two values arenāt going to be the same.
the first will return a boolean (true/false) then convert it to a 0 because a boolean isnāt a number.
the second could be a valid timestamp depending on if the attribute is defined and is a valid datetime object or it could default to 0 if not.
What Iām trying to do is to avoid two phones to trigger an automation when both arrive home at the same time. Like if iphone_1 arrived first in the first 20 seconds, it will prevent iphone_2 to trigger the same automation if it arrives at home in less than 20 seconds from the time iphone_1 arrived home. And I think this is the easiest solution in my case.