def parse(_buffer):
        split = _buffer.split(Command.DELIMITER)
        ctype = int(split[0])
        cmd = Command(ctype)  # type

        if CommandType.is_device_command(ctype):
            cmd.deviceID = int(split[2])
            cmd.value = int(split[3])
        elif CommandType.is_simple_command(ctype):
            cmd.value = int(split[3])

        return cmd
    def serialize(cmd):
        data = ""
        data += Command.START_FLAG
        data += str(cmd['type'])
        data += Command.DELIMITER_FLAG
        data += "0"  # UID (TODO not implemented)
        if CommandType.is_device_command(cmd['type']):
            data += Command.DELIMITER_FLAG
            data += str(cmd['deviceID'])
            data += Command.DELIMITER_FLAG
            data += str(cmd['value'])
        else:
            data += "0"
            data += Command.DELIMITER_FLAG
            data += "0"
        data += Command.ACK_FLAG

        return data.encode('utf-8')