Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module.exports = function(helper) {
- var binaryToPulse, protocolInfo, pulsesToBinaryMapping;
- pulsesToBinaryMapping = {
- '10': '0',
- '01': '1',
- '02': '',
- '12': ''
- };
- binaryToPulse = {
- '0': '10',
- '1': '01',
- };
- return protocolInfo = {
- name: 'pir6',
- type: 'pir',
- values: {
- unit: {
- type: "number"
- },
- id: {
- type: "number"
- },
- presence: {
- type: "boolean"
- }
- },
- brands: [],
- pulseLengths: [172, 540, 5568],
- pulseCount: 50,
- decodePulses: function(pulses) {
- var binary, result;
- binary = helper.map(pulses, pulsesToBinaryMapping);
- return result = {
- id: helper.binaryToNumber(binary, 1, 19),
- unit: helper.binaryToNumber(binary, 20, 23),
- presence: true
- };
- }
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement