ParadoxIP150v2 icon indicating copy to clipboard operation
ParadoxIP150v2 copied to clipboard

Request - Command for zone bypass

Open johnym30 opened this issue 6 years ago • 1 comments

Is there a command to issue a zone bypass?

johnym30 avatar Feb 15 '19 09:02 johnym30

Hi,

No not yet. But if someone wants to add that functionality here's the code Alarmin uses to do just that (in NodeJS).

     // alarmType = 0: non-EVO; =1: EVO. toggleBypass = Zone

function toggleBypass(toggleBypass, onOff /*on=1, off=0*/) {
    if (alarmType == 0) {
        header = new Uint8Array([0xaa, 0x25, 0x00, 0x04, 0x08, 0x00, 0x00, 0x14, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee]);
        message = new Uint8Array([0x40, 0x00, 0x10, toggleBypass]);
        messageToSend = format37ByteMessage(message)
        packet = joinUint8Arrays(header, messageToSend)

        sendData(packet, 1)
        })
    }
    else if (alarmType == 1) {

        header = new Uint8Array([0xaa, 0x27, 0x00, 0x04, 0x08, 0x00, 0x00, 0x14, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee]);
        
        if (onOff == 1)
            var onOffByte = 0x08    //to bypass
        else if (onOff == 0)
            var onOffByte = 0x00    //to un-bypass

        message = new Uint8Array([0xd0, 0x27, 0x08, onOffByte, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ])    //0x40, 0x00, 0x10, toggleBypass])

        var byteVal = Math.pow(2, (toggleBypass - 8 * (~~(toggleBypass / 8))))  // => pow(2, index - 8*(index div 8)

        var byteLoc = (Math.floor(toggleBypass / 8)) + 6

        message[byteLoc] = byteVal
        
        messageToSend = format39ByteMessage(message)
        packet = joinUint8Arrays(header, messageToSend)

        sendData(packet, 1)
}

`

Tertiush avatar Feb 15 '19 12:02 Tertiush