Comparing version 0.0.3 to 0.0.4
@@ -12,16 +12,24 @@ var Heatmiser = require("./lib/heatmiser"); | ||
hm.read_device(); | ||
// hm.read_device(); | ||
var dcb; | ||
// var dcb; | ||
// set frost mode | ||
// set temperature | ||
dcb = { | ||
runmode: 'frost' | ||
heating: { | ||
target: 20.5 | ||
} | ||
} | ||
hm.write_device(dcb); | ||
// set current date and time | ||
dcb = { | ||
time: new Date() | ||
} | ||
hm.write_device(dcb); | ||
// // set frost mode | ||
// dcb = { | ||
// runmode: 'frost' | ||
// } | ||
// hm.write_device(dcb); | ||
// // set current date and time | ||
// dcb = { | ||
// time: new Date() | ||
// } | ||
// hm.write_device(dcb); |
@@ -132,3 +132,3 @@ var net = require('net'); | ||
callback(obj); | ||
} | ||
} | ||
client.end(); | ||
@@ -165,6 +165,14 @@ }.bind(this)); | ||
this.read_device(function(){ | ||
status_to_dcb(this.model, data, do_write); | ||
try { | ||
status_to_dcb(this.model, data, do_write); | ||
} catch (e) { | ||
this.emit('error', e); | ||
} | ||
}); | ||
} else { | ||
status_to_dcb(this.model, data, do_write); | ||
try { | ||
status_to_dcb(this.model, data, do_write); | ||
} catch (e) { | ||
this.emit('error', e); | ||
} | ||
} | ||
@@ -175,7 +183,13 @@ } | ||
var l = (typeof data === 'number') ? 1 : data.length | ||
var buf = new Buffer(2+1+l); // position, length , data | ||
var buf = new Buffer(2+1+l); // position, length, data | ||
buf.writeUInt16LE(position, 0); | ||
buf.writeUInt8(l, 2); | ||
if(typeof data === 'number') { | ||
buf.writeUInt8(data, 3); | ||
if (data % 1 == 0) { | ||
// integer | ||
buf.writeUInt8(data, 3); | ||
} else { | ||
// float, wrong type | ||
throw "Float value not valid, must be integer: " + data; | ||
} | ||
} | ||
@@ -297,4 +311,3 @@ else { | ||
if (days != days_expected) { | ||
this.emit('error', "Incorrect number of days specified for comfort levels program " + days + ". Expected " + days_expected); | ||
return; | ||
throw "Incorrect number of days specified for comfort levels program " + days + ". Expected " + days_expected; | ||
} | ||
@@ -323,4 +336,3 @@ for (var day=0;day<days;day++) { | ||
if (days != days_expected) { | ||
this.emit('error', "Incorrect number of days specified for hot water control program " + days + ". Expected " + days_expected); | ||
return; | ||
throw "Incorrect number of days specified for hot water control program " + days + ". Expected " + days_expected; | ||
} | ||
@@ -348,4 +360,3 @@ for (var day=0;day<days;day++) { | ||
// Feature 12 (16): $status->{config}->{progmode} | ||
this.emit('error', "Unsupported item for writing: " + key); | ||
return; | ||
throw "Unsupported item for writing: " + key; | ||
} | ||
@@ -352,0 +363,0 @@ } |
{ | ||
"name": "heatmiser", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "A node.js app that talks to heatmiser wifi thermostats", | ||
@@ -5,0 +5,0 @@ "main": "lib/heatmiser.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18400
474