athombv/node-homey-lib

Allow to send non-prontohex IR Signals

popcorn4dinner opened this issue · 1 comments

I would like to be able to configure an IR signal with commands without having to use the prontohex format.

Example:

#app.json
{
    "signals": {
        "ir": {
            "my_vacuume_cleaner": {
                "cmds": {
                    "ON": "2950, 3000, 550, 450, 550, ...", 
                    "OFF": "3000, 2950, 600, 400, ..."
                }
            }
        }
    }
}

Right now, this type of configuration is (hopefully only) prevented by the signal validation mechanism.

Looking forward to your feedback!

To use normal (non-prontohex) signals, you have to use the sof,eof,words notation with the payloads in the command map. I've attached a few examples:

{
    manchesterUnit: 444, //microseconds
    sensitivity:    0.4,
    //              ===start bit 1===  sb2  ====mode0====  =toggle=
    sof:            [1,1,1,1,1,1, 0,0, 1,0, 0,1, 0,1, 0,1, 1,1,0,0 ],
    toggleSof:      [1,1,1,1,1,1, 0,0, 1,0, 0,1, 0,1, 0,1, 0,0,1,1 ],
    toggleIndexes:  [16, 17, 18, 19],
    toggleBits:     [],
    words:          [
                        [0,  1], // 0
                        [1,  0], // 1
                    ],
                    
    packing:        true,
    prefixData:     [0x00],
    cmds:           {
                        ONOFF: [0x0C],
                    },

    interval:       30025,
    repetitions:    10,
};
{
    "sof": [4535, 4465],
    "eof": [590],
    "carrier": 37900,
    "words": [
        [590, 590],
        [590, 1690]
    ],
    "prefixData": [1,1,1,0,0,0,0,0,1,1,1,0,0,0,0,0],
    "interval": 5000,
    "sensitivity": 0.5,
    "repetitions": 5,
    "minimalLength": 32,
    "maximalLength": 32,
    "cmds": {
        "tv$~onoff": [0,1,0,0,0,0,0,0,1,0,1,1,1,1,1,1],
        "tv$~power_on": [1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0],
        "tv$~power_off": [0,0,0,1,1,0,0,1,1,1,1,0,0,1,1,0],
        "tv$~number_0": [1,0,0,0,1,0,0,0,0,1,1,1,0,1,1,1],
        "tv$~number_1": [0,0,1,0,0,0,0,0,1,1,0,1,1,1,1,1],
        "tv$~number_2": [1,0,1,0,0,0,0,0,0,1,0,1,1,1,1,1]
    }
}