smart-bus-mrgadget
Advanced tools
Comparing version 0.5.2 to 0.5.3
@@ -971,12 +971,106 @@ var word = { | ||
// 10.1.3 Control AC Status | ||
// 0x193A | ||
// 10.1.3 Control AC Status. Type New. | ||
//Documetation is wrong. | ||
0x193A: { | ||
parse: function(buffer) { | ||
return { | ||
acstatus: Boolean(buffer.readUInt8(8)), //Status. 1 on. 0 off. | ||
acno: buffer.readUInt8(0), //AC No. | ||
setupmode: buffer.readUInt8(9),//0 cooling. 1 heating. 2 fan. 3 auto. 4 dry | ||
setupspeed: buffer.readUInt8(10),//Fan Speed. 0 Auto. 1 High. 2 Medium. 3 Low. | ||
temperature: { | ||
type: buffer.readUInt8(1),//Type. 0 celsius. 1 farenheit | ||
now: buffer.readUInt8(2),//DLP Temprature | ||
cooling: buffer.readUInt8(3),//Cooling Temprature | ||
heating: buffer.readUInt8(4),//Heating Temprature | ||
auto: buffer.readUInt8(5),//Auto Temprature | ||
dry: buffer.readUInt8(6)//Dry Temprature | ||
}, | ||
modeandfan: buffer.readUInt8(7),//Mode and Fan always 48 | ||
currentmode: buffer.readUInt8(11),//Current Mode Temprature | ||
sweep: buffer.readUInt8(12)//Sweep? | ||
}; | ||
}, | ||
encode: function(data) { | ||
var buffer = new Buffer(13); | ||
var temperature = data.temperature; | ||
buffer.writeUInt8(data.acstatus, 8); | ||
buffer.writeUInt8(data.acno, 0); | ||
buffer.writeUInt8(data.setupmode, 9); | ||
buffer.writeUInt8(data.setupspeed, 10); | ||
buffer.writeUInt8(temperature.type, 1); | ||
buffer.writeUInt8(temperature.now, 2); | ||
buffer.writeUInt8(temperature.cooling, 3); | ||
buffer.writeUInt8(temperature.heating, 4); | ||
buffer.writeUInt8(temperature.auto, 5); | ||
buffer.writeUInt8(temperature.dry, 6); | ||
buffer.writeUInt8(data.modeandfan, 7); | ||
buffer.writeUInt8(data.currentmode, 11); | ||
buffer.writeUInt8(data.sweep, 12); | ||
return buffer; | ||
} | ||
}, | ||
// 10.1.4 Response Control AC Status | ||
// 0x193B | ||
0x193B: { | ||
parse: function(buffer) { | ||
return { | ||
acstatus: Boolean(buffer.readUInt8(8)), //Status. 1 on. 0 off. | ||
acno: buffer.readUInt8(0), //AC No. | ||
setupmode: buffer.readUInt8(9),//0 cooling. 1 heating. 2 fan. 3 auto. 4 dry | ||
setupspeed: buffer.readUInt8(10),//Fan Speed. 0 Auto. 1 High. 2 Medium. 3 Low. | ||
temperature: { | ||
type: buffer.readUInt8(1),//Type. 0 celsius. 1 farenheit | ||
now: buffer.readUInt8(2),//DLP Temprature | ||
cooling: buffer.readUInt8(3),//Cooling Temprature | ||
heating: buffer.readUInt8(4),//Heating Temprature | ||
auto: buffer.readUInt8(5),//Auto Temprature | ||
dry: buffer.readUInt8(6)//Dry Temprature | ||
}, | ||
modeandfan: buffer.readUInt8(7),//Mode and Fan always 48 | ||
currentmode: buffer.readUInt8(11),//Current Mode Temprature | ||
sweep: buffer.readUInt8(12)//Sweep? | ||
}; | ||
}, | ||
encode: function(data) { | ||
var buffer = new Buffer(13); | ||
var temperature = data.temperature; | ||
buffer.writeUInt8(data.acstatus, 8); | ||
buffer.writeUInt8(data.acno, 0); | ||
buffer.writeUInt8(data.setupmode, 9); | ||
buffer.writeUInt8(data.setupspeed, 10); | ||
buffer.writeUInt8(temperature.type, 1); | ||
buffer.writeUInt8(temperature.now, 2); | ||
buffer.writeUInt8(temperature.cooling, 3); | ||
buffer.writeUInt8(temperature.heating, 4); | ||
buffer.writeUInt8(temperature.auto, 5); | ||
buffer.writeUInt8(temperature.dry, 6); | ||
buffer.writeUInt8(data.modeandfan, 7); | ||
buffer.writeUInt8(data.currentmode, 11); | ||
buffer.writeUInt8(data.sweep, 12); | ||
return buffer; | ||
} | ||
}, | ||
/* 11.1 Floor Heating Control from DLP */ | ||
// 11.1.1 Read Floor Heating Status | ||
0x1944: { | ||
0x1944: { | ||
parse: function(buffer) { | ||
return null; | ||
}, | ||
encode: function(data) { | ||
return new Buffer([]); | ||
}, | ||
response: 0x1945 | ||
@@ -1338,3 +1432,10 @@ }, | ||
// 12.2.1 Read Sensors Status | ||
0x1645: { | ||
0x1645: { | ||
parse: function(buffer) { | ||
return null; | ||
}, | ||
encode: function(data) { | ||
return new Buffer([]); | ||
}, | ||
response: 0x1646 | ||
@@ -1456,13 +1557,14 @@ }, | ||
brightness: word.parse(buffer, 2), | ||
air: buffer.readUInt8(4), | ||
gas: buffer.readUInt8(5), | ||
movement: Boolean(buffer.readUInt8(6)), | ||
humidity: buffer.readUInt8(4), | ||
air: buffer.readUInt8(5), | ||
gas: buffer.readUInt8(6), | ||
movement: Boolean(buffer.readUInt8(7)), | ||
dryContacts: [] | ||
}; | ||
var offset = 7; | ||
var offset = 8; | ||
var length = buffer.length; | ||
var contacts = data.dryContacts; | ||
while (offset < 9 && offset < length) contacts[contacts.length] = { | ||
while (offset < 10 && offset < length) contacts[contacts.length] = { | ||
number: contacts.length + 1, | ||
@@ -1476,3 +1578,3 @@ status: Boolean(buffer.readUInt8(offset++)) | ||
encode: function(data) { | ||
var buffer = new Buffer(9); | ||
var buffer = new Buffer(10); | ||
var contacts = data.dryContacts || []; | ||
@@ -1483,8 +1585,9 @@ | ||
word.encode(buffer, data.brightness, 2); | ||
buffer.writeUInt8(data.air, 4); | ||
buffer.writeUInt8(data.gas, 5); | ||
buffer.writeUInt8(data.movement, 6); | ||
buffer.writeUInt8(data.humidity, 4); | ||
buffer.writeUInt8(data.air, 5); | ||
buffer.writeUInt8(data.gas, 6); | ||
buffer.writeUInt8(data.movement, 7); | ||
for (var i = 0; i < contacts.length; i++) | ||
buffer.writeUInt8(contacts[i].status ? 1 : 0, i + 7); | ||
buffer.writeUInt8(contacts[i].status ? 1 : 0, i + 8); | ||
@@ -1491,0 +1594,0 @@ return buffer; |
{ | ||
"name": "smart-bus-mrgadget", | ||
"version": "0.5.2", | ||
"version": "0.5.3", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Node.js implementation of HDL SmartBus protocol [Fork of smart-bus]", |
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
106558
3162