-
Notifications
You must be signed in to change notification settings - Fork 7
Added bluetooth dongle support for Rpi4 users #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This reverts commit b43ec97.
Thank you for looking at this! |
Thanks to you for creating it! I battled for quite some time before discovering some comments about the RPi4 bluetooth. So I tried a dongle and it just worked. |
Yeah, I'll admit that I use an external Bluetooth dongle too... But I just disable the internal one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, didn't get to this sooner. The commits are also verbose that it's hard to approach. AI generated?
updates: [{ | ||
values: [{ | ||
path: "plugins.victronBLE.status", | ||
value: "active" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What purpose does this serve? I don't see this path documented anywhere
) | ||
|
||
T = TypeVar('T', bound=DeviceData) | ||
import inspect |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please sort stdlib imports together
VEBusData, | ||
) | ||
|
||
T = TypeVar('T', bound=DeviceData) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please put this below imports
super().__init__() | ||
except TypeError as e: | ||
logger.debug(f"Parent __init__ args required: {e}") | ||
raise |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all seems pretty unnecessary.
logger.debug( | ||
f"Received data from {bl_device.address.lower()}: {raw_data.hex()}" | ||
f"Received {len(raw_data)}B packet from {bl_device.address.lower()} " | ||
f"(RSSI: {rssi}) @ {datetime.datetime.now().isoformat()}: " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Log entries are already timestamped, why include the time again here?
values.append({ | ||
"path": f"electrical.devices.{id_}.deviceName", | ||
"value": bl_device.name | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Repeated
) -> SignalKDeltaValues: | ||
values: SignalKDeltaValues = [ | ||
{ | ||
"path": f"electrical.deviceMetadata.{id_}.name", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this path documented?
|
||
# Add device name to all deltas | ||
values.append({ | ||
"path": f"electrical.devices.{id_}.deviceName", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this path documented?
Victron BLE Plugin: Raspberry Pi 4 Stability & Multi-Adapter Support
Summary
This update adds critical support for external Bluetooth adapters to address instability with Raspberry Pi 4's built-in Bluetooth hardware when used with Victron devices. Users can now select between adapters (e.g.,
hci1
for USB dongles) via SignalK UI to bypass Pi 4's unreliable native Bluetooth stack.Key Changes
🛠️ Pi 4 Hardware Workarounds
🪲 Why This Matters for Pi 4 Users
Pi 4's built-in Bluetooth:
➔ Fails to maintain stable GATT connections
➔ Causes packet loss with Victron devices
External dongles (e.g., CSR4.0/Plugable BT4LE) resolve these issues.
Full Changelog
Features
007d6c8
: Core Bluetooth adapter selection logic9471a9d
: UI configuration for adapter switchingee255ed
: Packet logging (size/timestamp/RSSI) for debuggingFixes & Stability
d9ba0c3
: Compatibility with Bleak 0.20+ APIs3e7aa1c
: Adapter selection via OS environment6a21b55
: Health monitoring and restart logicCode Quality
c62a146
/a911e39
: Type hint improvements4dcba99
: Reduced log noise for productionVerification Steps
hci1
→ Confirm logs show[DEBUG] Using Bluetooth adapter hci1
electrical.devices.*.deviceName
Tested Hardware: Raspberry Pi 4 (Buster) + Victron Orion XS/SmartShunt + Plugable USB-BT4LE dongle.
Requires:
bleak>=0.20.0