mirror of
https://github.com/mysensors/MySensors.git
synced 2026-03-10 01:57:00 +01:00
minimal adjustment to the dallas temperature sensor as an example added scripts to drop the database and to set a reboot manually for debugging purposes
29 lines
1.1 KiB
JavaScript
29 lines
1.1 KiB
JavaScript
var NodeIdToReboot = 1;
|
|
|
|
const dbAddress = '127.0.0.1';
|
|
const dbPort = 27017;
|
|
const dbName = 'MySensorsDb';
|
|
|
|
var dbc = require('mongodb').MongoClient;
|
|
dbc.connect('mongodb://' + dbAddress + ':' + dbPort + '/' + dbName, function(err, db) {
|
|
if (err) {
|
|
console.log('Error connecting to database at mongodb://' + dbAddress + ':' + dbPort + '/' + dbName);
|
|
} else {
|
|
db.collection('node', function(err, c) {
|
|
c.update({
|
|
'id': NodeIdToReboot
|
|
}, {
|
|
$set: {
|
|
'reboot': 1
|
|
}
|
|
}, function(err, result) {
|
|
if (err)
|
|
console.log("Error writing reboot request to database");
|
|
else
|
|
console.log("Reboot request saved to database");
|
|
});
|
|
});
|
|
}
|
|
});
|
|
|