Both arrive home

Hello,

I am playing about with a trigger to turn on all lights when we arrive in the Home zone, but it must be when we both change from away to home. I thought it was this but I just tested it and when my wife was already home and mine went from away to home, it triggered all lights to come on… I just want it when both switch… any ideas please? cannot believe I was a cobal programmer 20 years ago… my brain is just mush now :frowning: :slight_smile:

alias: ‘Switch on all lights when we both arrive home’
hide_entity: True
trigger:

  • platform: state
    entity_id: group.all_devices
    from: ‘not_home’
    to: ‘home’

condition:
condition: time
after: ‘16:00:00’
before: ‘22:00:00’

action:

  • service: light.turn_on
    entity_id: group.all_lights
    data:
    rgb_color: [255, 255, 255]
    brightness: 254
  • delay:
    minutes: 3
  • service: light.turn_off
    entity_id:
    • light.dining_room_light
    • light.bedroom_light

I believe this is caused by you using the group all_devices. A group is known to switch to home when only one device is home.
In the triggers entity_id you should name all devices separated by a comma. In the condition part add a template to check if none of the devices is at home.

Ahhh makes sense, thank you!!

That’s very odd. I have a group called group.family that contains the device tracker entities for my wife and myself. The automations I’ve written trigger when group.family changes from ‘not_home’ to ‘home’ and I haven’t had any issues with them triggering if one of us is already home. They only trigger for whoever gets home first. The same goes for one of us leaving and the other staying home.

You may want to add both devices to a group other than all_devices and try that before resolving to add extra conditions to all of your automations.

thanks will give that a shot…

After reading your question again, it seems i misunderstood it a bit. Bahnburner is correct this should have worked. The first one arriving home should trigger the lights and the second one shouldn’t do anything because the group state is allready ‘home’

thanks guys, just starting to get to grips with the basics and after loads of hassle with presence detection, I think I am getting there… presence detection is still flaky as we are both working from home today and we get the odd 10 second drop out from both gps logger and nmap, so it says we are away for 0 minutes… my wifi set up I am guessing is the issue, as I have 2 routers 2 wifis but both using the same SSID, so it roams nicely… I might look to change than.

You should add consider_home: 300 to your device tracker configuration, specifically nmap. It will assume you’re home for 5 minutes (300 seconds) after you’ve left, or disconnected, which helps eliminate those random dropouts. Obviously you can adjust the delay however you see fit, but 300 seconds is what works for me.

good idea… thank you!