Google Home device tracker, rssi sensor value = unknown

I’m trying to implement BT device tracking via the Google Home component as described:

on reddit

and

on this forum

and I’m struggling. This is my first deep dive into HASS beyond just adding Zwave/Zigbee devices and simple time-of-day automations.

The relevant bits of my configuration.yaml are:

device_tracker:
  - platform: bluetooth_le_tracker
  - platform: bluetooth_tracker
    # Family Room Speaker
  - platform: googlehome
    host: 192.168.1.53
    rssi_threshold: "-100"
    interval_seconds: 5
    consider_home: 10
    new_device_defaults:
            track_new_devices: false
    # Master Bedroom Speaker
  - platform: googlehome
    host: 192.168.1.51
    rssi_threshold: "-100"
    interval_seconds: 5
    consider_home: 10
    new_device_defaults:
            track_new_devices: false

and

sensor:
  # Weather prediction
  - platform: yr
  - platform: syncthru
    resource: http://192.168.1.11
  - platform: template
    sensors:
      master_bedroom_brain_gh_rssi:
        value_template: '{{ states.device_tracker.brain_bt_master_bedroom.attributes.rssi }}'

  - platform: template
    sensors:
      family_room_brain_gh_rssi:
        value_template: '{{ states.device_tracker.brain_bt_family_room.attributes.rssi }}'

  - platform: template
    sensors:
      brain_room_status:
        value_template: '{{ states.input_select.brain_room_location.state }}'
        friendly_name: 'Brain Room Location'

Checking sensor.family_room_brain_gh_rssi and sensor.master_bedroom_brain_gh in the States developer tool I see that the value is “unknown”. If I check the device_tracker values that those friendly names (set in known_devices.yaml) correspond to, I see an rssi value for both:

device_tracker.192168153_b02a43fexxxx 

source_type: bluetooth
scanner: GoogleHomeDeviceScanner
rssi: -68
btle_mac_address: b0:2a:43:fe:xx:xx
ghname: Family Room speaker
friendly_name: brain_bt_family_room

known_devices.yaml:

192168153_b02a43fexxxx:
  hide_if_away: false
  icon:
  mac: 192.168.1.53_B0:2A:43:FE:XX:XX
  name: brain_bt_family_room
  picture:
  track: true

I haven’t gotten to troubleshoot the automations yet, since a value of “unknown” in the sensors isn’t going to get me anywhere. Any thoughts are appreciated, TIA!

Still not having any joy with this. Any suggestions appreciated!

1 Like

Did you ever get any further with this? I’ve tried a few times, and sure it’s just syntax that’s beating me.

funny I was just talking to someone else about this, but no. I haven’t gotten to work much on it since I made the original post. It seems like it should work, but I’m clearly missing something.

In your template sensor have you tried refering to the device tracker as “device_tracker.192168153_b02a43fexxxx” rather then using friendly name?

OK, so changing the sensor config from:

  sensors:
  master_bedroom_brain_gh_rssi:
    value_template: '{{ states.device_tracker["192168151_b02a43fexxxx"].attributes.rssi }}'

to

- platform: template
sensors:
  master_bedroom_brain_gh_rssi:
    value_template: '{{ states.device_tracker["192168151_b02a43fexxxx"].attributes.rssi }}'

yields the correct rssi value in the sensor.family_room_brain_gh_rssi variable.

So we’re making progress; more to follow

The “brain_room_status” sensor does not need template and sensors row immediately before it.

It can just be a list of sensors under the one template/sensors entry, which you already have above “family_room_brain_gh_rssi”.

But I’m not sure what is supposed to do. Have you got an input select sorted yet? I don’t see it in the code you’ve given

This whole scheme is based on the two forum posts I linked in the OP. The whole idea is room presence detection by comparing the RSSI values for my phone as seen by the Google Home Minis in the respective rooms.

input_select:
brain_room_location:
name: Brain's Room Location
options:
  - Master Bedroom
  - Family Room
  - Away
  - Home
input_boolean:
    #brain_office_presence:
    #name: Brain Office Presence
    #  initial: false
brain_family_room_presence:
    name: Brain Family Room Presence
    initial: false
brain_master_bedroom_presence:
    name: Brain Master Bedroom Presence
    initial: false

There is additional config to be added to compare the RSSI values, but just getting the RSSI values into master_bedroom_brain_gh_rssi and family_room_brain_gh_rssi was the initial problem. When I stopped troubleshooting last night, the values had gone from “unknown” to just “” (a blank). This might have more to do with the Android phone BT operation than anything else but I won’t be able to dig further until later today.

In known_devices.yaml I have:

192168153_b02a43feXXXX:
  hide_if_away: true
  icon:
  mac: 192.168.1.53_B0:2A:43:FE:XX:XX
  name: brainbtfamilyroom
  picture:
  track: true

If I use the template editor with:

- platform: template
  sensors:
    master_bedroom_brain_gh_rssi:
      value_template: >-
        {% if is_state('device_tracker.brainbtfamilyroom', 'home') %}            
          {{ states.device_tracker.brainbtfamilyroom.attributes.rssi }}

        {% else %}
          -99
        {% endif %}

the value assigned to bedroom_brain_gh_rssi is -99, despite the state of device_tracker.brainbtfamilyroom being ‘home’ and the rssi value in that device_tracker being -65.

I’ve tried a lot of variations using different syntax (friendly name vs not, single quotes, double quotes), but I feel like I’m missing something.