Hi There, We both have iPhones and Apple Watche’s, with my watch an LTE version. Sorry if this topic has been raised before, but i have searched and cant seem to find what im looking for!
I have the HA app on my phone, my partner does not want the HA app on her phone (she quilts all of her apps anyway, dont ask!). I have Private BLE setup for both our phones and watches.
I quite often go for a walk etc with just my watch, or I will leave my watch at home and just take my phone etc. Similar for my partner.
If i add both my HA app and watch ble entities as devices to track, if i leave my phone at home, it still has me as at home.
How the heck do i set it up so that if i leave home with a device, no matter what device, it sees me as away?
I assume you’d have to set up your own custom tracker either using device_tracker (see here) or mqtt (see here). I say this because as per here, a stationary device tracker (private BLE) has higher priority than a GPS-based tracker (your watch when out of the house), and will therefore always “win”.
Your own custom code could change this behaviour to give priority to a device that is not home.
Thanks for the reply. I have actually just done this and then setup an automation to update the device_tracker based on devices entering or leaving the home zone. I’ll see how it goes, but so far it looks good.
This seems like a pretty basic situation which requires the ability to setup in core rather this or templates etc?
So just for anyone searching for this in the future, I ended up using Private BLE for iPhones and Apple Watches as well as an HA virtual toggle in HomeKit using HomeKit automations to switch on and off. Then setup an automation as follows, which sets a device_tracker to home/not-home. What ever device leaves triggers away, whatever drive arrives home triggers home. It seems to work quite well so far, with the HomeKit triggering away first and BLE triggering home first.
If anyone has any suggestions, let me know.
alias: Simon Home Presence
description: ""
triggers:
- trigger: state
entity_id:
- device_tracker.simons_apple_watch_ble_2
from: home
to: not_home
id: away
- trigger: state
entity_id:
- device_tracker.simons_apple_watch_ble_2
from: not_home
to: home
id: home
- trigger: state
entity_id:
- device_tracker.simons_iphone_2
from: home
to: not_home
id: away
- trigger: state
entity_id:
- device_tracker.simons_iphone_2
from: not_home
to: home
id: home
- trigger: state
entity_id:
- input_boolean.simon_homekit_presence
from: "on"
to: "off"
id: away
- trigger: state
entity_id:
- input_boolean.simon_homekit_presence
from: "off"
to: "on"
id: home
- trigger: homeassistant
event: start
id: start
conditions: []
actions:
- choose:
- conditions:
- condition: trigger
id:
- away
sequence:
- data:
dev_id: simon
host_name: Simon Device Presence
location_name: not_home
action: device_tracker.see
alias: Set Simon as not-home
- conditions:
- condition: trigger
id:
- home
sequence:
- data:
dev_id: simon
host_name: Simon Device Presence
location_name: home
action: device_tracker.see
alias: Set Simon as home
mode: single
Ah sorry missed some stuff out of my config and mucking around with messages in the logbook as well.
home
- conditions:
- condition: trigger
id:
- start
sequence:
- action: logbook.log
metadata: {}
data:
message: >-
was set to "{{ states('device_tracker.simon') }}" at the time of
HA restart.
entity_id: device_tracker.simon
name: Simons Device Presence
enabled: false
- if:
- condition: device
device_id: 590b1b8f56b228999f90017b125064c9
domain: device_tracker
entity_id: 5a209a2a63554d394ae42a9345b829af
type: is_home
- condition: device
device_id: 8138b90e7c528215eba5a690fcad6e8c
domain: device_tracker
entity_id: eb5edc7f1466f22a52b76834fb2e2f9d
type: is_home
then:
- data:
dev_id: simon
host_name: Simon Device Presence
location_name: home
action: device_tracker.see
alias: Set Simon as home
else:
- data:
dev_id: simon
host_name: Simon Device Presence
location_name: not_home
action: device_tracker.see
alias: Set Simon as not-home