Skip to content
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

offen i have this error "Could not connect to {}".format(mac)" #21

Open
uowis opened this issue Aug 28, 2022 · 8 comments
Open

offen i have this error "Could not connect to {}".format(mac)" #21

uowis opened this issue Aug 28, 2022 · 8 comments

Comments

@uowis
Copy link

uowis commented Aug 28, 2022

`[2022-08-28 18:33:49] DEBUG: Retrying d8:71:4d:96:c3:50

[2022-08-28 18:33:59] INFO: Not able to connect to d8:71:4d:96:c3:50

[2022-08-28 18:33:59] ERROR: Error getting device info for d8:71:4d:96:c3:50: Could not connect to d8:71:4d:96:c3:50

Traceback (most recent call last):
File "/src/airthings.py", line 273, in get_info
raise Exception("Could not connect to {}".format(mac))
Exception: Could not connect to d8:71:4d:96:c3:50

[2022-08-28 18:33:59] DEBUG: Disconnected.

[2022-08-28 18:33:59] DEBUG: Getting sensors...

[2022-08-28 18:33:59] DEBUG: Getting sensors for d8:71:4d:96:c3:50

[2022-08-28 18:33:59] DEBUG: Connecting to d8:71:4d:96:c3:50

[2022-08-28 18:34:09] DEBUG: Retrying d8:71:4d:96:c3:50`

@mjmccans
Copy link
Owner

Apologies for the delay responding. I was away for a while, but more importantly I am holding off making changes to this addon because it looks like support for Airthings devices is likely being brought into Home Assistant Core (see this pull request). I understand that it almost made it into 2022.09 and is currently slated to be included with 2022.10. The addition to Core includes the changes I made to use the new Bleak library, and is a better solution than this addon. For example, it will include device discovery, which is a much better user experience. Fingers crossed it will make it in and this addon will be rendered obsolete.

@dipcore
Copy link

dipcore commented Oct 25, 2022

But in fact that error appears for me too. I hope it is not related to Bleak, and we wont have the same error with Home Assistant Core

@dipcore
Copy link

dipcore commented Oct 26, 2022

I have a feeling this error happens when two or more devices used. Similar behavior I have for the component you mention (home-assistant/core#77284 I installed it as a custom component to check it out)

2022-10-25 12:23:30.815 ERROR (MainThread) [custom_components.airthings_ble.config_flow] Error connecting to and getting data from E4:E1:12:29:78:59: E4:E1:12:29:78:59 - /org/bluez/hci0/dev_E4_E1_12_29_78_59: Failed to connect: [org.freedesktop.DBus.Error.UnknownObject] Method "Connect" with signature "" on interface "org.bluez.Device1" doesn't exist

So as a result one sensor is added and used properly. For second one I get an error above.

@mjmccans
Copy link
Owner

The error you are getting is more about the addon being overly verbose in its output. I am no bluetooth expert, but I have found connecting to devices to be a bit finicky, particularly when they are farther away. Therefore, often connections fail which is why there are a number of retries.

In other news, it looks like the new Airthings BLE will be included in 2022.11 (see https://rc.home-assistant.io/blog/2022/10/26/release-202211/#new-integrations). I have not used it yet but, as mentioned before, I believe native support will provide a better and more reliable experience than my addon.

@dipcore
Copy link

dipcore commented Oct 29, 2022

You are right. After abit more detailed investigation, I found out that is directly related to bluetooth connection and most likely interference with sonoff zigbee usb dongle. When I have it plugged directly to usb port of my RPi4 Airthings sensor located in my basement often gets disconnected. And I have tons of retries.

The gaps on the chart are connection issues I had:
image

NB Using usb extension cable and placing zigbee dongle 30 cm away seems solve the issue.

@uowis
Copy link
Author

uowis commented Nov 3, 2022

https://www.home-assistant.io/integrations/airthings_ble), added by @vincegio](https://www.home-assistant.io/blog/2022/11/02/release-202211/)
I'm triying it

@dipcore
Copy link

dipcore commented Nov 3, 2022

@uowis I just updated and it works fine for me for two devices! (with using usb extension cable to move zigbee dongle away)

@uowis
Copy link
Author

uowis commented Dec 11, 2022

yes it make the Job but, it will be better that work with MQTT to keep value,..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants