rbaron / parasite-scanner

A bridge for b-parasites
MIT License
12 stars 2 forks source link

parasite-scanner crashes on raspberry pi os 11.4 #3

Open SystemFuchs opened 1 year ago

SystemFuchs commented 1 year ago

It seems that an actual bluez stack forces parasite-scanner to crash.

pi@raspberrypi:~/parasite-scanner$ ./parasite-scanner -config example_config.yaml panic: unable to initialize the BLE stack: MapToStruct: Field not found: Roles

goroutine 6 [running]: main.(*ParasiteScanner).Run(0x200e2b0) /home/pi/parasite-scanner/ble.go:95 +0x13c created by main.main /home/pi/parasite-scanner/main.go:33 +0x194 pi@raspberrypi:~/parasite-scanner$ uname -a

Linux raspberrypi 5.15.56-v7+ #1575 SMP Fri Jul 22 20:28:11 BST 2022 armv7l GNU/Linux

pi@raspberrypi:~/parasite-scanner$ cat /etc/debian_version 11.4

pi@raspberrypi:~/parasite-scanner$ bluetoothctl --version bluetoothctl: 5.55

SystemFuchs commented 1 year ago

Sorted it out.

  1. It seems to be the case that your customized go bluetooth 0.3.0 repo isn't compatible with bluez versions > 5.48 anymore
  2. Downloaded the actual go bluetooth 0.5.0 release & added your customizations manually. After this the package will build & will run fine. I'm trying to check, if the range with a raspi is better compared to the ESP32 ESPHome version. Allthough I'm using antennas I'm having trouble getting the signal wenn the glashouse door & the garden door (triple glas window) are closed

image

Could you merge your go bluetooth repo changes with the actual 0.5.0 version? Regarding Github an automic merge seems possible! image

Best regards & thx for you efforts.

leon2225 commented 1 year ago

Hey folks, is there an update on this? It seems like the same issue persists.

Thanks for your efforts so far!

rbaron commented 1 year ago

It's been a while (2 years!) since I last touched this project. I have since moved my b-parasites to ESPHome + BTHome + HomeAssistant (see docs), which I think it's an easier, cheaper and more battle tested way of integrating them into Home Assistant.

If someone wants to bring this project to a better shape, here's what I would suggest:

  1. Removing the dependency on github.com/rbaron/bluetooth. This was a quick hack on top of github.com/tinygo-org/bluetooth to support parsing service data from b-parasite BLE advertisements. It's possible that the upstream project supports the feature and maintains it (I just checked: apparently not), which is favorable over my hacky, untested, stale fork. If not, ideally fix the fork and try to contribute it upstream
  2. Support newer b-parasite BLE encodings. I build this when we only had V1, now we have V2 (which supports the light sensor) and also BTHome. Ideally this project should automatically parse all of them (and display which one they're using). Here's where data is encoded for all protocol versions