Multiple Presence components, single Presence Sensor

I am currently using ASUSWRT, the Home assistant Iphone App, and Owntracks all as presence sensors. Also working on a Bayesian sensor.

My question revolves around how Home Assistant “Merges” two trackers into a single sensor.

My ASUSWRT and the Home assistant app, are using a single presence sensor. I did not go out of my way to do this, HA just took care of it on its own. I believe it ties the MAC address of the device. I believe I can get Owntracks to do the same, but have not done that yet.

When I am at home on wifi, the source for my presence device is ROUTER, when I’m away the source is GPS.

So far, so good, makes sense. The issue is when I disconnect from the router, the app does not immediately take over. So it gets marked as away, then if I force an update, I get marked as home again.

I’ve had a lot of bouncing when I leave home, marked as away, then back home, then away.

I’ve dealt with spotty presence on most platforms I’ve tried over the years, so I’m not complaining, just looking for possible ways to improve this.

So, 1st, can I separate my asuswrt presence from the home assistant presence. I’d love to have them separate, if possible. Would allow me three devices to work with my bayesian sensor.

Thanks for any info or tips

The easiest option is to leave all of your device_trackers as separate entities then put all of them into a group. You would then use the group as though it’s a device_tracker. For example, the group will be home if any of the device_trackers in the group are home and it will be not_home when all of the device_trackers are not_home.

How can I make my asuswrt wifi presence seperate from HA presence? I’m not oppsed to grouping sensors, but sometimes one gets stuck too. Then you have a different but similiar issue.

I really think the bayesian sensor will do well,but I really need 3 sensors to make it work well. And I really do have three, if I can seperate asuswrt from HA app.

Remove the mac address from your owntracks device in known_devices.yaml then let the system create a new one for your mac.

It’s the asuswrt that’s joined. I kept OwnTracks separate. Of course the asus needs the Mac since it’s a router. :slight_smile:

Ok. Whichever device in known_devices that it’s joined with, you need to remove the mac address from that one. The asus component should create a separate device after you’ve done that.

So I have the following under known devices

pauls_iphone:
  hide_if_away: false
  icon:
  mac: 40:9C:28:11:22:33
  name: Pauls iPhone
  picture:
  track: true

That is what was added by asuswrt when I first added the component,

Then later I installed the Iphone Home Assistant App, and it never created an entry in known_devices, but I noticed that the tracker device now started reporting source GPS or Source Router, so it made sense they were combined.

paul_iphone:
  hide_if_away: false
  icon:
  mac:
  name: paul
  picture:
  track: true

This is Owntracks

I’m confused though. AsusWRT uses the mac to determine if I’m present, right? How will it track me (home/away) i remove the MAC address.

Im sure it’s just a lack of understanding of how known_devices works, thanks for your paitence and help

Adding a mac address to the device from another tracker is what merges them. Check out https://www.home-assistant.io/components/device_tracker.owntracks/#using-owntracks-with-other-device-trackers for more details on that.

When you remove the mac address, the next time the asus component scans for new devices, it will see that it doesn’t exist in known_devices and will create it.

Ok thanks. I had seen that article before for OwnTracks. Did not realize it applied to all device trackers. I’ll just have to do it and see what happens. . :slight_smile:

Still having trouble grasping how my router is going to track my phone without a MAC address.

In the end, you will have another entry that has your mac.

1 Like

Wanted to quicky take a second to say thanks. Worked exactly as you said. I now have two device trackers tied to my iPhone. ASUSWRT and Home Assistant App, additionally I started using my Apple TV via HomeKit to also help with presence as well. I then created a bayesian sensor using these three. So far for the couple of days I have been using it it has been 100% successful. Out of the three the HA app is the slowest to report status.

1 Like

Would you mind explaining how you grouped those 3 trackers into one using a bayesian sensor? once you create the sensor - how do you have it use that as the main/only tracker?

I’ve added/changed a few trackers since this post, but here is my current bayseian sensor

 - platform: bayesian
   prior: 0.6
   name: Paul Presence
   probability_threshold: 0.92
#   device_class: presence
   observations:
   - entity_id: 'input_boolean.paul_present'
     prob_given_true: 0.8
     prob_given_false: 0.3
     platform: 'state'
     to_state: 'on'
   - entity_id: 'device_tracker.pauls_iphone_2'
     prob_given_true: 0.8
     prob_given_false: 0.3
     platform: 'state'
     to_state: 'home'
   - entity_id: 'device_tracker.pauls_iphone'
     prob_given_true: 0.8
     prob_given_false: 0.3
     platform: 'state'
     to_state: 'home'
   - entity_id: 'device_tracker.google_maps_118013912887885302155'
     prob_given_true: 0.8
     prob_given_false: 0.3
     platform: 'state'
     to_state: 'home'
   - entity_id: 'device_tracker.paul'
     prob_given_true: 0.8
     prob_given_false: 0.3
     platform: 'state'
     to_state: 'home'

This works for me and when I want to use this sensor, I just use state from off to on, or on to off with this sensor.

2 Likes

I have wrestled with this situation myself. I used to have a person component configured with all my device trackers. My router sensor marks me as away when I leave its range, but often my location sensor will mark me as home again because I’m not yet 100m away, the radius of my home zone.

I’ve ended up setting up a Bayesian sensor that takes all my device trackers into account and then having a “fake” device tracker keyed to the state of that Bayesian sensor. This is now the only device tracker for my person component. Seems to work well so far.