Closed hillstub closed 2 years ago
Hi, the asset filters are indeed not aimed for home usage yet: there is no integration in the app or in the hub yet. Next to that, the crownstones themselves can only determine a wearable being in the sphere, not which room.
With that all said, there is a python library example to configure an asset filter. In some cases, this will require you to know a bit about Bluetooth LE.
Thanks @vliedel !
I thought it would be possible to see the closest crownstone to the wearable - is that not the case?
I'm happy to dive into some python scripts, but could you elaborate a bit on the example? If I understand this correctly, this would upload a filter to the crownstone mesh for detecting wearables. Do I need another script to receive messages in case of an event happening? Thanks!
When you look in the AssetFilter class, you will find an experimental optimization strategy "nearest". This means the crownstones will only send a mesh message when they think to be the nearest. Since this is not always correct (nearest can change over time, etc), we didn't commit on this strategy yet. With the current firmware, the best option is to gather all info (so without the optimization strategy) at a hub, and determine which crownstone is closest on the hub.
There is no example yet for receiving the asset filter reports, basically you will need to subscribe for UartTopics.assetIdReport
(or UartTopics.assetTrackingReport
, but i see now that this name should be changed to assetMacReport
). Quick example:
def onAssetMac(report: AssetMacReport):
print(f"onAssetMac mac={report.assetMacAddress} crownstoneId={report.crownstoneId} rssi={report.rssi} channel={report.channel}")
def onAssetId(report: AssetIdReport):
print(f"onAssetId id={report.assetId} crownstoneId={report.crownstoneId} rssi={report.rssi} channel={report.channel} passedFilterIds={report.passedFilterIds}")
UartEventBus.subscribe(UartTopics.assetTrackingReport, onAssetMac)
UartEventBus.subscribe(UartTopics.assetIdReport, onAssetId)
Thanks @vliedel!
I tried your code, but it report on my devices. When enabling debugging I see
DEBUG : Unknown opCode: 10111
which seems to refer to NEIGHBOUR_RSSI. I do have the latest version of crownstone-uart (2.2.0)
Then nothing passes the filters you set, or the filters failed to upload. The unknown opcode is unrelated. Did you change the example filters to match your use case?
Hi @vliedel, I actually got it working with a Fitbit! I have two additional questions:
Nice :)
filterByAdData()
is the most raw one. More info about BLE advertisement data. I usually use the nRF Connect app to view the raw advertisements of devices.@hillstub has this been answered according to your expectations? As soon as we formally release this functionality we will create user-facing examples. Feel free to reopen then.
Hi all, I just went through the process of upgrading my crownstones, hoping to enable tracking my wearables. However, it's a bit unclear to my how to achieve this. Could you post some example code? Thanks in advance!