Configuration of state in automation

Hello,

I have tried to understand the documentation around automations, but there is something that I can’t understand how to do…

I am setting up an automation where I get a warning if my front door is opened while I am away.

  • The trigger is when a door sensor is in the state Open.
  • The condition is connected to the NMAP state of my phone. The options I have is Home, Away, Unknown and Unavailable.
  • The action is set to notify my phone.

The issue I have is that if I choose the state ‘Away’ in the condition setting it works for a while, but then after a while being away that state changes to Unavailable - and the consequence is that I don’t get the notification.

But if I set the condition to Unavailable in the condition, the notification doesn’t work in the time span where the phone is in the state Away.

I can see that when I choose a trigger I have the option to chose the state either ‘from’ or ‘to’ a specific state, and that would work since I could choose ‘from Home’ to cover both scenarios. But when setting a condition I don’t have the choice to set ‘from state’ or ‘to state’.

How could I get around this problem?

I would like to mention that I use the NMAP integration because other methods don’t work for me since the GPS and other phone information seem to be extremely unreliable when updating HA. I have tried both geolocation with GPS and various WiFi related settings.

Thank you!

There are multiple ways to address this depending on the available entities and integrations.

One option, using basic components, is to use a Not condition, then nest your NMAP integration state under that, but set the wanted state to be “Home”… that way any non-home value will cause the Not to pass.

That’s because conditions are a snapshot in time, they do not wait around for events/changes to happen. If the condition isn’t true at that moment, it fails. There is no “from”, nor a “to”… just “is” or “is not”

1 Like