Tinkerforge.BrickletHumidity.CALLBACK_HUMIDITY
This commit is contained in:
parent
b6ac276024
commit
e843318039
@ -26,6 +26,7 @@ function connect(item) {
|
|||||||
|
|
||||||
var ipcon = new Tinkerforge.IPConnection(); // Create IP connection
|
var ipcon = new Tinkerforge.IPConnection(); // Create IP connection
|
||||||
var t = new Tinkerforge.BrickletTemperature(UID, ipcon); // Create device object
|
var t = new Tinkerforge.BrickletTemperature(UID, ipcon); // Create device object
|
||||||
|
var h = new Tinkerforge.BrickletHumidity(UID, ipcon); // Create device object
|
||||||
|
|
||||||
var counter = 0;
|
var counter = 0;
|
||||||
var readyForNextNotification = true;
|
var readyForNextNotification = true;
|
||||||
@ -68,6 +69,15 @@ function connect(item) {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Register humidity callback
|
||||||
|
h.on(Tinkerforge.BrickletHumidity.CALLBACK_HUMIDITY,
|
||||||
|
// Callback function for humidity callback (parameter has unit %RH/10)
|
||||||
|
function (humidity) {
|
||||||
|
saveValue((humidity/10.0), item);
|
||||||
|
//Log.log('Humidity: ' + humidity/10.0 + ' ' + item.on.new.value.category);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
process.on( 'SIGINT', function() {
|
process.on( 'SIGINT', function() {
|
||||||
Log.log( "Gracefully disconnect " + HOST );
|
Log.log( "Gracefully disconnect " + HOST );
|
||||||
ipcon.disconnect();
|
ipcon.disconnect();
|
||||||
|
|||||||
@ -5,19 +5,38 @@
|
|||||||
"port": 4223,
|
"port": 4223,
|
||||||
"uid": "8j1",
|
"uid": "8j1",
|
||||||
"callback": {
|
"callback": {
|
||||||
"period": 6000
|
"period": 60000
|
||||||
},
|
},
|
||||||
"on": {
|
"on": {
|
||||||
"new": {
|
"new": {
|
||||||
"value": {
|
"value": {
|
||||||
"type": "web",
|
"type": "web",
|
||||||
"host": "hobu",
|
"host": "localhost",
|
||||||
"port": "2999",
|
"port": "2999",
|
||||||
"category": "TEMPERATURE",
|
"category": "TEMPERATURE",
|
||||||
"room": 1
|
"room": 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"host": "192.168.2.126",
|
||||||
|
"port": 4223,
|
||||||
|
"uid": "xCt",
|
||||||
|
"callback": {
|
||||||
|
"period": 60000
|
||||||
|
},
|
||||||
|
"on": {
|
||||||
|
"new": {
|
||||||
|
"value": {
|
||||||
|
"type": "web",
|
||||||
|
"host": "localhost",
|
||||||
|
"port": "2999",
|
||||||
|
"category": "%RH",
|
||||||
|
"room": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user