-
Notifications
You must be signed in to change notification settings - Fork 9
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
Issues with Bluetooth in Raspberry Pi #15
Comments
There seems to be an issue with the bluetooth dongle. Can you connect to the thermostats with bluetoothctl? (see pairing section of readme) I had that once and I had to physically power cycle the dongle for it to start working again (unplug it from the usb). |
@dbuezas I will give it a go. Just as clarification, it's not a dongle, the BT is the built-in one in RPI3. |
This is a short output from
|
Try pairing them (see readme) |
OK, now pairing is also done, but no difference. Just a note, pairing went through without any pin prompt
|
I tried to enable debug logs, but somehow no other output is visible
|
What happens if you connect to the thermostat with bluetoothctl? |
It shows connected ok after a short while. I now managed to get the logs (the logs goes from the fresh reboot):
|
And one more log - added logging for bluez module.
|
It seems like the thermostats don't accept the request for notifications. This is really odd. I can try making a version that uses handles (a short number) instead of uids (more specific long list of alphanumeric values), but first make sure you are on the latest HA version and turn the pi filly off (also take remove power) to ensure its not some random bug somewhere else. Let me know the result and I'll try to make a test version after that. |
I had some time and made the test version. In HACS, go to this component and click "show beta versions". |
@dbuezas thanks for the effort you are putting into this issue. The logs from the experimental version. Here switch to Auto mode. Question - can you tell what commands I can issue through bluetoothctl to simulate the same thing that the driver is doing? Just to make sure that there is no other issue related to h/w or connection. Interesting enough one of the thermostats sometimes works, just the other 3 not. And it's always the same one.
|
Mmmm can you put the PI right next to one of them to make sure it is not a signal strength issue? |
I have the same issue (also on a PI) and I think I have managed to fix it. I'm currently trying to find out which of my modifications actually solved the issue and will create a PR as soon as I have done so. Edit: I'm back to having this issue now but I'm pretty sure the connection lasted more than 5 minutes on a previous try. So I might not have fixed anything after all |
I think I have identified the underlying issue. The homeassistant bluetooth stack relies heavily on listening to advertisements to track which devices are still available. However, there seem to be cases where either no advertisements are received or they are lost somewhere before reaching HA. This will cause HA to assume that the device isn't there even if it is. I see two solutions for this (and I will try to do both):
|
That's very interesting! |
I don't want to rise hopes too much though: although the last error "Can't find device" is due to the missing advertisements (as you discovered), in the log far above the issue was a missing characteristic "Characteristic d0e8434d-cd29-0996-af41-6c90f4e0eb2a not found" |
For me the only errors are "Can't find device" so I'm somewhat optimistic. However, your fix still results in "No device found for address ..." and the controller is never notified of the connection request. I'm investigating why. |
Sadly, I don't think working around this issue is possible without changes in HA. |
ok, it looks like it is a very bad idea to do this then. Did you make sure this doesn't happen to work for you anyway? |
Homeassitant intercepts the creation of BleakClient and redirects it to HaBleakClientWrapper |
Did you report this to Home Assistant? I think they are probably not testing much on raspberry pi with connectable devices |
I reported it and it got closed as won't fix. So I've just ordered yet another Bluetooth dongle that's on the compatibility list. I can properly connect with one of the thermostats using the integrated Bluetooth of the Pi but the rest are out of reach. So I hope that with the new dongle it will actually work. |
@ikempf, do you know what change is needed in the HA code to make this working? Can you post the code here? |
As a really quick and dirty fix you can just place a |
@paulokow But looking at your logs more carefully I doubt that this will completely fix your connection issue. It might help a bit but you seem to be running into additional issues. Do you fulfill the software requirements listed at https://www.home-assistant.io/integrations/bluetooth/? |
@lkempf thanks. I just just use official HASS image on RPI3, so I don't assume anything wrong with the s/w stack. |
Could it be that HA thinks the bluetooth adapter cannot connect to devices? ble_device = bluetooth.async_ble_device_from_address(
self._hass,
self._mac,
connectable=False # <--- this
) |
https://github.com/Heckie75/eQ-3-radiator-thermostat#3-pair-bluetooth This cli implementation has an excellent readme, and says BT should be dis- and re-enabled via thermostat wheel |
OK, I solved my problem. After going through @dbuezas thanks for all the support anyway. |
Great to hear! Thanks for getting back with the solution. |
Hi,
The thermostats are not working on my RPI3 setup. Sometimes 3 or 4 connect, but usually none of them work.
The same setup (RPI and thermostats) worked fine with HA prior to 2022.7.
I see the following in my logs:
And then:
Finally
and
The text was updated successfully, but these errors were encountered: