Create devicefunction