Smart Toothbrush (Oral-B) Integration

Hey,

New to the forms so please feel free to tell me I’m posting in the wrong place etc. no offence will be taken.

I’m looking for advice and pointers on the “best” way to go about designing an integration that tracks some data from my smart toothbrush (one of the Braun Oral-B bluetooth toothbrush).

I’d like to track:

  • Battery
  • Last seen in use (or general on/off tracking)
  • Last duration

I’ve got a proof of concept up and working by gutting the bluetooth le tracker, replacing the blutooth library with pyblue and then pounding on it with a wrench until I was able to interrogate the device and obtain the data.

This works and I can now see the battery and presence detection from the device_tracker platform. Smashing.

So next I wanted to:

  • Learn a bit more about home assistant integrations
  • Possibly build something that others can benefit from

I feel that using the device_tracker platform is possibly a little bit nasty but I’m new to the home assistant world so it’s unclear to me what a better architecture for my integration would look like.

One of the things is that the device is only available for interrogation shortly after it has been used. Ideally I would have a process scanning or listening and then update the state of, say a battery sensor platform.

Any pointers and advise would be gratefully received.

Also, sorry if I’m using the wrong nouns for platform/integration etc. as I said, I’m new to this and it trips me up occasionally :slight_smile:

2 Likes

A lot of good BLE integration is done via esphome.io

Also, study code, its all on github. And read the dev docs.

1 Like

There is a bluetooth mqtt gateway which seems to provide the possibiliy to integrate a toothbrush.

1 Like

Thank you nick, I’d thought about something like an esp32 but wanted to leverage the bluetooth on the RPi.

Thanks for the pointers about RTFM :wink: and the code. Indeed I’ve been using both of these as a guide. I think one thing that I’m still unsure about is how a subscription (vs polling) model would work if I had a python class that could notify on updates.

The device_tracker integration appears to be a mix of “legacy” and I guess “modern”. Does anyone know of a summary of what would be considered legacy vs modern in general for HA? Lots of newbie questions, thanks in advance.

Thanks Dennis,

Nearly smacked my forehead at the prospect that I had missed an existing integration. Upon a quick inspection of the code it looks like the battery level isn’t supported (and it’s unsurprising because it was rather a pain in the proverbial to get it working). I’ll look at maybe creating a PR with the battery included.

I think I now have more newbie questions…
Why would one favour building the integration externally like this rather than using the integration components framework (again sorry if I’m butchering the nomenclature) within home assistant?

I note that the above gateway is intended to run as a docker container, I wonder if it will run as an addon with appropriate effort.

Enjoying learning about home assistant (even if I now completely hate all bluetooth devices).

Until you find the rpi inadequate for HA :slight_smile:

  1. because you can’t or can’t be bothered getting to grips with the ha code.
  2. because you want your software to use MQTT and therefore be compatible across the board of home automation systems.

This thread makes me feel as though home automation is ‘jumping the shark’…

1 Like

Oh, I’m fully aware of this. However I thin the shark was jumped when the manufacturer put Bluetooth in the toothbrush to begin with :wink:
There is a genuine use-case out of all of this, it’s a perennial problem that we end up with a flat toothbrush because on one realised it was low on battery. Having the value in home assistant means I can trigger an alert off the back of it.

Ok, now this is getting ridiculous:

3 Likes

I’m often thinking about some new gadgets “Why would I integrate them into HA?” and the answer is basicly because I can or because want to try.

1 Like

Love it. Already have my Oral-B brush duration being pumped into influxdb and grafana. Best of luck getting a component into HA!

OTOH teaching kids to brush regularly could be assisted. Parents know what I mean :slight_smile:

1 Like

Just started a Python package to read out electrical toothbrushes via Bluetooth LE.
Currently it only supports Philips Sonicare - however, it is pretty simple to extend and add other toothbrushes as well :slight_smile:

It could be the basis for a Home Assistant integration of toothbrushes. I’d love to receive some feedback and maybe even some PRs!

3 Likes

that’s pretty cool since I also have a Philips Sonicare! I’d want to start different routines once i brush my teeth or after I’m done with brushing my teeth.

Any progress on this? I made the oral-b Home Assistant specific worker for zewelor bt-mqtt-gateway in the past and checking on https://github.com/Hypfer/Cybele

Having a library like SteinRobert is making would be nice so it could be integrated in a more clean way into bt-mqtt-gateway and Home Assistant and it could allow me to detect brushing sessions through the whole house :slight_smile:

1 Like