Closed rrooggiieerr closed 8 years ago
I have created a RAW switch which outputs the set pulses directly to pimatic:
The protocol src/protocols/raw.coffee
module.exports = (helper) -> return protocolInfo = { name: 'raw' type: 'switch' values: pulseCount: type: "number" pulseLengths: type: "object" pulsesOn: type: "string" pulsesOff: type: "string" brands: ["RAW"] pulseLengths: [] pulseCount: 0 decodePulses: (pulses) -> # Currently only encodeMessage is supported return null encodeMessage: (message) -> this.pulseLengths = message.pulseLengths pulses = (if message.state then message.pulsesOn else message.pulsesOff ) return pulses }
I also needed to update src/controller.coffee, I switched lines 171 and 172 so the protocol.pulseLengths is read after protocol.encodeMessage(message) is executed from:
171 pulseLengths: protocol.pulseLengths 172 pulses: protocol.encodeMessage(message)
to:
171 pulses: protocol.encodeMessage(message) 172 pulseLengths: protocol.pulseLengths
The config in pimatic:
{ "id": "test-raw", "name": "Test RAW", "class": "HomeduinoRFSwitch", "protocols": [ { "name": "raw", "options": { "pulseCount": 58, "pulseLengths": [ 222, 438, 952, 5028 ], "pulsesOn": "2121210202210202212102020221212121022102212121212102022103", "pulsesOff": "2121210202210221020202212121022102210202020221210221022103" }, "send": true, "receive": false } ] }
How should I be able to also support decodePulses?
I have created a RAW switch which outputs the set pulses directly to pimatic:
The protocol src/protocols/raw.coffee
I also needed to update src/controller.coffee, I switched lines 171 and 172 so the protocol.pulseLengths is read after protocol.encodeMessage(message) is executed from:
to:
The config in pimatic:
How should I be able to also support decodePulses?