-
Notifications
You must be signed in to change notification settings - Fork 14
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
random connection timeouts using the library #4
Comments
Hmm, I'm really not too sure, looks like it might come from the underlying bluetooth library. I'm thinking of rebuilding this library in Node JS, maybe it works in that cosmos. In any case, if you find a solution, I'll be happy to merge a pull request :) |
Hi @chvolkmann, |
Hi @chvolkmann , I have stumbled across some information that I think might cure the issue of timeouts. On the following github page https://github.com/egold555/Govee-H6113-Reverse-Engineering is a mention of the AA data packets as being used for keep alive every 2 seconds. I'm thinking maybe these need to be sent to to keep the connection alive, and not let it time out. How would I mod your _send function? I see the self._dev.char_write function. can that just be called with the frame as defined in the github page above? I'm thinking if so, I might add a function in the object that would do the transmit, tho as structured, it would have to be sent by the python program calling your library manually I think. I'm not sure how it could be automated. |
I have modified the mqtt interface to the govee bulb using the 2 second keep alive( I made it 1.5 seconds) and I have had no failures with connectivity in the past few hours. with regards to failing to connect. edit: I have created a repository ( https://github.com/mqttblebulb/mqttblebulb ) that incorporates the ping as I have added it in the pr, and it is working well with no timeouts so far. the code now sends a keep alive ever 1.5 seconds to the bulb. |
I asked a question on stackexchange and I received a response that basically goes direct to the bluez interface, and works quite well. The python objects are basically a drop in replacement for the pygatt library you were using. The only change required in bluetooth_led.py is to modify the following line: def init(self, mac, bt_backend_cls=PyDbusBackend): and to import the new PyDbusBackend as follows: everything else in bluetooth_led.py stays the same. from .bluezdbus import PyDbusBackend, PyDbusDevice Do you want a pull request for the changes? This change also lets the module work on multiple bulbs simultaneously. The keep alive modification that i added previously is still working fine. |
Hi,
First, thank you for creating this library for accessing the GOVEE BT LED bulbs!
I am in process of writing a wrapper on a Raspberry pi 4 for this bulb that sends mqtt messages for use in Home assistant (home-assistant.io).
I do have all of the functionality working from within Home Assistant with regards to controlling the GOVEE bulb.
However, randomly, after 10 or 20 commands sent to the bulb, I get errors connecting. as follows:
raise ConnectionTimeout(self.mac, err)
govee_btled.errors.ConnectionTimeout: Failed connecting to XX:XX:XX:XX:XX:XX
Any ideas come to mind to fix this? For each call from Home assistant, the wrapper initializes the bulb, and then deletes the connection.
I have tried both the gattinfo as well as the BGAPI version in the pygatt library.
I also tried the following timeout change, with no change.
echo 1000 > /sys/kernel/debug/bluetooth/hci0/supervision_timeout
Thanks in advance!
The text was updated successfully, but these errors were encountered: