rfcontroljs
Advanced tools
Comparing version 0.0.13 to 0.0.14
@@ -6,3 +6,3 @@ var doesProtocolMatch, helper, protocols, sortIndices, | ||
protocols = ['weather1', 'weather2', 'weather3', 'switch1', 'switch2', 'switch3', 'switch4', "switch5", 'pir1', 'contact1', 'generic']; | ||
protocols = ['weather1', 'weather2', 'weather3', 'weather4', 'switch1', 'switch2', 'switch3', 'switch4', "switch5", 'pir1', 'contact1', 'generic']; | ||
@@ -9,0 +9,0 @@ protocols = protocols.map((function(_this) { |
@@ -54,2 +54,5 @@ module.exports = function(helper) { | ||
})()); | ||
if (all) { | ||
state = !state; | ||
} | ||
return result = { | ||
@@ -63,18 +66,24 @@ id: id, | ||
encodeMessage: function(message) { | ||
var id, inverseState, unitCode; | ||
var id, inverseState, state, unitCode; | ||
id = helper.map(helper.numberToBinary(message.id, 20), binaryToPulse); | ||
unitCode = ((function() { | ||
switch (message.unit) { | ||
case 1: | ||
return 0; | ||
case 2: | ||
return 1; | ||
case 3: | ||
return 2; | ||
case 4: | ||
return 4; | ||
} | ||
})()); | ||
if (message.all) { | ||
unitCode = (message.state ? 6 : 7); | ||
state = !message.state; | ||
} else { | ||
unitCode = ((function() { | ||
switch (message.unit) { | ||
case 1: | ||
return 0; | ||
case 2: | ||
return 1; | ||
case 3: | ||
return 2; | ||
case 4: | ||
return 4; | ||
} | ||
})()); | ||
state = message.state; | ||
} | ||
unitCode = helper.map(helper.numberToBinary(unitCode, 3), binaryToPulse); | ||
inverseState = (message.state ? binaryToPulse['0'] : binaryToPulse['1']); | ||
inverseState = (state ? binaryToPulse['0'] : binaryToPulse['1']); | ||
return "" + id + unitCode + inverseState + "02"; | ||
@@ -81,0 +90,0 @@ } |
{ | ||
"name": "rfcontroljs", | ||
"version": "0.0.13", | ||
"version": "0.0.14", | ||
"description": "Protocol support for different 433mhz switches and weather stations for the RFControl Arduino library", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
80540
21
847