From c3e8471d857aaea30e07999e2ba4d45d9cb96c32 Mon Sep 17 00:00:00 2001 From: martinp876 <> Date: Sun, 28 Feb 2021 17:41:11 +0000 Subject: [PATCH] CUL_HM: catch failures at deviceRename git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@23855 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- FHEM/10_CUL_HM.pm | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/FHEM/10_CUL_HM.pm b/FHEM/10_CUL_HM.pm index 31a90bfb3..b28ebc300 100755 --- a/FHEM/10_CUL_HM.pm +++ b/FHEM/10_CUL_HM.pm @@ -4802,6 +4802,12 @@ sub CUL_HM_Set($@) {#+++++++++++++++++ set command+++++++++++++++++++++++++++++ elsif($cmd eq "deviceRename") { ############################################# my $newName = $a[2]; my @chLst = ("device");# entry 00 is unsed + + my $result = CommandRename(undef,$name.' '.$newName);#and the device itself + if ($result){ + return $result; + } + if ($roleV){ foreach(1..50){ push @chLst,$newName."_Btn".$_; @@ -4821,13 +4827,14 @@ sub CUL_HM_Set($@) {#+++++++++++++++++ set command+++++++++++++++++++++++++++++ } } } - + my @results; foreach my $cd (grep /^channel_/,keys %{$hash}){ - my $cName = InternalVal($name,$cd,""); + my $cName = InternalVal($newName,$cd,""); 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") { ############################################# my $action = "verify";#defaults