Read the statement by Michael Teeuw here.
MMM-OralB / Bluetooth equipped toothbrush integration
-
@SvenSommer Thanks Sven and good you’re back on this :-)
I have one question on noble I can’t figure out.
withnoble.on('discover')
I can exchange information on discovery, so as soon as the brush sends a certain signal. All good.
But how can I trigger the brush to send its manufacturedata, let’s say, every 2 seconds?
Or is that not possible at all? -
A small heads-up: Still not getting to terms with noble.
But as I had some connection problems today, I used bluetoothctl again to connect to my brush.
And found out that scanning with bluetoothctl gets a constant output of the manufacturerData of the brush.With bluetoothctl it would be able to get information on
- running time
- mode (on/off)
- quadrant
in an interval of like 10 seconds
-
Hey guys,
I have tracked this topic for a while and I have created an own module for bluetooth devices based on (https://github.com/Hypfer/Cybele). Currently only Oral B toothbrush is supported: https://github.com/timodejong95/MMM-BluetoothDevices
I am still testing it but it seems to work stable’ish. Although I cannot test it with an actual mirror because that is still work in progress. If you want to check it out and test be my guest. If you have any improvements or tips let me know!
Hope this helps out.
-
@timodejong95 GREAT!!
I’ll try it out now.
One comment to the readme.
You have given the config entry in JSON style (with hyphens around the keys).
Config entries are in JS style.
I guess devices should also be an array of JS objects?Then it should be like this:
{ module: "MMM-BluetoothDevices", position: "bottom_bar", config: { devices: [ { type: "OralBToothbrush", name: "OralB", mac: "" } ] } },
-
@lavolp3 Also mentioning in the Readme that
npm install
is necessary would be helpful -
OK I have a first error message
[15:04:46.174] [ERROR] 15:04:46 <error> (node:1454) UnhandledPromiseRejectionWarning: Error: No such interface found at /home/pi/MagicMirror/modules/MMM-BluetoothDevices/node_modules/dbus-native/lib/introspect.js:31:23 at Parser.<anonymous> (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/node_modules/xml2js/lib/parser.js:304:18) at Parser.emit (events.js:182:13) at SAXParser.onclosetag (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/node_modules/xml2js/lib/parser.js:262:26) at emit (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/node_modules/sax/lib/sax.js:624:35) at emitNode (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/node_modules/sax/lib/sax.js:629:5) at closeTag (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/node_modules/sax/lib/sax.js:889:7) at SAXParser.write (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/node_modules/sax/lib/sax.js:1436:13) at Parser.exports.Parser.Parser.parseString (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/node_modules/xml2js/lib/parser.js:323:31) at Parser.parseString (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/node_modules/xml2js/lib/parser.js:5:59) (/home/pi/MagicMirror/internal/process/warning.js:18 writeOut)
no Toothbrush activated yet. Only started the mirror with npm start dev.
Running on a RasPi 3b w/ on-board bluetooth -
Ooh good one, I have some time tonight, will update the docs.
Hmm you running on raspberry pi do you got bluetooth enabled? Can you find the toothbrush if you use the GUI bluetooth?
If you got the time could we skype or call, it’s faster to tackle issueus, PM me about that.
-
@timodejong95 that’s rather difficult for me juggling with family, (home) office and several other things I have to say. Will think about this and let you know.
I have worked successfully with bluetoothctl and noble (npm).
Both were able to connect to the brush.
With bluetoothctl I got a constant stream of the manufacturer data that contains some info. (see above)
I used that straight from the console. -
@timodejong95 OK I have identified the source of the error.
It originated from the connectDevice function on Dongle.js
I had a wrong mac address for the brush which leads to an unresolved promise.
Good luck finding the promise :smiling_face_with_open_mouth_smiling_eyes:
(I love/hate promises…)Correcting the mac address I get new unresolved rejection errors.
[11:54:35.940] [LOG] 11:54:35 <log> Retrying Dirks OralB 2/3 (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Device.js:42 Promise) [11:54:35.964] [ERROR] 11:54:35 <error> (node:23373) UnhandledPromiseRejectionWarning: Software caused connection abort (/home/pi/MagicMirror/internal/process/warning.js:18 writeOut) [11:54:35.970] [ERROR] 11:54:35 <error> (node:23373) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (/home/pi/MagicMirror/internal/process/warning.js:18 writeOut) [11:54:35.975] [ERROR] 11:54:35 <error> (node:23373) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. (/home/pi/MagicMirror/internal/process/warning.js:18 writeOut) [11:55:16.260] [LOG] 11:55:16 <log> Retrying Dirks OralB 3/3 (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Device.js:42 Promise) [11:55:16.275] [ERROR] 11:55:16 <error> (node:23373) UnhandledPromiseRejectionWarning: Software caused connection abort (/home/pi/MagicMirror/internal/process/warning.js:18 writeOut) [11:55:16.279] [ERROR] 11:55:16 <error> (node:23373) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2) (/home/pi/MagicMirror/internal/process/warning.js:18 writeOut) [11:55:56.582] [ERROR] 11:55:56 <error> (node:23373) UnhandledPromiseRejectionWarning: Error: Couldn't connect to Dirks OralB after 4 tries. at Promise (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Device.js:46:16) at new Promise (<anonymous>) at tryConnect (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Device.js:40:14) at Object.iFace.Connect (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/src/Device.js:56:13) at EventEmitter.<anonymous> (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/node_modules/dbus-native/lib/bus.js:140:19) at EventEmitter.emit (events.js:187:15) at /home/pi/MagicMirror/modules/MMM-BluetoothDevices/node_modules/dbus-native/index.js:106:14 at Socket.<anonymous> (/home/pi/MagicMirror/modules/MMM-BluetoothDevices/node_modules/dbus-native/lib/message.js:55:9) at Socket.emit (events.js:182:13) at emitReadable_ (_stream_readable.js:540:12) (/home/pi/MagicMirror/internal/process/warning.js:18 writeOut) [11:55:56.588] [ERROR] 11:55:56 <error> (node:23373) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3) (/home/pi/MagicMirror/internal/process/warning.js:18 writeOut) [11:55:56.593] [ERROR] 11:55:56 <error> (node:23373) UnhandledPromiseRejectionWarning: Software caused connection abort (/home/pi/MagicMirror/internal/process/warning.js:18 writeOut) [11:55:56.599] [ERROR] 11:55:56 <error> (node:23373) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4) (/home/pi/MagicMirror/internal/process/warning.js:18 writeOut)
So… Software caused connection abort. Don’t know what that means unfortunately. Guess I need to learn a bit more about the connection process. But I get the feeling that this module is a bit too complex for just using with my toothbrush.
Let me know if you know my problem. -
@lavolp3 Check, I will update the docs, with more info soon.
Yeah promises could be really nice if implemented correctly, now debugging is a pain because the error logs are not as useful. I will make this better in the coming week.
When you hit the web interfase the node_helper is triggered, do you then have your brush on? Because when you start up the first time, alle the devices should be on and ready to connect.