citruz / beacontools

A Python beacon scanning library.
MIT License
159 stars 59 forks source link

Eddystone beacons not listed #25

Closed dedalozzo closed 6 years ago

dedalozzo commented 6 years ago

I have 4 Estimote beacons and I have enable Eddystone-UID, Eddystone-EID, Eddystone-URL, Eddystone-TLM broadcasting. They all share the same namespace, that I have used to filter the beacons as per your instruction. Unfortunately the script scanner_eddystone_example.py doesn't return any result. No error is returned, the script just goes in timeout.

If I use instead the iBeacon protocol with the script scanner_ibeacon_example.py I get all the beacons regularly filtered using their UUID, which is the same for them all.

I'm on a Raspberry Pi with Raspbian Lite and I have updated BlueZ from source to the version 5.50. Python is compiled with Bluetooth support. The command is executed with root privileges.

citruz commented 6 years ago

Maybe your specific beacons use some identifiers that the library does not recognize yet. Please do the following:

sudo apt-get install bluez-hcidump
sudo hcitool lescan --duplicates &
sudo hcidump --raw

This will dump the raw ble packets to the console. Please post them here so we can have a look at the issue.

dedalozzo commented 6 years ago

Hi @citruz you can find the log here. I'm not sure which are the Estimote beacons in this list, because I have at least 10 beacons and they are all broadcasting. I let it go for a few second. The Estimote beacons are broadcasting almost every second.

citruz commented 6 years ago

Thanks, I will look into it. What is the exact model you are using?

dedalozzo commented 6 years ago

It's the Proximity Beacon, the first one on the left in the list that you can find at the bottom of the products. The website claims it support both iBeacon and Eddystone simultaneously. But I have tried to enable even just Eddystone without success. There is an app that you can use to configure them, pretty straightforward. You can even set which frames to include in the broadcasting: UID, URL, EID, TLM, etc.

mvjt commented 6 years ago

Could it be related to https://github.com/citruz/beacontools/issues/10?

dedalozzo commented 6 years ago

It could.

On 8 Aug 2018, at 06:38, eltoro81 notifications@github.com wrote:

Could it be related to #10 https://github.com/citruz/beacontools/issues/10?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/citruz/beacontools/issues/25#issuecomment-411291183, or mute the thread https://github.com/notifications/unsubscribe-auth/AAS_0B0y1IAUSF4ZgKK2W4zRGKXhToJgks5uOnlvgaJpZM4VpxbQ.

citruz commented 6 years ago

I found the issue, why the Eddystone packets were not captured. In your dump are also some Estimote specific packets. I will add these as a completely new class of packets to the parser. You need to give me a few days, though.

dedalozzo commented 6 years ago

Sure thing, thank you very much for the prompt response. I’m glad the dump has been helpful.

On 8 Aug 2018, at 21:40, citruz notifications@github.com wrote:

I found the issue, why the Eddystone packets were not captured. In your dump are also some Estimote specific packets. I will add these as a completely new class of packets to the parser. You need to give me a few days, though.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/citruz/beacontools/issues/25#issuecomment-411544971, or mute the thread https://github.com/notifications/unsubscribe-auth/AAS_0M53Zu9_-C75tPuhvLF5qZLVyO8pks5uO0zUgaJpZM4VpxbQ.

VPKi commented 6 years ago

I have somewhat a same issue, I can see Eddystone TLM and URL frames, as well as IBeacon Frames, but Eddystone UID frames elude the scan. How do I know they are broadcasting UID? I have a smartphone app that picks up every bluetooth packet around it, and on it I can see my beacon broadcasting UID frames. Using beacons from kontakt.io

citruz commented 6 years ago

I just pushed the branch for the next release. It is still work in progress but I already implemented some changes:

With these changes I already see EddystoneURLFrame, IBeaconAdvertisement, EddystoneUIDFrame, EddystoneTLMFrame and EstimoteTelemetryFrameB packets in the dump @dedalozzo provided.

EddystoneURLFrame<tx_power: -22, url: https://twitter.com/estimote>

IBeaconAdvertisement<tx_power: -71, uuid: b9407f30-f5f8-466e-aff9-25556b57fe6d, major: 42782, minor: 64526>

EddystoneUIDFrame<tx_power: -22, namespace: edd1ebeac04e5defa017, instance: 47a038d5eb03>

EddystoneTLMFrame<voltage: 2991 mV, temperature: 26 Celsius, advertising count: 5093979, seconds since boot: 48741845>

EstimoteTelemetryFrameB<identifier: 47a038d5eb032640>

Feel free to checkout the branch and try it yourself. Happy to hear your feedback.

citruz commented 6 years ago

Also added subframe A of the Estimote telemetry packet spec.

dedalozzo commented 6 years ago

Hi @citruz, I have tested it and it's working properly, thank you:

<fc:30:17:20:34:2a, -67> EddystoneTLMFrame<voltage: 3047 mV, temperature: 49178 Celsius, advertising count: 5899888, seconds since boot: 24763922> {'namespace': 'edd1ebeac04e5defa017', 'instance': '5d124ce70ec5'}
<e7:78:c6:dc:67:04, -36> EddystoneTLMFrame<voltage: 2966 mV, temperature: 16409 Celsius, advertising count: 7370726, seconds since boot: 55750462> {'namespace': 'edd1ebeac04e5defa017', 'instance': '47a038d5eb03'}

I will receive 3 other models, different manufactures in the next days. I will let you know if there are problems.

dedalozzo commented 6 years ago

One last thing. Are you parsing even VBATT[1] 0x02 and all the other additional parts of the TLM frame? I'm trying to find out is some beacon manufacturer is broadcasting the battery life (not just the voltage), or if I have to determine it myself based on some assumptions.

citruz commented 6 years ago

Yes, VBATT[0] and VBATT[1] are treated together as a 16 bit integer. I'm not sure what other parts you are referring to. This is the specification I use for parsing: https://github.com/google/eddystone/blob/master/eddystone-tlm/tlm-plain.md

dedalozzo commented 6 years ago

Yeah I see, I have seen checking your code. I have discovered that is possible to scan one frame at the time, which is the way BlueZ works. That means to get both TLM and UID I need two create two different scanners and run them in parallel. Am I right?

citruz commented 6 years ago

No, you can just pass a list as the packet_filter argument like this:

scanner = BeaconScanner(callback, 
    packet_filter=[EddystoneTLMFrame, EddystoneUIDFrame]
)

Maybe I should add this to the examples :)

dedalozzo commented 6 years ago

Good to know. Are you planning to support GATT as well to configure the beacons?

citruz commented 6 years ago

No sorry.

dedalozzo commented 6 years ago

Every time the scanner receive a frame, it triggers the callback, so packet holds one frame at the time. Since each frame might have a different broadcasting interval, that's the only way I guess.

citruz commented 6 years ago

You can get the class of a certain packet using isinstance(packet, EddystoneTLMFrame). Or what is your question exactly?

dedalozzo commented 6 years ago

Not a question, really, I was just describing the way it works. :-) I guess we can close this. Thank you for the prompt response.

citruz commented 6 years ago

I just released the new version on PyPi (as 1.3.0 and not as 2.0.0, though). https://pypi.python.org/pypi/beacontools/

dedalozzo commented 6 years ago

Thank you.