From 5837586d4e085c774d36402447cb456a742b5d82 Mon Sep 17 00:00:00 2001 From: peterahlstrom Date: Tue, 26 Jan 2021 20:15:16 +0100 Subject: [PATCH 1/2] Added getSensorHistory, implementation for /sensor/history --- telldus-live.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/telldus-live.js b/telldus-live.js index 89eee5d..272b587 100644 --- a/telldus-live.js +++ b/telldus-live.js @@ -72,6 +72,10 @@ TelldusAPI.prototype.getSensorInfo = function(sensor, callback) { return this.roundtrip('GET', '/sensor/info?' + querystring.stringify( { id : sensor.id }), callback); }; +TelldusAPI.prototype.getSensorHistory = function(sensor, callback) { + return this.roundtrip('GET', '/sensor/history?' + querystring.stringify( { id : sensor.id }), callback); +}; + TelldusAPI.prototype.setSensorName = function(sensor, name, callback) { return this.roundtrip('PUT', '/sensor/setName?' + querystring.stringify( { id : sensor.id , name : name }), callback); From f692770333608c0cfbc0a012978de993045d80ec Mon Sep 17 00:00:00 2001 From: peterahlstrom Date: Fri, 19 Feb 2021 10:12:05 +0100 Subject: [PATCH 2/2] getSensorHistory: Added optional parameters for querying period in time. --- telldus-live.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/telldus-live.js b/telldus-live.js index 272b587..1f1fe29 100644 --- a/telldus-live.js +++ b/telldus-live.js @@ -72,8 +72,8 @@ TelldusAPI.prototype.getSensorInfo = function(sensor, callback) { return this.roundtrip('GET', '/sensor/info?' + querystring.stringify( { id : sensor.id }), callback); }; -TelldusAPI.prototype.getSensorHistory = function(sensor, callback) { - return this.roundtrip('GET', '/sensor/history?' + querystring.stringify( { id : sensor.id }), callback); +TelldusAPI.prototype.getSensorHistory = function(sensor, from=null, to=null, callback) { + return this.roundtrip('GET', '/sensor/history?' + querystring.stringify( { id : sensor.id, from: from, to: to }) + "&includeHumanReadableDate=1", callback); }; TelldusAPI.prototype.setSensorName = function(sensor, name, callback) {