Platform: Raspberry Pi 3
Node Version: v7.4.0
MagicMirror Version: v2.1.0
Description: For bluetooth integration I would like to add noble to a MM²-module. Whith this package I was able to interact with bluetooth devices when I ran nodejs-scripts without the MM²-framework. When I try to integrate it within the node_helper.js. I’m not able to initialise the blueetoh device.
This is simply done by
var noble = require('noble');
noble.on('stateChange', function(state) {
if (state === 'poweredOn') {
noble.startScanning([], true);
console.log('scanning started...');
}
else {
noble.stopScanning();
console.log('scanning stopped.');
}
});
Within node_helper
there is now response, no error message. Just nothing happens.
If I run a script in the same folder, outside of MM²-Framework with
sudo node testscript.js
everytthing is working fine.
Steps to Reproduce:
- To test the working testscript:
- Enter your module-directory:
cd ~/MagicMirror/modules
- Clone repository :
git clone https://github.com/SvenSommer/MMM-OralB
- Enter new directory:
cd ~/MagicMirror/modules/MMM-OralB
- Install dependencies:
sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev
- Install noble module:
npm install noble
- Exceute testscript:
sudo node testscript.js
- This should lead to a output like
scanning was started. Everything is working fine.
- To test the node_helper:
- Excute first five steps from above.
- For compatibility reasons run:
cd ~/MagicMirror/modules/MMM-OralB
sudo npm rebuild --runtime=electron --target=1.4.6 --disturl=https://atom.io/download/atom-shell --abi=50
- Integrate module in config-file
{
module: 'MMM-OralB',
position: 'bottom_left',
},
- Start MM², so the module gets loaded.
Expected Results: Same console output: scanning was started. Everything is working fine.
Actual Results: Nothing no output. No error. Pure deadly silence. :)
Configuration: Here the config.js:
var config = {
port: 8080,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1","::ffff:192.168.188.22"],
language: 'de',
timeFormat: 24,
units: 'metric',
modules: [
{
module: 'alert',
},
{
module: 'clock',
position: 'center'
},
{
module: 'MMM-OralB',
position: 'bottom_left',
},
]
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== 'undefined') {module.exports = config;}
Additional Notes: Next to noble is a module to provide advertising Ble-Services its called bleno (from the same developer). This was successfully integrated in an module by @aschulz90. I tried to adapt to his code to find an error in my code. But this wasn’t helping either.
https://github.com/aschulz90/ble_app_interface