http call
This commit is contained in:
parent
4e07942408
commit
89d0b8a645
@ -1,5 +1,6 @@
|
|||||||
var Tinkerforge = require('../tinkerforge')
|
var Tinkerforge = require('../tinkerforge')
|
||||||
, Conf = require('./config.json');
|
, Conf = require('./config.json')
|
||||||
|
, http = require('http');
|
||||||
|
|
||||||
var HOST = Conf.host;
|
var HOST = Conf.host;
|
||||||
var PORT = Conf.port;
|
var PORT = Conf.port;
|
||||||
@ -50,7 +51,7 @@ ai.on(Tinkerforge.BrickletAnalogInV2.CALLBACK_VOLTAGE,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(radicalChange) {
|
if(radicalChange) {
|
||||||
console.log('Hat sich gelohnt!');
|
doHoBuDoorBellCall();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -62,3 +63,29 @@ process.stdin.on('data',
|
|||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/* private */
|
||||||
|
function doHoBuDoorBellCall() {
|
||||||
|
var options = {
|
||||||
|
host: Conf.on.ring.host,
|
||||||
|
port: Conf.on.ring.port,
|
||||||
|
path: Conf.on.ring.path
|
||||||
|
};
|
||||||
|
|
||||||
|
callback = function(response) {
|
||||||
|
var str = '';
|
||||||
|
|
||||||
|
//another chunk of data has been recieved, so append it to `str`
|
||||||
|
response.on('data', function (chunk) {
|
||||||
|
str += chunk;
|
||||||
|
});
|
||||||
|
|
||||||
|
//the whole response has been recieved, so we just print it out here
|
||||||
|
response.on('end', function () {
|
||||||
|
console.log(str);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
http.request(options, callback).end();
|
||||||
|
}
|
||||||
@ -1,5 +1,12 @@
|
|||||||
{
|
{
|
||||||
"host": "192.168.2.122",
|
"host": "192.168.2.122",
|
||||||
"port": 4223,
|
"port": 4223,
|
||||||
"uid": "vhb"
|
"uid": "vhb",
|
||||||
|
"on": {
|
||||||
|
"ring": {
|
||||||
|
"host": "hobu",
|
||||||
|
"port": "2999",
|
||||||
|
"path": "/doorbell/ring/haustuer/"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user