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

Cannot communicate with switchbot #223

Open
jamescw opened this issue Mar 25, 2024 · 2 comments
Open

Cannot communicate with switchbot #223

jamescw opened this issue Mar 25, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@jamescw
Copy link

jamescw commented Mar 25, 2024

Nice and great work!

Failed to communicate with the bot over bluetooth, not sure what the issue is, dbus was mapped properly, below is the error:

switchbot-mqtt    | Traceback (most recent call last):
switchbot-mqtt    |   File "/switchbot-mqtt/.venv/lib/python3.8/site-packages/switchbot/__init__.py", line 283, in _sendcommand
switchbot-mqtt    |     self._connect()
switchbot-mqtt    |   File "/switchbot-mqtt/.venv/lib/python3.8/site-packages/switchbot/__init__.py", line 232, in _connect
switchbot-mqtt    |     self._device = bluepy.btle.Peripheral(
switchbot-mqtt    |   File "/switchbot-mqtt/.venv/lib/python3.8/site-packages/bluepy/btle.py", line 391, in __init__
switchbot-mqtt    |     self._connect(deviceAddr, addrType, iface)
switchbot-mqtt    |   File "/switchbot-mqtt/.venv/lib/python3.8/site-packages/bluepy/btle.py", line 439, in _connect
switchbot-mqtt    |     raise BTLEDisconnectError("Failed to connect to peripheral %s, addr type: %s" % (addr, addrType), rsp)
switchbot-mqtt    | bluepy.btle.BTLEDisconnectError: Failed to connect to peripheral c8:c9:a9:33:64:4a, addr type: random
switchbot-mqtt    | Switchbot communication failed. Stopping trying
switchbot-mqtt    | NoneType: None
switchbot-mqtt    | failed to turn on switchbot c8:c9:a9:33:64:4a

I used the docker-compose to map the config, switchbot is on firmware 6.4.

@fphammerle fphammerle added the bug Something isn't working label Mar 25, 2024
@fphammerle
Copy link
Owner

fphammerle commented Mar 25, 2024

switchbot-mqtt sends commands via the pySwitchbot library.

Could you try upgrading pySwitchbot to its latest version (within the container) and retry?

If that works, I need to loosen the version constraints of pySwitchbot in switchbot-mqtt.

If the upgrade does not make any difference, could you attempt to invoke pySwitchbot directly (via a python shell or small script)?

@jamescw
Copy link
Author

jamescw commented Apr 4, 2024

Hi @fphammerle, yes for sure will try that and get back to you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants