LIFETEC MD13187
Inspired by this post, I created a new doorbell2 protocol for my dorbells. With this protocol it is possible to show the bell as a PIR device and as a button.
Now I can start a lot of actions when my bell rings… push a message, mute the musik, stop kodi… In some cases the buttons could be useful to let a second doorbell ring by the rule or to activate the bell when the door is open for some time.
Protocol:
module.exports = function(helper) {
var binaryToPulse, protocolInfo, pulsesToBinaryMapping;
pulsesToBinaryMapping = {
'10': '0',
'01': '1',
'02': ''
};
binaryToPulse = {
'0': '10',
'1': '01'
};
return protocolInfo = {
name: 'doorbell2',
type: 'pir',
values: {
unit: {
type: "number"
},
id: {
type: "number"
},
presence: {
type: "boolean"
}
},
brands: ["LIFETEC-MD13187"],
pulseLengths: [491, 1491, 19270],
pulseCount: 48,
decodePulses: function(pulses) {
var binary, result;
binary = helper.map(pulses, pulsesToBinaryMapping);
return result = {
unit: helper.binaryToNumber(binary, 0, 11),
id: helper.binaryToNumber(binary, 12, 22),
presence: true
}
},
encodeMessage: function(message) {
var unit, id, presence;
unit = helper.map(helper.numberToBinary(message.unit, 12), binaryToPulse);
id = helper.map(helper.numberToBinary(message.id, 11), binaryToPulse);
return "" + unit + id + "02";
}
};
};
Config:
{
"id": "lifetec-md13187",
"name": "Hausklingel",
"class": "HomeduinoRFPir",
"protocols": [
{
"name": "doorbell2",
"options": {
"unit": xxxx,
"id": xxxx
}
}
],
"resetTime": 10000
},
{
"id": "klingeln",
"name": "Klingeln",
"class": "HomeduinoRFButtonsDevice",
"buttons": [
{
"id": "hausklingel-button",
"text": "Haus",
"protocols": [
{
"name": "doorbell2",
"options": {
"unit":xxxx,
"id": xxxx,
"presence": true,
"all": true,
"state": true
}
}
],
"resetTime": 3000
},
result: