Bluetooth MAC from scanner


#1

I’m trying to scan bluetooth devices for a room presence sensor, but the MAC addresses i’m getting make no sense, though admittedly i’m a noob regarding bluetooth and BLE.
I have an android watch which i’m trying to monitor, and it appears twice in the output on every scan - once with a MAC address which i dont recognize (and seems to change on every reset), under the BLE distance publishing:

Creating BLE buffer
BLE DISTANCE :
10.35
Pub json into:
home//salon
{“id”:“69:4b:d6:a0:0e:80”,“name”:“Barthos”,“rssi”:-81,“distance”:10.35405}
Pub data per topic
id
69:4b:d6:a0:0e:80
name
Barthos
rssi
4294967215
distance
10.35

And once with the same MAC address, but with the correct MAC address in the “ServiceData” field under the BTtoMQTT publishing:

Get service data
Pub json into:
home/OpenMQTTGateway/BTtoMQTT/694BD6A00E80
{“id”:“69:4b:d6:a0:0e:80”,“name”:“Barthos”,“rssi”:-81,“distance”:10.35405,“servicedata”:“d6a7466580_XX_”,“servicedatauuid”:“00001999-0000-1000-8000-00805f9b34fb”}
Pub data per topic
id
69:4b:d6:a0:0e:80
name
Barthos
rssi
4294967215
distance
10.35
servicedata
d6a7466580_XX_
servicedatauuid
00001999-0000-10…

This is the only device that does it. all the other devices which show on the scan only show up on the BLE distance with other incorrect MAC addresses.


#2

What are the info that enable you assuming the mac adress is wrong?
On both serial trace the BLE id (= mac adress) are the same.

Other subject for @animavitis it looks like we have an issue with the rssi value.


#3

Its possible that your smartwatch is generating new MAC every restart, ie. this is default behavior when u simulate BLE device from android phone.
I think most of cheap devices with android works in this way.

U can always extend home assistant to use service data to identify device:)

@1technophile: will check this RSSI later, now im finishing home assistant discovery


#4

Im assuming it is wrong because like i said, it seems to change on every reset, and the address i see reported in the watch’s menu is “d6a7466580…” (of course separated into pairs). like i said, the watch is the only device i have which reports a separate BTtoMQTT message. the rest of my devices like my phone only report the false mac (same assumption, the MAC i see on my phone for the bluetooth module is different than the one i see on the scan. however in this case i cant confirm im even seeing my phone since i dont see any other info)


#5

some info:
https://www.lairdtech.com/support/product-support-center/embedded-wireless/embedded-wireless-support-faq/bluetooth-faq-97

If you want a fix mac adress you need to add a third app like beacon simulator


#6

Thank you for the link, i was searching for a while about whether the MAC address was different between bluetooth and BLE before posting this, but i couldnt find anything concrete on a reputable site.
If you could bear with me for a second here, this means that in the case of my watch, “69:4b:d6:a0:0e:80” is the generated BLE MAC, and d6a7466580…" is the bluetooth MAC, right?
so doesnt that mean that other devices such as my phone should also report their bluetooth MAC (or at least their public name) over regular bluetooth protocol without me having to install that apk that simulates an ibeacon over BLE? or does openMQTTgateway not support regular bluetooth protocol scanning?

Thanks for the answers, and all the work on the gateway :slight_smile:


#7

If you could bear with me for a second here, this means that in the case of my watch, “69:4b:d6:a0:0e:80” is the generated BLE MAC, and d6a7466580…" is the bluetooth MAC, right?

no, servicedata is “payload” for servicedatauuid, maybe in your case this is MAC but it can be anything else

so doesnt that mean that other devices such as my phone should also report their bluetooth MAC (or at least their public name) over regular bluetooth protocol without me having to install that apk that simulates an ibeacon over BLE? or does openMQTTgateway not support regular bluetooth protocol scanning?

again no, BLE is not same as BLUETOOTH, so u need 3rd party apk to create BLE service.
And not all phones can do this, ie. my Honor 10 have bluetooth 5 , but cant create BLE service (missing multicast BLE services feature)


#8

I know bluetooth regular protocol and BLE arent the same, what im asking is if the gateway can also show regular protocol devices, such as when you perform a bluetooth scan on your phone which shows both BLE and regular bluetooth protocol devices.
Also, if you can explain why this specific device reports twice, once under BLE distance, and once under OpenMQTTGateway/BTtoMQTT maybe it would help me understand it better.

Best case scenario, i wanna put 1 esp32 or esp8266 in every room and detect room presence using our phones. Is that out of scope for this project?

Thanks :slight_smile:


#9

Also, if you can explain why this specific device reports twice, once under BLE distance, and once under OpenMQTTGateway/BTtoMQTT maybe it would help me understand it better.

OMG scan for BLE devices and if device is found then:

  • if device have RSSI then will send distance topic
  • will send (always) BTtoMQTT with all data that was received from scan

Dont know if phone can be discovered by esp32, but for sure phone need to be in connectable & discoverable mode -> this mode by default is disabled in phones (for security reasons) and u can enable it for some limited time only. So finally i dont think it is possible to track room presence by detecting phones. Use ibeacons for that instead:) there are cheap ones on aliexpress:)


#10

I see. Thanks for the explanation. If this is an esp32 thing specific to the bluetooth module being used or the libraries then it makes sense.
The RPi home assistant bluetooth tracker does work however with phones (it has different trackers for bluetooth, and for BLE). i was just trying to avoid having to install RPi zeros with room assistant across my home since they are bigger and cost 3 times as much as an esp32.


#11

You mean that with BLE on rpi home assistant can detect phones?

I agree that a RPI for presence detection is a bazooka to kill a mosquito


#12

Think he means the 2 trackers here, one for beacons and another for regular Bluetooth devices like phones



#13

ok I see thanks @IRo


#14

Yeah, those are the ones.
Then my only choice is raspberry pi?