CUL_HM: catch failures at deviceRename

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@23855 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinp876 2021-02-28 17:41:11 +00:00
parent bed5fadb8a
commit c3e8471d85

View File

@ -4802,6 +4802,12 @@ sub CUL_HM_Set($@) {#+++++++++++++++++ set command+++++++++++++++++++++++++++++
elsif($cmd eq "deviceRename") { ############################################# elsif($cmd eq "deviceRename") { #############################################
my $newName = $a[2]; my $newName = $a[2];
my @chLst = ("device");# entry 00 is unsed my @chLst = ("device");# entry 00 is unsed
my $result = CommandRename(undef,$name.' '.$newName);#and the device itself
if ($result){
return $result;
}
if ($roleV){ if ($roleV){
foreach(1..50){ foreach(1..50){
push @chLst,$newName."_Btn".$_; push @chLst,$newName."_Btn".$_;
@ -4821,13 +4827,14 @@ sub CUL_HM_Set($@) {#+++++++++++++++++ set command+++++++++++++++++++++++++++++
} }
} }
} }
my @results;
foreach my $cd (grep /^channel_/,keys %{$hash}){ foreach my $cd (grep /^channel_/,keys %{$hash}){
my $cName = InternalVal($name,$cd,""); my $cName = InternalVal($newName,$cd,"");
my $no = hex(substr($cd,8)); my $no = hex(substr($cd,8));
CommandRename(undef,$cName.' '.$chLst[$no]); $result = CommandRename(undef,$cName.' '.$chLst[$no]);
push @results,"rename $cName failed: $result" if ($result);
} }
CommandRename(undef,$name.' '.$newName);#and the device itself return "channel rename failed:\n".join("\n",@results) if (scalar @results);
} }
elsif($cmd eq "tempListTmpl") { ############################################# elsif($cmd eq "tempListTmpl") { #############################################
my $action = "verify";#defaults my $action = "verify";#defaults