From e843318039346fb63502f8386e9c5c4b098d86a0 Mon Sep 17 00:00:00 2001 From: Gerrit Linnemann Date: Sun, 21 Aug 2016 13:42:49 +0200 Subject: [PATCH] Tinkerforge.BrickletHumidity.CALLBACK_HUMIDITY --- hobu_value_picker/app.js | 10 ++++++++++ hobu_value_picker/config.json | 23 +++++++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/hobu_value_picker/app.js b/hobu_value_picker/app.js index 65ad4b9..96be1c9 100644 --- a/hobu_value_picker/app.js +++ b/hobu_value_picker/app.js @@ -26,6 +26,7 @@ function connect(item) { var ipcon = new Tinkerforge.IPConnection(); // Create IP connection var t = new Tinkerforge.BrickletTemperature(UID, ipcon); // Create device object + var h = new Tinkerforge.BrickletHumidity(UID, ipcon); // Create device object var counter = 0; 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() { Log.log( "Gracefully disconnect " + HOST ); ipcon.disconnect(); diff --git a/hobu_value_picker/config.json b/hobu_value_picker/config.json index e5e48f6..c94c7da 100644 --- a/hobu_value_picker/config.json +++ b/hobu_value_picker/config.json @@ -5,19 +5,38 @@ "port": 4223, "uid": "8j1", "callback": { - "period": 6000 + "period": 60000 }, "on": { "new": { "value": { "type": "web", - "host": "hobu", + "host": "localhost", "port": "2999", "category": "TEMPERATURE", "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 + } + } + } } ] }