Help with splitting up automation using multiple entity_id

Hi guys,

I used this automation to trigger a telegram notification and to turn of all lights when me and my gf left the house.
I tracked mine and my gf phone.

 - alias: All of when away
    hide_entity: false
      platform: state
      entity_id: group.all_devices
      to: 'not_home'
      - service: light.turn_off
        entity_id: group.all_lights
      - service: notify.telegram
          message: 'Iedereen is weg, alle lampen zijn uit!'

It worked great using the group.all_devices entity. But! now that i added more devices it doesn’t work anymore because some of the added devices are always on (pi-hole etc).

So wat i want to do is split up the two phones from the rest of the devices.

What would be the best route?

Using multiple entity’s in the automation or to create a new group with only the phone’s?
If the best choice is multiple entity’s, how do i add these to the automation?

      platform: state
      entity_id: Device 1
      entity_id: Device 2
      to: 'not_home'

Make a list…


Is it really that easy… Stupid me. Will test it


You can also create a list with commas but it gets a bit ugly

entity_ID: entityid1, entityid2,

But will it trigger if any of the devices changes to not_home, or if all?

Edit: Now the automation works again but if my phone goes to not_home with my gf’s phone still on home, it triggers… I need it to trigger only when all phones are Not_home.

Is that possible?

Woops, sorry, I misunderstood what you were looking for.

You can create a group with the devices you want to track. If any of them are home it will make the group home. Once all of them are gone it will report not_home.

Then use the group name as your entity ID.

No problem! Thanks for helping.

The thing is that is what i thought about first. But i have my phone, laptop and desktop in the same group already.

    name: Apparaten
      - device_tracker.iphone_XX
      - device_tracker.XXX_iphone
      - device_tracker.desktop
      - device_tracker.laptopwerkv
      - device_tracker.laptop_werk_n
      - device_tracker.nexus_7

For example the laptops and desktops are set to:

      hide_if_away: true

So if we are both home and no computers are turend on the card only shows our phones. But when i turn on my Desktop it shows it on the card.

Maby if i make the group like you said and split my frontend using the default_view i can add the two separate cards to both the default_view and to the group.Apparaten. Then i only use the new group for the automation.

If that makes any sense :sweat_smile:

Can you keep the same setup you have working but create a new group to replace group.all_devices? The new group could only contain you and your gf device trackers.

You could also use the hidden function in customize to hide the group.

I think it will still work with the automation(s) but now show on your front end.

1 Like

Yes but i want to keep the card were all my other devices show in the same card.

Woow thats not a bad idea. Going to test it. brb.

Edit: @silvrr Works like a charm… Thanks man

Hi all. Great topic. I am trying to setup an automation with an “or” trigger - if a single phone enters the home zone (via iCloud tracker), turn on the front lights.

To clarify the use of multiple entity_id’s, a group (entity_id: group.phones) is treated a single entity (e.g. they all must enter the home zone) versus listing all the phones individually (entity_id: device_tracker.phone1, device_tracker.phone2) in which case a single phone entering the home zone will trigger the automation.

Is this correct?