Read the statement by Michael Teeuw here.
MMM-OralB / Bluetooth equipped toothbrush integration
-
I am using a Logilink BT0015. The stick isn’t the problem as the Bluetooth connection ist established. Currently there are only API available for iOS and Android. So in general it should be possible communicate with the brush using Debian as well. but someone has to write a library/a driver to read all data. The module here is something like a showcase that to just uses the Bluetooth connection and interpret its connection time but is is not able to read data from the brush itself. We cannot just use the connection status as the brush does not disconnect Bluetooth when you stop brushing so the timer would keep running.
-
Hello,
i wrote a email too - and i got an answer - but they write, that they don’t know about
an sdk and if it’s posible to connect from a Linux to the toothbrush …
They give me two links - but …
http://www.pg.com/de_DE/
www.scienceinthebox.comMy result of my tests :)
node --version
v6.11.5
npm --version
3.10.10[Scenario 1 Start and Stop after 10 Sec]
pi@raspberrypi:~/MagicMirror/modules/MMM-OralB $ sudo node brushTimer.js scanning started... Toothbrush connection ALIVE atSat Nov 04 2017 14:06:35 GMT+0100 (CET) Toothbrush is running 0:1 0:2 0:41 0:42 Toothbrush connection LOST at Sat Nov 04 2017 14:07:17 GMT+0100 (CET) was alive since Sat Nov 04 2017 14:06:35 GMT+0100 (CET) Cooldown was432060 sec => => resetting timer [Scenario 2 Start and Stop after 3sec] Toothbrush connection ALIVE atSat Nov 04 2017 14:07:49 GMT+0100 (CET) Toothbrush is running 0:1 0:2 0:35 0:36 Toothbrush connection LOST at Sat Nov 04 2017 14:08:25 GMT+0100 (CET) was alive since Sat Nov 04 2017 14:07:49 GMT+0100 (CET) Cooldown was432128 sec => => resetting timer [Scenario 3 Start, wait like 10 seconds and stop. Start again within the next 10 seconds for like 5 seconds] Toothbrush connection ALIVE atSat Nov 04 2017 14:09:59 GMT+0100 (CET) Toothbrush is running 0:1 0:2 1:3 1:4 Toothbrush connection LOST at Sat Nov 04 2017 14:11:04 GMT+0100 (CET) was alive since Sat Nov 04 2017 14:09:59 GMT+0100 (CET) Cooldown was432286 sec => => resetting timer [Scenario 4 Start, wait like 10 seconds and stop. Start again after 40 seconds and stop 3sec later.] Toothbrush connection ALIVE atSat Nov 04 2017 14:11:59 GMT+0100 (CET) Toothbrush is running 0:1 0:2 0:42 0:43 Toothbrush connection LOST at Sat Nov 04 2017 14:12:43 GMT+0100 (CET) was alive since Sat Nov 04 2017 14:11:59 GMT+0100 (CET) Cooldown was432385 sec => => resetting timer Toothbrush connection ALIVE atSat Nov 04 2017 14:12:50 GMT+0100 (CET) Toothbrush is running 0:1 0:2 0:36 0:37 Toothbrush connection LOST at Sat Nov 04 2017 14:13:28 GMT+0100 (CET) was alive since Sat Nov 04 2017 14:12:50 GMT+0100 (CET) Cooldown was432430 sec => => resetting timer
I think next week i try to have a lock on the android sdk … perhaps i can find something.
PS: do you think it is possible to change the code that it’s possible to add 2 toothbrushs ?
because - i have two … -
This topic came up again (https://forum.magicmirror.builders/topic/6073/integration-of-the-oral-b-toothbrush-data) so I thought I’d share my thoughts:
Without a brush to test, the info from the thread and the documentation got me thinking: You’re only checking the on/off status of the brush right now. How about:
A) Having a small dedicated Android device running the SDK to grab and forward the data?
B) Using the Oral-B App on your phone would save your data in their cloud, right? And you can access that API, right? So to me it seems like you could get the data from the cloud – provided the app is running on your phone, forwarding the data. -
Hi,
this all requires additional equipment. I have a bluetooth enabled mirror and the toothbrush. That should be enough! I don´t want to run my phone to record data and display the recorded data later on the mirror. We just need to find a way to directly read and interpret the data using the direct bluetooth connection.
Currently the script is just a proof of concept that we are able to read the connection status. The whole data part is still missing. I´m not that close to hardware integration and development that I could do that by my own. I can just offer support to test an maybe enhance the solution once somebody has written a library that is able to read the data send by the brush. -
I have just written an additional request to PG asking for support. Lets see if I get an answer…
-
I’m still hoping some genius starts to hack the protocol. This is the tricky part. Once this is done, building a module for the MM-framework is a walk in the park.
-
Hi everybody,
i’m a developer too and also very interested in solving this use case. At the moment i consider to build up my own magic mirror, but it depends on some useful features i want to have a real benefit from it.
Actually i want to simply get the “start” and the “stop” signal from the brush to display a timer, which is stopped on “stop” and resumed on “start”.
Other features are more unnecessary sugar in my opinion. I’m using electric toothbrushes from Braun/Oral-B since about 20 years from now. I never changed the brush mode (if i had to, i could feel the mode. they are very various) and i’m ignoring the segmented Ring, the motivation Smiley and the star rating consequent 2 times a day.
2 years ago my toothbrush gone broken so i’ve got a new one. At this point i noticed, that both “Smart Guides” (that’s the shipped displays with Oral-B brushes) getting “start” signal from one brush.
This means there a no “pairings” or “syncs” between the smart guide and the brush. (maybe some days my neighbor will trigger this… :D )
Also my new brush is the first one advertising bluetooth integration. This leads to my assumption that “Smart Guides” not using bluetooth in anyway.I’m not really experienced or well educated in electronic components, but maybe there is something like a proprietary radio antenna, waiting for a simple signal.
Maybe it’s possible to build up the same radio trigger with an antenna like the “Smart Guide” is using?Any ideas if this would be possible?
Greetings
-
Someone on the Home Assistant Forum seems to have the code figured out:
https://community.home-assistant.io/t/oral-b-bluetooth-connected-toothbrush/35595/10Is it now possible, to display the same information like the app does?
-
Guys, I would like to relive this topic. Using the project from the home assistant guy( who even referenced us :-) ) and our combined effort we should be able to reach something, shouldn’t we?
@SvenSommer are you still listening? :-) I’ve looked through your repository but have not found a final implementation of a timer. There is still no server-client communication, or have I overseen something?
The problem is still that every toothbrush version may behave a bit differently but having at least a timer on the mirror and maybe even a bit more (battery status) after that would be a big win.
So while I’m trying to understand this code https://github.com/rfaelens/domotica/blob/master/mqtt-toothbrush.py which should present at least part of the solution, I’m happy for everyone who joins the effort to make toothbrushing great again!!
-
Exciting times!!
I have been able to move a bit further on this (I think)
With the help of this linkedin post (which funnily enough referenced this forum) and above mentioned post in the home-assistant forum I was able to dive a bit deeper into noble and the BLE interaction.
The current status:- I can read out battery status!! (with the help of this gitlab snippet (yeay!)
- I receive data when turning the brush on and off (and on again) and am able to filter this data. However I’m completely new to noble, the BLE services system and apparently need to learn a lot.
- I am using the npm module @abandonware/noble since the original noble has not been maintained for a few years.
- For some odd reason, I needed to put my js file into the noble folder and work from there. Still need to try working in the oral-b main folder
Here’s what I have learned:
According to the linkedin post (and I could validate that) the “manufacturerData” is NOT a fixed brush-specific value BUT CONTAINS ACTUALLY USEFUL INFORMATION. And it changes. Some of the brush information is written into this entry. You can get the status of the brush and the running time from this.
The question of course is if this is really needed.From my point of view you only need a reliable signal when turning on and off the brush. I’m not sure if I have that already, @SvenSommer might have been already further than I am now, but it is still exciting.
It is still a problem for me to properly talk to the brush :-D . I would like to have a constant flow of information (at least receive the “manufacturedata” every second or so) when the brush is active, and currently I don’t know how to do that. Guess I need to trigger this somehow with noble.TODOs:
- Implement a timer into the module and check if the current setup works well enough.
- Find more characteristics to use as data source
- Find out how to constantly trigger the brush to send its manufacturedata.
And finally here’s my code:
var async = require('async'); var noble = require('@abandonware/noble'); //var OralB_manufacturerData = 'dc0003220c0328000001010004'; process.env['NOBLE_HCI_DEVICE_ID'] = 0 noble.on('stateChange', function(state) { console.log('Changed state to:' + noble.state); if (state === 'poweredOn') { noble.startScanning([], true); } else { console.log('changed state to: ' + noble.state); noble.stopScanning(); } }); console.log('Searching for OralB Toothbrushes'); noble.on('discover', function(peripheral) { var ad = peripheral.advertisement || ""; if (ad.localName == "Oral-B Toothbrush") { //console.log('Found device with local name: ' + ad.localName); //console.log('advertising the following service uuid\'s: ' + ad.serviceUuids); //console.log("ID: "+peripheral.id); //console.log("Advertisement: "+ad); if (ad.manufacturerData) { console.log(ad.manufacturerData.toString('hex')); //console.log('Found OralB Toothbrush with ID: ' + peripheral.id); noble.stopScanning(); peripheral.connect(function(error) { if (error) { console.log("Error connecting to peripheral: " +error) } else { console.log('Connected to peripheral: ' + peripheral.uuid); peripheral.discoverServices([], function(error, services) { console.log("Discovering services...") if (error) { console.log("ERROR while discovering peripherals: " + error); } else { /*console.log('discovered the following services:'); for (var i in services) { console.log(' ' + i + ' uuid: ' + services[i].uuid); }*/ discoverChars(services[3]); /*setTimeout(() => { noble.startScanning([], true); }, 1000);*/ } //peripheral.disconnect(); }); } }); peripheral.on('disconnect', function() { //process.exit(0); console.log("Peripheral disconnected. Scanning again!"); noble.startScanning(); }); } }; }); function discoverChars(service) { service.discoverCharacteristics(null, function(error, characteristics) { //console.log(characteristics); for (var i in characteristics) { var charUUID = characteristics[i].uuid; //console.log("UUID: "+charUUID); if (characteristics[i].uuid == "a0f0ff0550474d5382084f72616c2d42") { characteristics[i].subscribe(function(error){ if(error !== null) console.log("error", error); }); characteristics[i].on('data', function(data, isNotification){ valueInt = data.readInt8(0); //console.log("Battery: "+valueInt+"%") }); characteristics[i].read(function(error, data) { if (data) { valueInt = data.readInt8(0); console.log("Battery: "+valueInt+"%") } }); } } }); }