# $Id$ package main; use strict; use warnings; sub CommandCopy($$); sub copy_Initialize($) { my %lhash = ( Fn=>"CommandCopy", Hlp=>" []" ); $cmds{copy} = \%lhash; } sub CommandCopy($$) { my ($hash, $param) = @_; my @args = split(/ +/,$param); return "Usage: copy []" if (@args < 2); my $d = $defs{$args[0]}; return "$args[0] not defined" if( !$d ); my $cmd = "$args[1] $d->{TYPE}"; if( $args[2] ) { $cmd .= ' '. join( ' ', @args[2..@args-1]); } else { $cmd .= " $d->{DEF}" if( $d->{DEF} ); } my $ret = CommandDefine($hash, $cmd ); return $ret if( $ret ); my $a = 'userattr'; if( $attr{$args[0]} && $attr{$args[0]}{$a} ) { CommandAttr($hash, "$args[1] $a $attr{$args[0]}{$a}"); } foreach my $a (keys %{$attr{$args[0]}}) { next if( $a eq 'userattr' ); CommandAttr($hash, "$args[1] $a $attr{$args[0]}{$a}"); } CallFn($args[1], "CopyFn", $args[0], $args[1]); } 1; =pod =item command =item summary copy a fhem device =item summary_DE kopiert ein FHEM Ger&aauml;t =begin html

copy

    copy <orig name> <copy name> [<type dependent arguments>]

    Create a copy of device <orig name> with the name <copy name>.
    If <type dependent arguments> are given they will replace the DEF of <orig name> for the creation of <copy name>.
=end html =begin html_DE

copy

    copy <orig name> <copy name> [<type dependent arguments>]

    Erzeugt eine Kopie des Device <orig name> mit dem namen <copy name>.
    Wenn <type dependent arguments> angegeben sind ersetzen die die DEF von <orig name> beim anlegen von <copy name>.
=end html_DE =cut