removed CTDO-API

This commit is contained in:
Lucas Pleß 2022-09-04 12:51:05 +02:00
parent f6610cf7a2
commit 782d4a1a35
2 changed files with 0 additions and 38 deletions

View File

@ -1,22 +0,0 @@
var util = require('util');
var EventEmitter = require('events').EventEmitter;
var request = require('request');
var CTDOApi= function(url) {
var self = this;
this.poll = function() {
request({url: "https://" + url}, function(error, res, response) {
if (error) {
self.emit('failed', error)
} else {
var parsedResponse = JSON.parse(response);
self.emit('done', parsedResponse);
}
});
};
};
util.inherits(CTDOApi, EventEmitter);
module.exports = CTDOApi;

View File

@ -8,7 +8,6 @@ var cookieSession = require('cookie-session');
var flash = require('connect-flash');
var Flukso = require("./flukso");
var IpPoll = require("./ip-poll");
var CTDOApi = require("./ctdo-api");
var routes = require("./routes");
var path = require('path');
var mqttClient = require('mqtt');
@ -74,7 +73,6 @@ var usercountanswer = {
};
var ippoll = new IpPoll("rpi3.raum.ctdo.de");
var ctdoapi = new CTDOApi("api.ctdo.de/names.php");
var flukso = new Flukso("flukso.raum.ctdo.de", "/sensor/cf00e0b22230f4a8870af58f2b8719dd");
var mqtt = mqttClient.connect('mqtt://raum.ctdo.de');
var connected = false;
@ -82,19 +80,6 @@ var connected = false;
var port = '9911';
var address = 'localhost';
ctdoapi.on('done', function (answer) {
simpleanswer.count = answer.count;
simpleanswer.names = answer.names;
spaceanswer.sensors.people_now_present[0].value = answer.count;
spaceanswer.sensors.people_now_present[0].names = answer.names;
if (usercountanswer.datapoints.length > 20) {
usercountanswer.datapoints.shift();
}
usercountanswer.datapoints.push({at: new Date().getTime(), value: simpleanswer.count});
});
ippoll.on('doneState', function (state) {
spaceanswer.state.open = state;
@ -131,7 +116,6 @@ function sendSimple() {
}
function work() {
ctdoapi.poll();
ippoll.pollState();
sendSimple();
}