MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    1. Home
    2. SvenSommer
    3. Posts
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.
    Offline
    • Profile
    • Following 0
    • Followers 1
    • Topics 7
    • Posts 73
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: Camera intigration in your Mirror

      @lolobyte
      I’m amazed by the quality of your picture with IR-Light.
      What kind of IR lamp are you using?

      I’m also using a raspi noir camera and integraded like 30 IR-Leds within the mirror to get a brighter picture.
      But always have problems with the face recognition. I assume it’s because the pictures used for comparing a black and white and for contrast reasons much darker.

      0_1485288663995_capture_20161215_184130.jpg

      posted in General Discussion
      SvenSommerS
      SvenSommer
    • RE: Toothbrush integration

      Hey,
      I have bad news.

      The readable informations provided by the brush via bluetooth aren’t changing. Not while the toothbrush is running. I guess the characteristics we were able to readout, are used like placeholder for the sdk.

      Second try was to get notified if a broadcastd value (characteristic) is changing. Nothing here either.
      Every characteristic (like brushing time, battery level, etc) is using the same id and only provides a different name. So a notification service wasn’t possible.

      Seems like there is no way to get the information read out via bluetooth without using the sdk…

      I also tried to include the provided sdk into the MM-framework.
      Therefore I had a try with node-java, which allows to run java classes within nodejs. The files from the android sdk are java classes.

      It went pretty nice in the beginning. But then I ran into an error
      ‘Expected stackmap frame at this location.’ which is caused by the compiling the sdk classes on another system (linux not android), I would assume.

      I was amazed that I wasn’t able to find any code snippets of frameworks from other developers to “hack the brush” when I first started. By now its seems obvious that it’s not that easy.

      If anybody else is gonna have a try, please don’t hesitate to ask if you need assistance.

      posted in Requests
      SvenSommerS
      SvenSommer
    • RE: Bluetooth connections with noble

      So noble is working fine. I find all bluetooth devices as expected, as long it’s not running within the MM-framework.

      It seems like noble isn’t able to power on the bluetooth adapter on the raspberry pi3 board when started by magicmirror.

      Any ideas?

      Here is a minimal example:

      var noble = require('noble');
      
      console.log('stateChange is: ' + noble.state);
      noble.on('stateChange', function(state) {
        console.log('changed state to: ' + noble.state);
        if (state === 'poweredOn') {
          noble.startScanning();
        }else  {
          noble.stopScanning();
        }
      });
      console.log('stateChange is: ' + noble.state);
      
      

      leeds to:

      stateChange is: unknown
      stateChange is: unknown
      
      
      posted in Development
      SvenSommerS
      SvenSommer
    • RE: Bluetooth connections with noble

      with the help of @dfuerst we were able to solve this issue by rebuilding electron with a special version:

      sudo npm rebuild --runtime=electron --target=1.4.6 --disturl=https://atom.io/download/atom-shell --abi=50
      
      posted in Development
      SvenSommerS
      SvenSommer
    • RE: Toothbrush integration

      @dfuerst It worked! Thank you very much!!

      posted in Requests
      SvenSommerS
      SvenSommer
    • RE: Toothbrush integration

      I already had a look to the API provided by OralB. It’s quite disappointing.
      They will provide you with classes to develop tools for android or ios apps. Not what we are looking for right now. :wink:
      But maybe the documentation could be usefull.

      I tried to find the forum page you mentioned. Found nothing usefull yet. Maybe you can have a look and help me out here.

      I made a first attempt with noble and got some pretty nice results by reading out the braodcasted information from my brush.

      I you wanna try on your own, do the following:

      1. Install noble in a directory of your choice, by following the instructions on the noble page:
      sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev
      
      sudo ln -s /usr/bin/nodejs /usr/bin/node
      
      npm install noble
      
      1. Move into the new node_modules/noble/ - folder and create a new file ‘toothbrush.js’ with the following content
      var async = require('async');
      var noble = require('./index');
      
      var OralB_manufacturerData = 'dc00010205030000000101';
      
      
      
      
      console.log('Lookinhg for OralB Toothbrushes with manufacturerData: "' + OralB_manufacturerData +'"');
      
      noble.on('stateChange', function(state) {
        if (state === 'poweredOn') {
          noble.startScanning();
        } else {
          noble.stopScanning();
        }
      });
      
      noble.on('discover', function(peripheral) {
        var advertisement = peripheral.advertisement;
        console.log('Found device with manufacturerData: "' + advertisement.manufacturerData.toString('hex') +'" localName: ' + advertisement.localName);
        if (advertisement.manufacturerData.toString('hex') === OralB_manufacturerData) {
          noble.stopScanning();
      
          console.log('peripheral with ID ' + peripheral.id + ' found');
      
      
          var localName = advertisement.localName;
          var txPowerLevel = advertisement.txPowerLevel;
          var manufacturerData = advertisement.manufacturerData;
          var serviceData = advertisement.serviceData;
          var serviceUuids = advertisement.serviceUuids;
      
          if (localName) {
            console.log('  Local Name        = ' + localName);
          }
      
          if (txPowerLevel) {
            console.log('  TX Power Level    = ' + txPowerLevel);
          }
      
          if (manufacturerData) {
            console.log('  Manufacturer Data = ' + manufacturerData.toString('hex'));
          }
      
          if (serviceData) {
            console.log('  Service Data      = ' + serviceData);
          }
      
          if (serviceUuids) {
            console.log('  Service UUIDs     = ' + serviceUuids);
          }
      
          console.log();
      
          explore(peripheral);
        }
      });
      
      function explore(peripheral) {
        console.log('services and characteristics:');
      
        peripheral.on('disconnect', function() {
          process.exit(0);
        });
      
        peripheral.connect(function(error) {
          peripheral.discoverServices([], function(error, services) {
            var serviceIndex = 0;
      
            async.whilst(
              function () {
                return (serviceIndex < services.length);
              },
              function(callback) {
                var service = services[serviceIndex];
                var serviceInfo = service.uuid;
      
                if (service.name) {
                  serviceInfo += ' (' + service.name + ')';
                }
                console.log(serviceInfo);
      
                service.discoverCharacteristics([], function(error, characteristics) {
                  var characteristicIndex = 0;
      
                  async.whilst(
                    function () {
                      return (characteristicIndex < characteristics.length);
                    },
                    function(callback) {
                      var characteristic = characteristics[characteristicIndex];
                      var characteristicInfo = '  ' + characteristic.uuid;
      
                      if (characteristic.name) {
                        characteristicInfo += ' (' + characteristic.name + ')';
                      }
      
                      async.series([
                        function(callback) {
                          characteristic.discoverDescriptors(function(error, descriptors) {
                            async.detect(
                              descriptors,
                              function(descriptor, callback) {
                                return callback(descriptor.uuid === '2901');
                              },
                              function(userDescriptionDescriptor){
                                if (userDescriptionDescriptor) {
                                  userDescriptionDescriptor.readValue(function(error, data) {
                                    if (data) {
                                      characteristicInfo += ' (' + data.toString() + ')';
                                    }
                                    callback();
                                  });
                                } else {
                                  callback();
                                }
                              }
                            );
                          });
                        },
                        function(callback) {
                              characteristicInfo += '\n    properties  ' + characteristic.properties.join(', ');
      
                          if (characteristic.properties.indexOf('read') !== -1) {
                            characteristic.read(function(error, data) {
                              if (data) {
                                var string = data.toString('ascii');
      
                                characteristicInfo += '\n    value       ' + data.toString('hex') + ' | \'' + string + '\'';
                              }
                              callback();
                            });
                          } else {
                            callback();
                          }
                        },
                        function() {
                          console.log(characteristicInfo);
                          characteristicIndex++;
                          callback();
                        }
                      ]);
                    },
                    function(error) {
                      serviceIndex++;
                      callback();
                    }
                  );
                });
              },
              function (err) {
                peripheral.disconnect();
              }
            );
          });
        });
      }
      
      
      1. Start the script by with
      sudo node toothbrush.js
      

      Here is what I got:

      
      Lookinhg for OralB Toothbrushes with mac address:54:4a:16:21:20:9f
      peripheral with ID 544a1621209f found
        Manufacturer Data = dc00010205020000000101
        Service Data      =
        Service UUIDs     =
      
      services and characteristics:
      1800 (Generic Access)
        2a00 (Device Name)
          properties  read
          value       4f72616c2d4220546f6f74686272757368 | 'Oral-B Toothbrush'
        2a01 (Appearance)
          properties  read
          value       0000 | ''
        2a02 (Peripheral Privacy Flag)
          properties  read, write
          value       00 | ''
        2a03 (Reconnection Address)
          properties  read, write
          value       000000000000 | ''
        2a04 (Peripheral Preferred Connection Parameters)
          properties  read
          value       5000a0000000e803 | 'P h'
      1801 (Generic Attribute)
        2a05 (Service Changed)
          properties  indicate
      a0f0fff050474d5382084f72616c2d42
        a0f0fff150474d5382084f72616c2d42 (Command)
          properties  read, write, notify
          value       00 | ''
        a0f0fff250474d5382084f72616c2d42 (Data)
          properties  read, write
          value       00000000 | ''
        a0f0fff350474d5382084f72616c2d42 (Auth)
          properties  read, write
          value       00 | ''
        a0f0fff450474d5382084f72616c2d42 (Secret)
          properties  read, write
          value       00000000 | ''
      a0f0ff0050474d5382084f72616c2d42
        a0f0ff0150474d5382084f72616c2d42 (Handle ID)
          properties  read
          value       00000000 | ''
        a0f0ff0250474d5382084f72616c2d42 (Handle Type)
          properties  read
          value       02 | ''
        a0f0ff0350474d5382084f72616c2d42 (User Account)
          properties  read
          value       01 | ''
        a0f0ff0450474d5382084f72616c2d42 (Device State)
          properties  read, notify
          value       0200 | ''
        a0f0ff0550474d5382084f72616c2d42 (Battery Level)
          properties  read, notify
          value       63 | 'c'
        a0f0ff0650474d5382084f72616c2d42 (Button State)
          properties  read, notify
          value       00000000 | ''
        a0f0ff0750474d5382084f72616c2d42 (Brushing Mode)
          properties  read, notify
          value       01 | ''
        a0f0ff0850474d5382084f72616c2d42 (Brushing Time)
          properties  read, notify
          value       0000 | ''
        a0f0ff0950474d5382084f72616c2d42 (Quadrant)
          properties  read, notify
          value       00 | ''
        a0f0ff0a50474d5382084f72616c2d42 (Smiley)
          properties  read, notify
          value       00 | ''
        a0f0ff0b50474d5382084f72616c2d42 (Pressure Sensor)
          properties  read, notify
          value       00 | ''
        a0f0ff0c50474d5382084f72616c2d42 (Cache)
          properties  read, write, notify
          value        | ''
      a0f0ff2050474d5382084f72616c2d42
        a0f0ff2150474d5382084f72616c2d42 (Status)
          properties  read, write, notify
          value       8100 | ''
        a0f0ff2250474d5382084f72616c2d42 (RTC)
          properties  read, write
          value       97d81120 | 'X '
        a0f0ff2350474d5382084f72616c2d42 (Timezone)
          properties  read, write
      '   value       0d | '
        a0f0ff2450474d5382084f72616c2d42 (Brushing Timer)
          properties  read, write
          value       0f | ''
        a0f0ff2550474d5382084f72616c2d42 (Brushing Modes)
          properties  read, write
          value       0105020403000000 | ''
      PuTTY  a0f0ff2650474d5382084f72616c2d42 (Quadrant Times)
          properties  read, write
          value       1e001e001e001e000000000000000000 | ''
        a0f0ff2750474d5382084f72616c2d42 (Tongue Time)
          properties  read, write
          value       00 | ''
        a0f0ff2850474d5382084f72616c2d42 (Pressure)
          properties  read, write
          value       03 | ''
        a0f0ff2950474d5382084f72616c2d42 (Data)
          properties  read
          value       68d6fd1f7700010100000063d1e7fd1f | 'hV}wcQg}'
        a0f0ff2a50474d5382084f72616c2d42 (Flight Mode)
          properties  read, write
          value       00 | ''
      
      
      posted in Requests
      SvenSommerS
      SvenSommer
    • RE: Bluetooth connections with noble

      Hey @yawns,
      I tried to rebuild noble and bluetooth-hci-socket by:

      npm uninstall bluetooth-hci-socket 
      

      followed by

       npm install bluetooth-hci-socket 
      

      within the /home/pi/MagicMirror/modules/MMM-OralB/ - folder and also the

      npm rebuild bluetooth-hci-socket 
      

      which should to to same.

      Same for the hole noble package within the same folder.

      posted in Development
      SvenSommerS
      SvenSommer
    • Bluetooth connections with noble

      Hey guys,
      I need some advice how to get a bluetooth javascript-package running within the MM framework.

      I tried to install noble to search for a bluetooth device. As I followed the installation instruction on the linked page, I was able to get the package running in a simple test enviroment.

      Unfortunately I wasn’t able to get noble running within the MagicMirror framework.

      I tried to install it with npm and several versions of node.js (6.x and 7.x) but got always an error
      "Error: Module version mismatch. Expected 50, got 51." [node.js 7.x] or
      "Error: Module version mismatch. Expected 50, got 48." [node.js 6.x]
      within the bluetooth-hci-socket - part of noble.

      I tried rebuilding the noble included packages and tried it also with a clean Magic Mirror installation under node.js 7.x. unfortunately nothing helped.

      Starting MagicMirror: v2.1.0
      Loading config ...
      Loading module helpers ...
      No helper found for module: alert.
      No helper found for module: clock.
      WARNING! Could not load config file. Starting with default configuration. Error found: Error: Module version mismatch. Expected 50, got 51.
      Loading module helpers ...
      No helper found for module: alert.
      No helper found for module: clock.
      App threw an error during load
      Error: Module version mismatch. Expected 50, got 51.
          at Error (native)
          at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:173:20)
          at Object.Module._extensions..node (module.js:583:18)
          at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:173:20)
          at Module.load (module.js:473:32)
          at tryModuleLoad (module.js:432:12)
          at Function.Module._load (module.js:424:3)
          at Module.require (module.js:483:17)
          at require (internal/module.js:20:19)
          at Object. (/home/pi/MagicMirror/modules/MMM-OralB/node_modules/bluetooth-hci-socket/lib/native.js:3:15)
      Whoops! There was an uncaught exception...
      Error: Module version mismatch. Expected 50, got 51.
          at Error (native)
          at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:173:20)
          at Object.Module._extensions..node (module.js:583:18)
          at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:173:20)
          at Module.load (module.js:473:32)
          at tryModuleLoad (module.js:432:12)
          at Function.Module._load (module.js:424:3)
          at Module.require (module.js:483:17)
          at require (internal/module.js:20:19)
          at Object. (/home/pi/MagicMirror/modules/MMM-OralB/node_modules/bluetooth-hci-socket/lib/native.js:3:15)
      
      
      posted in Development
      SvenSommerS
      SvenSommer
    • RE: Toothbrush integration

      @dfuerst Hey, I liked your approach how to get the information about a running or a stopped toothbrush.
      So, I played some time with hcitool within the console and checked the responsive times(if the toothbrush is beeing detected as connected or not, as a turn it on or off). Unfortunately, this wasn’t very reliable nor very accurate.

      I would suggest a better approach is to use a javascript library for bluetooth such as noble to track if the toothbrush is connected or not.
      Unfortunately I wasn’t able to get noble running within the MagicMirror framework. I tried to install it with npm anbd several versions of node.js (6.x and 7.x) but got always an error like "Error: Module version mismatch. Expected 50, got 51." within the bluetooth-hci-socket - part of noble.

      Starting MagicMirror: v2.1.0
      Loading config ...
      Loading module helpers ...
      No helper found for module: alert.
      No helper found for module: clock.
      WARNING! Could not load config file. Starting with default configuration. Error found: Error: Module version mismatch. Expected 50, got 51.
      Loading module helpers ...
      No helper found for module: alert.
      No helper found for module: clock.
      App threw an error during load
      Error: Module version mismatch. Expected 50, got 51.
          at Error (native)
          at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:173:20)
          at Object.Module._extensions..node (module.js:583:18)
          at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:173:20)
          at Module.load (module.js:473:32)
          at tryModuleLoad (module.js:432:12)
          at Function.Module._load (module.js:424:3)
          at Module.require (module.js:483:17)
          at require (internal/module.js:20:19)
          at Object. (/home/pi/MagicMirror/modules/MMM-OralB/node_modules/bluetooth-hci-socket/lib/native.js:3:15)
      Whoops! There was an uncaught exception...
      Error: Module version mismatch. Expected 50, got 51.
          at Error (native)
          at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:173:20)
          at Object.Module._extensions..node (module.js:583:18)
          at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:173:20)
          at Module.load (module.js:473:32)
          at tryModuleLoad (module.js:432:12)
          at Function.Module._load (module.js:424:3)
          at Module.require (module.js:483:17)
          at require (internal/module.js:20:19)
          at Object. (/home/pi/MagicMirror/modules/MMM-OralB/node_modules/bluetooth-hci-socket/lib/native.js:3:15)
      
      

      I tried rebuilding the noble included packeages and tried it also with a clean Magicmirror installation under node.js 7.x. unfortunately nothing helped.

      posted in Requests
      SvenSommerS
      SvenSommer
    • RE: MMM-Globe

      @lolobyte
      Thank you for the links.
      For central america I found the following source the most usefull. Unfortunately it’s only available in high resulution.
      http://goes.gsfc.nasa.gov/goescolor/goeseast/overview2/color_lrg/latestfull.jpg
      alt text

      Has anybody found more usefull sources by now?

      posted in Utilities
      SvenSommerS
      SvenSommer
    • 1 / 1