I have a few old automations that are designed to unlock my front door, or open my garage door, depending on how I leave. If I ride my bike or car, it opens my garage, if I leave via front door, it opens the front door. Pretty simple. Except!!! I did this in pieces, so it’s 2 separate automations. One detects my phone entering the “home zone”, the other detects an event firing (iOS triggered the event via ‘shortcuts’)

There is now “zone based” automations, and there is also my “person entity”. So the way I see it, I have 3 different ways to tell when I come home:

  1. My phone’s gps enters the ‘home zone’

  2. My HA ‘person’ state changes from ‘away’ to ‘home’

  3. My phone’s shortcut app fires an event that is detected.

I feel like #1 and #2 are the same, no? I only have one device linked to my person entity, and it’s my phone. Is there any difference in this case? Is there a preferred choice?

  • Censed@lemmy.zip
    link
    fedilink
    English
    arrow-up
    4
    ·
    2 days ago

    Personally I’m against automating the garage door opening and it’s too easy to have false flags open it when I don’t need/want it open and end up having a open garage in the middle of the night bc my gps it away status blipped for some reason.

    • Lemmee@sh.itjust.worksOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 days ago

      I agree with this, but I also have an automation that alerts me when the door opens, and when it’s been open longer than 5 mins. I also have a condition on my garage door openings that stop them without confirmation if it’s after sunset.

    • Lemmee@sh.itjust.worksOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 days ago

      I agree with this, but I also have an automation that alerts me when the door opens, and when it’s been open longer than 5 mins. I also have a condition on my garage door openings that stop them without confirmation if it’s after sunset.

  • AbouBenAdhem@lemmy.world
    link
    fedilink
    English
    arrow-up
    17
    ·
    3 days ago

    Using your person state makes it easier to update HA when you get a new phone, especially if you have a lot of automations that use it.

    • Lemmee@sh.itjust.worksOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      3 days ago

      Ooh. That’s a great point.

      I just did some digging and it seems something is wrong with my phone or person detection because it don’t notice that I left for the gym this morning.

      I guess that needs troubleshooting as well. Maybe having multiple triggers increases the robustness of the automation?

      • dono@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        3 days ago

        If you use background location, or even just the geofencing in the location settings of the Homeassistant App then it wont work if you have Network location disabled in Android. After some research i found out that in newer versions of Android it wont use gps at all for background location. This tripped me up for some time since (i think) Grapheneos has this disabled by default (or i disabled it idk). After enabeling this again everything worked reliably.

        • Lemmee@sh.itjust.worksOP
          link
          fedilink
          English
          arrow-up
          1
          ·
          3 days ago

          I’m on iOS, and I’ve got ‘always on’ enabled for location services. It has worked pretty much flawlessly until this weekend, so I’m guessing something got borked, and I need to do some updating in some places.

  • SayCyberOnceMore@feddit.uk
    link
    fedilink
    English
    arrow-up
    7
    ·
    edit-2
    3 days ago

    I have multiple zones: home and almost-home (same center coordinates, just larger diameter)

    This allows the house to “get ready” before someone is actually home, ie trigger lights to come on earlier.

    It also helps with random GPS jumps.

    Then, when the wifi connection is slow (maybe low phone battery) and people are literally outside the door, there’s no awkward pauses before someone actually “arrives”.

    I also have zones for our work places, intending to be used as a double-check, ie not-home isn’t usually good enough, I want the house to know we’re all at work and then the internal house cameras come on, etc.

    I also have a “visitors” flag, so that if friends / family are in and we leave, then the TV and lights don’t turn off and they’re not attacked by the laser robots…

    Also, (from memory) the person entity can be a combo of GPS and ping sensors to ensure it’s a correct reading

    • Lemmee@sh.itjust.worksOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      3 days ago

      I do like the idea of different triggers for different zones. Especially zones for commonly visited locations (work, gym, grocery, etc). I really don’t have many automations that trigger by my presence/absence, as all my lights are pretty much automatic. I like the house to look like I’m home, even if I’m not.

      This has brought up another issue I have been battling - my ‘home’ zone refuses to be resized… I shrink it down, and literally the next time I leave, it triggers at the same damn spot, and when I open my config, it shows the same size circle. I think I just need to do some cleanup and updates to my system. It’s been a while.

      • SayCyberOnceMore@feddit.uk
        link
        fedilink
        English
        arrow-up
        1
        ·
        2 days ago

        Yeah, the home zone is somewhat… different Zones

        I do most of my config in yaml and all the zones are configured in a separate file, however, the home zone has (had? I’ve not checked in years) to be configured in configuration.yaml under the homeassistant: section.

        You should be able to do something like:

        homeassistant:
          latitude: 12.3356
          longitude: 1.23456
          radius: 50
        

        If you’re configuring zones from the UI, I think editing the file should still work.

        • Convict45@lemmy.world
          link
          fedilink
          English
          arrow-up
          1
          ·
          12 hours ago

          I’m new to HA so let me make sure I understand. Are you saying that setting up zones in the UI isn’t enough to get them to work?

          • SayCyberOnceMore@feddit.uk
            link
            fedilink
            English
            arrow-up
            1
            ·
            9 hours ago

            I’m from ye olden times, when everything was done in the yaml configuration files - so I prefer that approach.

            The zones you create from the UI, work fine.

            It’s just that the default “home” zone appears to have some quirks that can only be set from configuration.yaml

  • spaghettiwestern@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    3
    ·
    edit-2
    3 days ago

    Shelly makes tiny smart switch modules that fit inside any switch box and are cheap enough to put at each door. In combination with the Bermuda BLE Trilateration integration they can detect where in (or near) the house you are. Ours are used to turn on lights and disable camera alerts before they can trigger. It’s amazing to have the inside and outside lights come on when we’re 30’+ away and haven’t even stopped the car or when we get close to the house after taking a walk. They provide some great functionality in addition to BLE for less than $20.

  • eco_game@discuss.tchncs.de
    link
    fedilink
    English
    arrow-up
    4
    ·
    3 days ago

    My router (FRITZ!Box) provides entities for all network devices, whether they are currently connected to the network or not.

    I trigger all my stuff on when my phone connects/disconnects to my home WiFi. For me this is the best, simplest and least error prone way.

    For your use case this would mean needing to have WiFi reception outside your house / in front of your garage, and having your phone reliably and quickly connect to the WiFi when you get home, which might not work great, depending on the strength of your WiFi outside your house.

    • Lemmee@sh.itjust.worksOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      3 days ago

      I had this same setup with my Eero router integration, but I found that if my laptop or desktop was accidentally left on, and the sleep timer was inactivated, HA would think I was home. So I’m just using GPS of my phone to do my person stuff now.

      • eco_game@discuss.tchncs.de
        link
        fedilink
        English
        arrow-up
        1
        ·
        2 days ago

        That sounds like you had your Home Assistant person entity tied to your computers too. If you just go off of your phone’s presence, your laptop or desktop really shouldn’t have any effect on that.

  • Munkisquisher@lemmy.nz
    link
    fedilink
    English
    arrow-up
    3
    ·
    3 days ago

    I have a Bluetooth beacon in my letterbox to help detect I’m coming home. It’s a bit of distance and WiFi doesn’t reach that far, so I can tell if I’m coming home or leaving based on sequence. The mobile app will report on beacons to HA

  • lowspeedchase@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    1
    ·
    3 days ago

    I personally use OpenWRT on my router for this task - When a device connects it calls a webhook (local network) which cascades multiple calls depending on the MAC of the connecting device, e.g. open the front gate + raise/lower the house temperature (temperature sensor dependent), illuminate the driveway (time of day dependent) for all devices, send WOL packet to my desktop and HTPC (only for my MAC addy), etc.

    I like having the automations linked to something with a high degree of security, local sensors like bluetooth or NFC are too easy to spoof imho if you are automating locks and the like.

  • MuttMutt@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    3 days ago

    I do something similar with node red and some lights. It’s all based off of person.xxxxxxx locations.

    If I was going to try and do something based on if a vehicle was used then I would probably attach Bluetooth trackers to the car and bike and use those for particular automations. There will be a little bit of a delay while the system before the door opens or closes until they connect up and it will require a Bluetooth AP connected to HomeAssistant but it gives finer grained control. But you would need to do checks that both your phone and something else entered the area to prevent the door from also unlocking.

    Or you could use use you phone as a Bluetooth beacon/tracker and set something based on its last seen location before leaving.

    Setting up with each device tracked also gives you the opportunity to give warnings if they leave without your phone as well as to use crowd tracking if they do.

    • Lemmee@sh.itjust.worksOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      3 days ago

      That’s pretty much what I do now. But I don’t care if I leave via bike or car, just depends if I leave through the garage door, or the front door. So I have a helper that gets toggled if the garage door closes and I leave the house zone within 10 mins. Then when I return, I want to just use one trigger, and have an if/else that looks at the state of the helper toggle. I really have been operating with the “if it aint broke, don’t fix it” mentality. But when things break, I like to take a look at the whole landscape, and see if I can make some larger improvements when I fix it. That’s what prompted this – I got home and my garage door didn’t open.