rfcontroljs
Advanced tools
Comparing version 0.0.23 to 0.0.24
@@ -6,3 +6,3 @@ var doesProtocolMatch, helper, protocols, sortIndices, | ||
protocols = ['weather1', 'weather2', 'weather3', 'weather4', 'weather5', 'weather6', 'switch1', 'switch2', 'switch3', 'switch4', 'switch5', 'switch6', 'switch7', 'switch8', 'switch9', 'rolling1', 'dimmer1', 'pir1', 'pir2', 'contact1', 'contact2', 'generic']; | ||
protocols = ['weather1', 'weather2', 'weather3', 'weather4', 'weather5', 'weather6', 'weather7', 'switch1', 'switch2', 'switch3', 'switch4', 'switch5', 'switch6', 'switch7', 'switch8', 'switch9', 'switch10', 'switch11', 'switch12', 'rolling1', 'dimmer1', 'pir1', 'pir2', 'pir3', 'contact1', 'contact2', 'generic', 'alarm1', 'led1']; | ||
@@ -9,0 +9,0 @@ protocols = protocols.map((function(_this) { |
@@ -35,3 +35,3 @@ module.exports = function(helper) { | ||
unitCode: helper.binaryToNumber(binary, 5, 9), | ||
state: helper.binaryToBoolean(binary, 10) | ||
state: !helper.binaryToBoolean(binary, 11) | ||
}; | ||
@@ -38,0 +38,0 @@ }, |
@@ -27,3 +27,3 @@ module.exports = function(helper) { | ||
brands: ["Cogex", "KlikAanKlikUit", "Intertechno", "Düwi Terminal"], | ||
pulseLengths: [295, 1180, 11210], | ||
pulseLengths: [306, 957, 9808], | ||
pulseCount: 50, | ||
@@ -30,0 +30,0 @@ decodePulses: function(pulses) { |
@@ -24,4 +24,4 @@ module.exports = function(helper) { | ||
}, | ||
battery: { | ||
type: "number" | ||
lowBattery: { | ||
type: "boolean" | ||
} | ||
@@ -33,10 +33,5 @@ }, | ||
decodePulses: function(pulses) { | ||
var battery, binary, result; | ||
var binary, lowBattery, result; | ||
binary = helper.map(pulses, pulsesToBinaryMapping); | ||
battery = helper.binaryToNumber(binary, 12, 12); | ||
if (battery === 1) { | ||
battery = "Good"; | ||
} else { | ||
battery = "Bad"; | ||
} | ||
lowBattery = !helper.binaryToBoolean(binary, 12); | ||
return result = { | ||
@@ -47,3 +42,3 @@ id: helper.binaryToNumber(binary, 4, 11), | ||
humidity: helper.binaryToNumber(binary, 28, 35), | ||
battery: battery | ||
lowBattery: lowBattery | ||
}; | ||
@@ -50,0 +45,0 @@ } |
@@ -35,2 +35,5 @@ module.exports = function(helper) { | ||
type: "number" | ||
}, | ||
lowBattery: { | ||
type: "boolean" | ||
} | ||
@@ -42,12 +45,7 @@ }, | ||
decodePulses: function(pulses) { | ||
var avgAirspeed, battery, binary, h0, h1, humidity, id, rain, result, states, substate, temperature, windDirection, windGust; | ||
var avgAirspeed, binary, h0, h1, humidity, id, lowBattery, rain, result, states, substate, temperature, windDirection, windGust; | ||
binary = helper.map(pulses, pulsesToBinaryMapping); | ||
states = helper.binaryToNumberLSBMSB(binary, 9, 10); | ||
id = helper.binaryToNumberLSBMSB(binary, 0, 7); | ||
battery = helper.binaryToNumberLSBMSB(binary, 8, 8); | ||
if (battery === 0) { | ||
battery = 'Good'; | ||
} else { | ||
battery = 'Bad'; | ||
} | ||
lowBattery = helper.binaryToNumberLSBMSB(binary, 8, 8) !== 0; | ||
if (states === 0 || states === 1 || states === 2) { | ||
@@ -93,3 +91,3 @@ temperature = helper.binaryToSignedNumberLSBMSB(binary, 12, 23) / 10.0; | ||
id: id, | ||
battery: battery | ||
lowBattery: lowBattery | ||
}; | ||
@@ -96,0 +94,0 @@ } |
@@ -24,4 +24,4 @@ module.exports = function(helper) { | ||
}, | ||
battery: { | ||
type: "string" | ||
lowBattery: { | ||
type: "boolean" | ||
} | ||
@@ -42,10 +42,5 @@ }, | ||
*/ | ||
var battery, binary, result; | ||
var binary, lowBattery, result; | ||
binary = helper.map(pulses, pulsesToBinaryMapping); | ||
battery = helper.binaryToNumber(binary, 37, 37); | ||
if (battery === 1) { | ||
battery = "Good"; | ||
} else { | ||
battery = "Bad"; | ||
} | ||
lowBattery = helper.binaryToNumber(binary, 37, 37) !== 1; | ||
return result = { | ||
@@ -56,3 +51,3 @@ id: helper.binaryToNumber(binary, 0, 7), | ||
humidity: helper.binaryToNumber(binary, 24, 30), | ||
battery: battery | ||
lowBattery: lowBattery | ||
}; | ||
@@ -59,0 +54,0 @@ } |
{ | ||
"name": "rfcontroljs", | ||
"version": "0.0.23", | ||
"version": "0.0.24", | ||
"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
134499
39
2362