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