mirror of
https://gitlab.silvrtree.co.uk/martind2000/censis-archive.git
synced 2025-01-26 20:26:17 +00:00
”2016-08-10”
This commit is contained in:
parent
7a0f3327a6
commit
f737878c1e
@ -35,8 +35,10 @@ function insertEntry(obj) {
|
||||
|
||||
var newObj = dataBuilder(obj);
|
||||
|
||||
newObj.rtype = 1;
|
||||
|
||||
logger.debug('Inserting into couch...');
|
||||
logger.info(util.inspect(newObj));
|
||||
// logger.info(util.inspect(newObj));
|
||||
dbCouch.insert(newObj, function(err, body, header) {
|
||||
if (err) {
|
||||
logger.error('Error inserting into couch');
|
||||
@ -49,9 +51,7 @@ function insertEntry(obj) {
|
||||
var doInsertEntry = (obj) => {
|
||||
// Logger.info('sendSocket: ' + JSON.stringify(obj));
|
||||
|
||||
var _rawObj = obj;
|
||||
_rawObj.type = 1;
|
||||
insertEntry(_rawObj);
|
||||
insertEntry(obj);
|
||||
|
||||
dbSave.addNewEvent(obj)
|
||||
.then(function(d) {
|
||||
@ -122,7 +122,7 @@ var mqttClient = function() {
|
||||
var json = JSON.parse(message.toString());
|
||||
|
||||
json.topic = topic;
|
||||
logger.debug(JSON.stringify(json));
|
||||
// logger.debug(JSON.stringify(json));
|
||||
|
||||
busEmitter.emit('saveData', json);
|
||||
|
||||
|
@ -9,7 +9,7 @@ module.exports = function(db) {
|
||||
|
||||
module.sqlInsertRawEvent = function(data) {
|
||||
let _data = data;
|
||||
|
||||
console.log('sqlInsertRawEvent');
|
||||
return new Promise(function(resolve, reject) {
|
||||
db.func('insert_raw',
|
||||
[_data.timestamp, _data.event])
|
||||
@ -25,7 +25,7 @@ module.exports = function(db) {
|
||||
module.sqlInsertDecoded = function(data) {
|
||||
let _data = data;
|
||||
|
||||
console.log('sqlInsertDecoded', data);
|
||||
console.log('sqlInsertDecoded', _data.deviceid, _data.timestamp);
|
||||
return new Promise(function(resolve, reject) {
|
||||
db.func('insert_decoded',
|
||||
[_data.deviceid, _data.timestamp, _data.lux, _data.co2, _data.temp, _data.humidity, _data.sound])
|
||||
|
Loading…
Reference in New Issue
Block a user