What is the intended location / zone meant to be when the iPhone is switched off?
If for example when I am home the Wi-Fi, Bluetooth and IOS device trackers all say Home, but then when I switch my iPhone off the Wi-Fi and Bluetooth device trackers for it both change to Away but the IOS device tracker still says Home
Shouldn’t the state of an IOS device tracker device change to Away / not_home too after some sort of timeout of the phone being switched off?
I have added all three device trackers to a group and then use Home / home and Away / not_home states of the group to try and give a more accurate indication of home or away, but when the phone is switched off at home the IOS device tracker keeps the group state as home which potentially gives false positives
Thanks @silvrr, this is my experience also, but I think this is not the best behaviour for IOS GPS location tracking, but I don’t know whether this behaviour is intended or is a bug.
@geekoftheweek , I have my iPhone with all three, so my router is tracking my phone if home or away via wifi, a Bluetooth adapter is tracking my phone if home or away via Bluetooth and the IOS app is tracking the GPS location and zones through the IOS App.
I would have thought the home assistant should have a timeout also on the IOS App location to revert to something, possibly not_home / away should there be a reasonable time for which it has not received any location data?
If say you have two phones both setup in Home Assistant and both with the IOS app, then you turn one off one day whilst at home and decide to turn on the 2nd phone and take that out with you that day, the 1st phone, and therefor you, would then still be registered as home and mess around with automations.
The iOS App only transmits an update when you break the zoned geofence or you make a significant location change (as per iOS SDK), so it’s going to think you are still at whatever location it last updated indefinitely. It won’t update or notify HA if say WiFi is shut off, phone turned off, or HA doesn’t hear from it in X amount of time. This is predominately a battery saving option as the iOS app would have to be transmitting / checking in with HA on a regular basis as a keep alive or update it’s location to HA. It would still transmit based on it’s location, so the phone would still send it’s current GPS via Mobile service.
If you have 2 phones both with the same name in the iOS app and therefore know_devices.yaml? If that was the case whatever phone last update would then become the one that changes the setting. Typically you wouldn’t want two phones registered to the same name, could have issues. Not even sure why you would want to do something like that. I guess you could, but both phones could have the ability to send an update to HA location and whichever one last updated would be the one active.
Still not 100% sure what you are going for here, if you just want to manually set your device as away you can do that via the device_tracker.see
Replying to one specific bit of your post: You could set up a timer on Home Assistant to push a location update request to the phone if it’s not heard from in X minutes/hours. If it fails to respond within a minute or two then you can probably assume it’s offline or turned off.
Specifically for me where this behaviour is not aligned with my situation is for night time automations / conditions.
In our house we have always switched our mobile phones off when we go to bed, so now with Home Assistant I am using this trigger / condition to indicate when we have gone to bed as part of automations, such as if after x time of day and all devices away/not_home for y amount of time turn off z. But with using the IOS tracker in the group of devices this never goes from home to not_home so these conditions are never met.
To clarify, I have two phones, one for personal and one for work, they have different names and setup completely separate from each other with their own unique entities in Home Assistant. When I am not working and go out I will leave my work phone at home switched off, but this then still registers as home
Sounds like it would be a good option for me, to push a location update request on a timer (using appdaemon) if not heard from for a while (not sure if it is possible to check last time location was updated) and if Wi-Fi and Bluetooth are not_home for the same device.
@robbiet480, as you are doing a major update of the app atm, could it be an option to add an option to push location every x minutes?
(as a little side note, I upgraded to IOS 12 and it seems location updates via the Home Assistant app are much quicker now and detecting entering and exiting zones)
That’s a really one off situation, I’ve never heard of anyone who shuts down their phones every night. You might try doing a bedtime routine,I do one similar with a boolean I toggle on with HA or Echos. Other option would be to track to see if the devices goes offline via another methods see’s it as offline for an update via an automation.
Tracking two phones shouldn’t be all that crazy, I would group them then automate on the group being either home or not_home. Still would be tough to get them to register as home not_home with one devices always seeming to be at a different location. The whole point of device_trackers is to report where a device is, this is definitely a creative work around situation as they’re all working as they were intended, saying a device is home when it is, etc. Doable yes, just need to get creative with the automations.
Not sure adding regular interval updates is a good idea, that battery impact can be pretty big. Even then if the phone was shut off, it will just report it’s last known location so wouldn’t exactly fix your scenario.
Yes I think you are right, setting device state of the IOS device depending on wifi / BT would be the way forward for my case, with the IOS integration as is.
I would rather have something completely automated to enter an everyone asleep state.
Personally I would not want to rely on remembering to press something to trigger a sleeping state, but would rather something automated to trigger something like your bedtime.yaml
Not sure what to do with the two phone thing, might just take the work phone out of the group for now.
Adding a regular interval to update on the IOS app might not be for everyone, but if there was an option which was off by default where we could switch it on, maybe even with an input for minutes for the interval then this would at least help my case, maybe more people.
I wouldn’t have thought that it would be too much of an impact on battery if an auto push update happens every 30 minutes or so. plus if it was an option it could be down to the end user to select more frequent updates over battery life if it is more important to them than an extra hour or so between charges.
It would be even better if Home Assistant considered the IOS device not_home when it has not had input for location for some time, this I think might resolve the issue for me.
@jwelter, I guess we switch our phones off at night due to part habit and part turning off as no longer needed on and saving power. if someone needs to get hold of us they can / will ring the land line.
Regular update interval isn’t possible due to iOS limitations. However, you can get a very close proxy to that by enabling background fetch updates. Be warned though that the time between fetches is directly correlated to how often you open or interact with the app. I use the app all the time so I get updates at least once a hour sometimes as short as every 15.
As an alternative, with Siri Shortcuts you’ll be able to set up a voice triggered “good night” shortcut which as one of it’s steps can fire a event to HASS which automations can pick up on.
Also agreed about I’ve never heard of anyone turning phone off at night. I recently started using Do Not Disturb along with Bedtime and it effectively does turn the phone off. No notifications except specific apps I allow (Home Assistant for security, PagerDuty for work) and only phone calls from trusted contacts are allowed in. Might want to investigate that.
that’s a shame. I think though making a request to get the location if wifi and bt is away and then setting the IOS device to away if no response should do the trick.