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
trigger:
platform: state
entity_id: group.all_devices
to: 'not_home'
action:
- service: light.turn_off
entity_id: group.all_lights
- service: notify.telegram
data:
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?
trigger:
platform: state
entity_id: Device 1
entity_id: Device 2
to: 'not_home'
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.
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.
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.
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.
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.