Device tracker status 'home' when away

And can you please share this automation that generates the notification when she is at home? I am curious to see what entity it is using.

You got me intrigued as to how it was working :slight_smile:

No problem:

- alias: Rachel Home
  id: rachel_home
  description: ''
  mode: single
  trigger:
  - platform: state
    entity_id: device_tracker.iphone_r
    from: not_home
    to: home
  condition:
  - condition: time
    after: '09:00:00'
    before: '20:00:00'
  action:
  - service: notify.mobile_app_iphone_m
    data:
      title: Rachel's Home
      message: ' '
      data:
        image: /local/rachel.png

Ok, you are using the device_tracker which is correct.
I did a small test to check how the companion app works. I am currently at home so my status shows “Home”. I disconnected my phone from wifi and disabled mobile data (or simply put it on airplane mode) expecting to see that my location will be “unavailable”.

To my surprise it didn’t. It still shows me as “Home”. That means, that Home assistant keeps the last known location to the device entities. But now this gets even more confusing as the notification should not work. If your gf is at “Home” and then she leaves out of the network and HA keeps the last location, it will always be “Home”. So the trigger to your automation (changing from not_home to home) is never met.

This is what’s confusing me now. The dashboard always used to change, when she left the house to show ‘Away’, then change to ‘Home’ when she returned and the notification automation was triggered every time. Also, the state Dev Tools>Template with {{ states('device_tracker.iphone_r') }} would change from ‘Not_home’ to ‘Home’.

As mentioned, it’s only the last 2-3 days that it’s not worked as it always has. I’ve checked my config and there are no templates set up to track and I never have set any up.

I’ve made zero changes in the last 3 days to any files apart from light automations that have no device tracking included in them anyway.

I’ve just put my phone in airplane mode but the dashboard is still showing me as ‘Home’ whereas before whenever I did the same as a test, it would show me as ‘Away’.

:confused:

You are using MAC adress to track the phone. That means you are not using companion app.

Here is my washing machine, it’s also home but it does not have the companion app installed.

That code shows false for tracking in known_devices.yaml, so it shouldn’t use that as a device tracker should it?

@c0ntax - What Hellis81 said above is true. You are not using the mechanism of the companion app location reporting for this home/away business. So, at this point, we likely could drop anything around the companion app from the equation / from the discussion.

To double check the statement above, please go to developer tools → states, find your device_tracker.iphone_r and device_tracker.iphone_m entities, and show us a couple of screenshots when the iphones being home, away, airplane mode but home, airplane mode while physically moving from home to away etc…

With those checks and screeenshots, we will then narrow down on what to do next.

To start off, below is the phone status when in airplane mode. Still showing as home:

Untitled

EDIT: Also continues to show the exact same above when not in airplane mode at home.

Open up the entity or take a screenshot as I did. What is the source of the entity

It shows ‘GPS’ in my last screenshot and confirmed in the below:

How many device_tracker entities do you have? Could you help do the same screenshots on all of them?

Also, the lat/lon of those entities with source_type: gps typically would change from time to time, in my case would shift within 10-30 meters - all around my house.
So, if you are turn off wifi (or under airplane mode) while at home, would the position of the iphone stops “jittering”…?

Yes, co-ords do change slightly over time.

I have just one more device tracker, an iPad. It though shows router as source:

source_type: router
latitude: xx.xxxxxxxxxx
longitude: xx.xxxxxxxxxx
gps_accuracy: 0
scanner: BTSmartHubScanner
friendly_name: Martin’s iPad

Apologies, I can’t find the correct way of entering code in the correct format using iphone as it doesn’t seem to have the required quote mark.

Companion app settings for both iPhones state ‘connected via INTERNAL URL’ but the iPad states via EXTERNAL URL. Not sure if that helps?

I think I’ve resolved this issue, or it appears to work now, at least.

After some ‘messing about’ and investigation of my set up, I found that since upgrading my iPhone to iOS 16 my phone had reverted back to using Apple’s Private WiFi address. This was something I turned off around a year ago but, essentially, it had changed the MAC address to the private one, instead of the device MAC.

source_type now states Router and shows devices Home or Away as expected.

Thanks everyon for the help and input.

1 Like