You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I try to run your script but it doesn't work on my side. Can you please help?
I created fancy.py
cat python-toothbrush/toothbrush/fancy.py
from toothbrush.base import Toothbrush
from toothbrush.constants import ROUTINE, INTENSITY
class FancyToothbrush(Toothbrush):
attributes = [ROUTINE, INTENSITY] # defines which attributes are available
handles = { # defines under which handle the attributes can be read
INTENSITY: 0x11,
ROUTINE: 0x12
}
Python 3.7.3 (default, Dec 20 2019, 18:57:59)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from toothbrush.fancy import FancyToothbrush
>>> fancy = FancyToothbrush("70:28:45:xx:xx:xx")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/root/python-toothbrush/toothbrush/base.py", line 14, in __init__
self.update()
File "/root/python-toothbrush/toothbrush/base.py", line 21, in update
peripheral = self.peripheral
File "/root/python-toothbrush/toothbrush/base.py", line 18, in peripheral
return Peripheral(self.address, "public")
File "/usr/local/lib/python3.7/dist-packages/bluepy/btle.py", line 391, in __init__
self._connect(deviceAddr, addrType, iface)
File "/usr/local/lib/python3.7/dist-packages/bluepy/btle.py", line 439, in _connect
raise BTLEDisconnectError("Failed to connect to peripheral %s, addr type: %s" % (addr, addrType), rsp)
bluepy.btle.BTLEDisconnectError: Failed to connect to peripheral 70:28:45:xx:xx:xx, addr type: public
70:28:45:xx:xx:xx is my Oclean X toothbrush MAC address
Thank you.
The text was updated successfully, but these errors were encountered:
Hello - thank you very much for considering to use python-toothbrush.
It's hard to debug the issue from the distance so I can just take a guess on what could be the problem.
Make sure your computer uses Bluetooth Low Energy (BLE).
Make sure your toothbrush supports BLE.
For debugging purposes try to connect to the toothbrush through other CLI like bluetoothctl, hcitool or gattool. If that doesn't work out you probably have some underlying issue, which means that the python scripts will probably not work as well.
If you get it to work with any of the CLIs - It looks like you used the default values for the handles from the README. This will probably not work out since these are different for every manufacturer. You need to find out the correct handles somehow - maybe there is some documentation from the manufacturer or you could reverse engineer the BLE protocol as I did with the Sonicare toothbrush. Just to manage expectations here :)
Hello,
Thanks for your work.
I'm checking to have my toothbrush added to Home assistant. Here is the production: https://www.oclean.com/en/one/
It was requested on https://community.home-assistant.io/t/oclean-one-bluetooth-toothbrush/105853
I try to run your script but it doesn't work on my side. Can you please help?
I created fancy.py
70:28:45:xx:xx:xx is my Oclean X toothbrush MAC address
Thank you.
The text was updated successfully, but these errors were encountered: