Entities management in automation


I don’t understand the entity management in automations for my use case.

So, I have two bluetooth badges that are detected and I would like for them to activate/deactivate the alarm in case they are detected or not.

For the deactivation it was pretty straightforward as I just had to use the default or condition that is the default in automation state triggers, it gives something like that:

platform: state
  - device_tracker.nutale_2
  - device_tracker.nutale
from: bluetooth_le
to: home

Now I would like to have a new automation for when the two badges are in the “away” state only. So I tried to create an automation doing the same thing but I can’t change the trigger condition and end up with an or condition.

The final result is a strange loop of automation to activate/deactivate the security in case there is one badge away and one badge home.

I think I can maybe do something about that by adding a condition forcing the “and” that I can’t have in the triggers but is there a cleaner way to do that?

You mean you want something to happen as soon as both badges are away?

Create two triggers (or a combined one like you did above) and two matching conditions.

That way, either badge going away will trigger, but it’ll only pass the condition block if both are away.

In other words, the action will run when the second badge goes away.

Also, check your states — “away” in the front end is often a state of 'not_home'.

Ok, thank you, I thought of doing that but I was not sure it was the right way to do it.