@Partovic
This sensor idicates the lowBattery with slow blinking. At this point I couldn`t see any changes in the debug. But when the battery gets empty (<0,8V) the led blinks fast and the sensor sends a code with change in Bit20.
0--1--2--3--4--5--6--7--8--9--10-11-12-13-14-15-16-17-18-19-20-21-22-23
10 01 10 01 10 10 01 01 10 10 10 01 01 10 01 10 01 01 01 01 10 01 10 01 02 <---open
10 01 10 01 10 10 01 01 10 10 10 01 01 10 01 10 01 01 01 01 10 10 10 01 02 <---close
10 01 10 01 10 10 01 01 10 10 10 01 01 10 01 10 01 01 01 01 01 10 10 01 02 <---empty Battery < 0,8V
I added the bit 20 as lowBattery to the protocol, but without sucsses. The debug looks good. But there is no icon in the GUI and no variable with batterystatus.
module.exports = function(helper) {
var binaryToPulse, protocolInfo, pulsesToBinaryMapping;
pulsesToBinaryMapping = {
'10': '1',
'01': '0',
'02': ''
};
binaryToPulse = {
'0': '01',
'1': '10'
};
return protocolInfo = {
name: 'contact5',
type: 'contact',
values: {
id: {
type: "number"
},
contact: {
type: "boolean"
},
lowBattery: {
type: "boolean"
}
},
brands: ["DoorWindowConract"],
pulseLengths: [310, 950, 9644],
pulseCount: 50,
decodePulses: function(pulses) {
var binary, result;
binary = helper.map(pulses, pulsesToBinaryMapping);
return result = {
id: helper.binaryToNumber(binary, 0, 19),
contact: helper.binaryToBoolean(binary, 21),
lowBattery: helper.binaryToNumberLSBMSB(binary, 20, 20) !== 1
};
}
};
};
{
"id": "contact",
"name": "Door",
"class": "HomeduinoRFContactSensor",
"protocols": [
{
"name": "contact5",
"options": {
"id": 44261
}
}
],
"xClosedLabel": "Zu",
"xOpenedLabel": "Auf"
},
debug: contact5: { id: 44261, contact: true, lowBattery: false }
debug: contact5: { id: 44261, contact: true, lowBattery: true }