• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

MMM-OralB / Bluetooth equipped toothbrush integration

Scheduled Pinned Locked Moved Development
68 Posts 13 Posters 23.5k Views 20 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    lavolp3 Module Developer @lavolp3
    last edited by Feb 23, 2020, 8:52 PM

    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

    How to troubleshoot modules
    MMM-soccer v2, MMM-AVStock

    1 Reply Last reply Reply Quote 0
    • T Offline
      timodejong95
      last edited by Mar 21, 2020, 12:00 PM

      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.

      L 1 Reply Last reply Mar 22, 2020, 2:00 PM Reply Quote 1
      • L Offline
        lavolp3 Module Developer @timodejong95
        last edited by Mar 22, 2020, 2:00 PM

        @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: "" }
                ]
              }
            },
        
        

        How to troubleshoot modules
        MMM-soccer v2, MMM-AVStock

        L 1 Reply Last reply Mar 22, 2020, 2:02 PM Reply Quote 0
        • L Offline
          lavolp3 Module Developer @lavolp3
          last edited by Mar 22, 2020, 2:02 PM

          @lavolp3 Also mentioning in the Readme that npm install is necessary would be helpful

          How to troubleshoot modules
          MMM-soccer v2, MMM-AVStock

          1 Reply Last reply Reply Quote 0
          • L Offline
            lavolp3 Module Developer
            last edited by lavolp3 Mar 22, 2020, 2:07 PM Mar 22, 2020, 2:07 PM

            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

            How to troubleshoot modules
            MMM-soccer v2, MMM-AVStock

            1 Reply Last reply Reply Quote 0
            • T Offline
              timodejong95
              last edited by timodejong95 Mar 22, 2020, 4:23 PM Mar 22, 2020, 4:20 PM

              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.

              L 2 Replies Last reply Mar 22, 2020, 11:30 PM Reply Quote 0
              • L Offline
                lavolp3 Module Developer @timodejong95
                last edited by lavolp3 Mar 22, 2020, 11:31 PM Mar 22, 2020, 11:30 PM

                @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.

                How to troubleshoot modules
                MMM-soccer v2, MMM-AVStock

                1 Reply Last reply Reply Quote 0
                • L Offline
                  lavolp3 Module Developer @timodejong95
                  last edited by lavolp3 Mar 23, 2020, 11:06 AM Mar 23, 2020, 11:06 AM

                  @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.

                  How to troubleshoot modules
                  MMM-soccer v2, MMM-AVStock

                  T 1 Reply Last reply Mar 23, 2020, 12:05 PM Reply Quote 0
                  • T Offline
                    timodejong95 @lavolp3
                    last edited by Mar 23, 2020, 12:05 PM

                    @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.

                    1 Reply Last reply Reply Quote 0
                    • T Offline
                      timodejong95
                      last edited by Mar 23, 2020, 9:39 PM

                      I have tweaked the code a bit towards better exception handling, this might be helpful for you

                      1 Reply Last reply Reply Quote 0
                      • 1
                      • 2
                      • 3
                      • 4
                      • 5
                      • 6
                      • 7
                      • 3 / 7
                      • First post
                        Last post
                      Enjoying MagicMirror? Please consider a donation!
                      MagicMirror created by Michael Teeuw.
                      Forum managed by Sam, technical setup by Karsten.
                      This forum is using NodeBB as its core | Contributors
                      Contact | Privacy Policy