How to use the device_tracker.bluetooth_tracker_update service?

Does anyone know if/how this service works?

device_tracker.bluetooth_tracker_update

I was hoping it would trigger a Bluetooth scan, but I had no luck via the Services tool.

Here’s the code for it. If you set logger to debug you should at least see messages in home-assistant.log that look like:

Scanning <mac_address>

Ok ta.

Yeah I couldn’t see any log activity. This should help.

I’ll take another look shortly.

I couldn’t seem to get this working…

Can anyone confirm they’ve gotten it working in hassio and walk me through it?

In the service dev tool I tried

Service

device_tracker.bluetooth_tracker_update

Service data

{"mac_address":"E4:46:XX:YY:AF:ZZ"}

(I tried many variants of mac:, mac_address:, entity, entity_id etc)

I changed my log level and couldn’t see anything show up.

So I can confirm I did end up getting this working in both the services tool and in a script.

In the services tool:
Service: device_tracker.bluetooth_tracker_update
Service data: {“mac”:“E4:46:DA:YY:XX:51”}

In a script:

update_bingbong:
  alias: Update Bing Bong
  sequence:
  - service: device_tracker.bluetooth_tracker_update
    data:
      mac: E4:46:DA:YY:XX:51

In the log file you should see:

2019-06-01 11:10:54 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.1891354384] Received {'type': 'call_service', 'domain': 'device_tracker', 'service': 'bluetooth_tracker_update', 'service_data': {'mac': 'E4:46:DA:YY:XX:51'}, 'id': 16}
2019-06-01 11:10:54 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=device_tracker, service=bluetooth_tracker_update, service_data=mac=E4:46:DA:YY:XX:51>

And you should see the device being updated (see chart) and something like this in the logs.

2019-06-01 11:24:30 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.1849868] Sending {‘id’: 2, ‘type’: ‘event’, ‘event’: <Event state_changed[L]: entity_id=device_tracker.bing_bong, old_state=<state device_tracker.bing_bong=home; source_type=bluetooth, friendly_name=Bing Bong @ 2019-06-01T11:24:15.544666+10:00>, new_state=<state device_tracker.bing_bong=not_home; source_type=bluetooth, friendly_name=Bing Bong @ 2019-06-01T11:24:30.039336+10:00>>}

So the next step for me is to put a Xiaomi motion detector outside my apartment door pointing at the elevator.

When motion is detected (which happens quickly), it will trigger a bluetooth scan for my phone to confirm it is me, then unlock my door.

I’ll need to build up some better logic to handle when I’m already home etc, but this is the basis.)

@Mahko_Mahko , thanks for following up your own query as it’s good to see you had an issue and then managed to work it out and let us all know how you did it so we can learn.
I’m now trying to do a very similar thing to you and potentially having the same issue. I’m using bluetooth tracker (of my phone) to turn lights on in an external garage. (I have to use the bluetooth tracker as it picks up the me up in that location only as opposed to wifi which I’m on all the time as it covers that area.)
It sort of works, as the lights come on after a few seconds (I’m assuming based on my tracker refresh rate for interval_seconds).
I’ve also got a contact sensor and a PIR which operate separately and are pretty much immediate detection so I’d like to use these to automatically run the bluetooth tracker update as that would then hopefully both speed up the lights coming on and would also then allow me to send out a notification if PIR/Contact was triggered and I was not present.
The problem I have is that I cannot seem to get the manual tracker update service to work.
I’ve tried both a service call from developer tools and also adding the service call as a line in the PIR/Sensor detection automations. I get no response from the call for either, so no error, but unfortunately also no update to my device tracker entity. Interestingly it appears that the syntax you’re using differs from what it’s expecting on my install so not sure if it’s changed over the years with different updates?
Any ideas?

Hey. I don’t have much memory of this other than it was confusing:)

Looking at my current config I seem to have commented out what I had above and replaced it with just bluetooth_tracker.update.

Maybe things changed…

update_bingbangbong:
  alias: Update Bing Bang Bong
  sequence:
  - service: bluetooth_tracker.update
  # - service: device_tracker.bluetooth_tracker_update
    # data:
      # mac: E4:AA:DA:YY:XX:RR