modified to use events, hopefully will fix the crashing particle
This commit is contained in:
parent
b088fb3332
commit
b3477fb9f9
@ -123,10 +123,26 @@ router.post('/', function (req, res, next) {
|
|||||||
|
|
||||||
var t = req.body;
|
var t = req.body;
|
||||||
var now = new Date();
|
var now = new Date();
|
||||||
|
var dataJSON={};
|
||||||
console.log('~~~~');
|
console.log('~~~~');
|
||||||
|
if(t.hasOwnProperty(data)){
|
||||||
|
var data = t.data;
|
||||||
|
dataJSON = JSON.parse(data);
|
||||||
|
if(t.hasOwnProperty(temp)) {
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logger.error('No temp data!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logger.error('No data block!');
|
||||||
|
}
|
||||||
console.log(JSON.stringify(t));
|
console.log(JSON.stringify(t));
|
||||||
if (t != {} && t.temp != null) {
|
if (dataJSON != {} && dataJSON.temp != null) {
|
||||||
busEmitter.emit("saveTempData", {time: now.toJSON(), value: parseFloat(t.temp)});
|
busEmitter.emit("saveTempData", {time: now.toJSON(), value: parseFloat(dataJSON.temp)});
|
||||||
}
|
}
|
||||||
|
|
||||||
res.writeHead(200, {"ContentType": "text/html"});
|
res.writeHead(200, {"ContentType": "text/html"});
|
||||||
|
Loading…
Reference in New Issue
Block a user