jdiazbb / rfxcmd

Automatically exported from code.google.com/p/rfxcmd
1 stars 0 forks source link

Updated decode for type 0x11 Lighting #21

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Added trigger.xml support for type 0x11.

    # ---------------------------------------
    # 0x11 Lighting2
    # ---------------------------------------
    if packettype == '11':

        decoded = True

        # DATA
        sensor_id = ByteToHex(message[4]) + ByteToHex(message[5]) + ByteToHex(message[6]) + ByteToHex(message[7])
        unitcode = int(ByteToHex(message[8]),16)
        command = rfx_subtype_11_cmnd[ByteToHex(message[9])]
        dimlevel = rfx_subtype_11_dimlevel[ByteToHex(message[10])]
        battery = decodeBattery(message[11])
        signal = decodeSignal(message[11])

        # PRINTOUT
        if cmdarg.printout_complete == True:
            print "Subtype\t\t\t= " + rfx_subtype_11[subtype]
            print "Seqnbr\t\t\t= " + seqnbr
            print "Id\t\t\t= " + sensor_id
            print "Unitcode\t\t= " + str(unitcode)
            print "Command\t\t\t= " + command
            print "Dim level\t\t= " + dimlevel + "%"
            print "Signal level\t\t= " + str(signal)

        # CSV
        if cmdarg.printout_csv == True:
            sys.stdout.write("%s;%s;%s;%s;%s;%s;%s;%s;%s\n" % (timestamp, packettype, subtype, seqnbr, str(signal), sensor_id, command, str(unitcode), dimlevel ))
            sys.stdout.flush()

        # TRIGGER
        if config.trigger:
            for trigger in triggerlist.data:
                trigger_message = trigger.getElementsByTagName('message')[0].childNodes[0].nodeValue
                action = trigger.getElementsByTagName('action')[0].childNodes[0].nodeValue
                rawcmd = ByteToHex ( message )
                rawcmd = rawcmd.replace(' ', '')
                if re.match(trigger_message, rawcmd):
                    action = action.replace("$id$", str(sensor_id) )
                    action = action.replace("$battery$", str(battery) )
                    action = action.replace("$signal$", str(signal) )
                    action = action.replace("$unitcode$", str(unitcode) )
                    action = action.replace("$command$", ByteToHex(message[9]))
                    return_code = subprocess.call(action, shell=True)

Original issue reported on code.google.com by andy.eas...@gmail.com on 17 May 2013 at 5:46

GoogleCodeExporter commented 8 years ago
This is inlcuded now in 0.24b that will be released shortly.

Thank you for your feedback.

Original comment by sebastia...@gmail.com on 18 May 2013 at 12:46