Trying to use Google Home BT for presence detection

I’m trying to venture into using Google Home unit’s BT fo presence detection.
I’m unsure of how to use it.
I’ve used the example, and that creates a ton of devices, so far so good.

10_11_12_34_d4_38_9c_99_12_34:
hide_if_away: false
icon:
mac:
name: 10 11 12 34 d4 38 9c 99 12 34
picture:
track: true

10_11_12_38_d4_38_9c_99_12_34:
hide_if_away: false
icon:
mac:
name: 10 11 12 38 d4 38 9c 99 12 34
picture:
track: true

10_11_12_36_d4_38_9c_99_12_34:
hide_if_away: false
icon:
mac:
name: 10 11 12 36 d4 38 9c 99 12 34
picture:
track: true

10_11_12_35_d4_38_9c_99_12_34:
hide_if_away: false
icon:
mac:
name: 10 11 12 35 d4 38 9c 99 12 34
picture:
track: true

As you can see, it’s the same device, but on different Google Home’s.
So how do I tell it, that it’s the same device and same person?

When posting logs or configuration snippets please use code blocks and syntax highlighting. For quick highlighting of code, YAML, etc, use this button:

Did you follow this guide?

also, there are already far too many threads on this subject. Its better to read those / add comments to those instead of starting a new one. You will likely find your questions are already answered… except for this subject as you will find out, its an ongoing issue regarding the multiple device entries…

I don’t mean to be so negative but we just get SO many new threads that ask the same questions over and over. Sorry to rant

Despite your ranting, which I won’t go into a discussion about, thankyou for your help.
You gave me the help I needed with a link.
You have a nice day.

Well, I read the guide, and tried to figure out how to use it. I detect that some are very good at blaiming the inexperienced, rather than realize that the docs might be difficult to understand, so please bear with me.
I know everybody is big HA fans, but this is not an easy way into home automations, a lot is very counterintuitive.
I do though like that it uses Raspberry PI, and I have one lying unused, so it would come to good use.

First of I found out that before the guide, it should start with adding the googlehome units.

googlehome:
  devices:
    - host: IP
    - ...

Secondly, the header for the

#Kitchen Google Home Mini

  • platform: googlehome

is
device_tracker:

Thirdly the header for

  - platform: template
    sensors:

is
sensor:

All of this is probably givens for the experienced, but having worked with writing guides and manuels for more than 30 years, I know that obvious things are not obvious for the new to the field.

But as I’m working my way through this I can’t help wonder about how the devices are tracked, for me that is not clear.
I mean for my phone alone I see five entries in known_devices.yaml, one for each Google Home.
I’ve tried rewriting the ‘name:’ for them, but that just made it go haywire.
Adding ‘friendly_name:’ didn’t work either.

So do I need to have an entry for every tracked device at every google home unit?
Do I need to make an automation for each device? Or each Google Home unit (or both)?

Hmm, I just realized that I’m probably using the wrong term in this.
I wanted to use ‘home / away’, and I can understand that this will detect for each room.
That sounds very nice, but a higher target that I really meant.
So if that is the case, I can see why I need to do automations for each Google Home unit.
But I still don’t get when looking at the automations, how it finds out who is where, I don’t see any reference to the devices.

There are some templates here on the forum somewhere.
But essentially the first half tells you the google home and the second half the device
10_11_12_34_d4_38_9c_99_12_34
Using that and the signal strength you can work out what GH your device is closest to.

But there are still some issues around the usability of the tracker.

Ok, got that part.
Now I found Seans github, and I can see that not only do I need to create configs for each google home, I also need to create configs for each user. Wow, that is tedious.

But I still don’t see how the entities are defined.
I can see the group describing Sean is made like this:

sean:
  name: Sean
  view: no
  entities:
    - device_tracker.sean_phone #Phone
    - device_tracker.sean_bt_bedroom
    - device_tracker.sean_bt_living_room
    - device_tracker.sean_bt_office

But the entity device_tracker.sean_phone and device_tracker_sean_bt_bedroom I’m not sure of.
Where are they defined, and how?
I can see they are referenced twice, but not the definition.
The reason I ask, is that seem to have tried doing this for my phone, but I can’t seem to get it to work.

OK, I think you are mixing up a few concepts here.
I suggest we leave the person out for now and focus just on the device.
Assuming you have 1 phone, you can track that in different ways and most of them will give you an entry of some sort in known_devices.yaml.

Now that should give you basic presence detection of if this device is on your network or not. (home / not home)

Since you are venturing into the GH BT area I suspect you want to know what room the device is in?
If home/not home is sufficient I suggest trying some of the other trackers.

As mentioned in many other threads, the GH BT component is not very good as of now. But if you want to get further into this here some pointers:

looking at your samples above I assume you have 4 GH devices. They all represent a “room”
10_11_12_34 - living room
10_11_12_35 - bedroom
10_11_12_36 - kitchen
10_11_12_38 - garage
and you seem to have only one BT device, let’s call it phone
d4_38_9c_99_12_34 - phone

I am a bit surprised at your examples, mine look different:

192_168_2_101_46_86_86_c3_1b_71:
  hide_if_away: false
  icon:
  mac: 192.168.2.101_46:86:86:C3:1B:71
  name: 192.168.2.101 46:86:86:c3:1b:71
  picture:
  track: true

so you can turn these entries into device trackers that you can understand.

phone_in_garage:
  hide_if_away: false
  icon:
  mac: 10.11.12.38_d4:38:9c:99:12:34
  name: Phone in Garage
  picture:
  track: true

once you do that for all 4 rooms you get 4 device trackers for essentially the same device but with an indication of which room it is in.
You can then use templates to turn that information into a sensor that tells you that room.
Or if you just want to know if your phone is home you can add all 4 to a person or a group and that can aggregate that information into 1 result.

But I suggest you make the individual trackers work first.

edit: I am sure you saw that already, but this guys have solved it relatively elegantly.

Hi DataMonkey

Ok, that is interesting, the ‘name’ etc, are very different.
I’ve searched quite a bit now, and I can see people reporting that the GH units loose bluetooth pairing when they are working that much, that would explain the thing we see at home, so I guess this is not a viable way for us.
I really just need the home/away for now, I can always do it more advanced later when I get more experienced.
So what other trackers are there. I really don’t want to require that my family runs around with special tags for the detection, and I can’t rely on them using the wifi at home (the children shuts off wifi to save battery when they are not home).
The most reliable signal I can see is BT, as they all keep their phones on them, or at least in the house.

If I just use
device_tracker:

  • platform: bluetooth_tracker

That is the BT in the Raspberry Pi, right? But that wont reach the entire house, so how do I do that?

Hi,
If you just want to track if someone is home/away, then you can use the normal device trackers.
This is the overall description of how they work: https://www.home-assistant.io/components/device_tracker/

There are various options:

  • wifi based: components either specifically for your router (netgear, unifi)
  • gps based: components based on the GPS location of your phone, e.g. iphone home assistant app, Owntracks, locative

if you look to the right hand side of the link I pasted above you can find all available tracker components and see which ones you like best.
I use a combination of wifi, owntracks, ios app and locative. None of them are perfect, but with the combination of them you only need one of them to register you and HA will mark you home.
All of these have (in my experience at least) no noticeable impact on battery life of the phone and you don’t need to carry special tags or devices aside from your phone.

Ok, great, thankyou.
And I can see that even the fritz!box is supported, that is really cool.
So, with that, and a GPS based, I guess I could make this work well.
I hope it won’t kill my android battery, but it’s worth a test.
Using owntracks, then I need to find out about MQTT as well :slight_smile: Do you use the built-in, or a seperate one?

Owntracks has a HTTP version which is what I’m using , no need for MQTT with that.
I do use MQTT for other devices and for that I use the one that comes through a hassio add on.

Hi DDK

I’ve now mimiced your way of doing it, I have the fritz!box wifi and the owntracks activated, and it works quite well, I got a ‘welcome home’ message when I reset my phone this morning :smiley:

So now I just need to tweak the automations a bit, I want it to say two messages, but I have some problems with having two actions, and the volume in the google homes, but that is minor, and solvable (oh, and the suggestion with the ‘exclude’ possibility elsewhere would have been great with this).