HMCCU: Keep eventMap when resetting attributes

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@25138 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
zap 2021-10-28 17:06:08 +00:00
parent ef60b504a7
commit 145a62476f
4 changed files with 11 additions and 8 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it.
- bugfix: 88_HMCCU: Keep eventMap when resetting attributes
- bugfix: 88_HMCCU: Fixed attribute room bug
- new: 58_RPI_1Wire: Raspberry Pi 1Wire interface replacing 58_GPIO4
- change: 73_AutoShuttersControl: change names of CommandTemplate variables,

View File

@ -57,7 +57,7 @@ my %HMCCU_CUST_CHN_DEFAULTS;
my %HMCCU_CUST_DEV_DEFAULTS;
# HMCCU version
my $HMCCU_VERSION = '5.0 213001927';
my $HMCCU_VERSION = '5.0 213011850';
# Timeout for CCU requests (seconds)
my $HMCCU_TIMEOUT_REQUEST = 4;
@ -6642,11 +6642,9 @@ sub HMCCU_SetDefaultAttributes ($;$)
$parRef //= { mode => 'update', role => undef, roleChn => undef };
my $role;
# HMCCU_Log ($clHash, 2, HMCCU_RefToString($parRef));
if ($parRef->{mode} eq 'reset') {
# List of attributes to be removed
my @removeAttr = ('ccureadingname', 'ccuscaleval', 'eventMap', 'cmdIcon',
my @removeAttr = ('ccureadingname', 'ccuscaleval', 'cmdIcon',
'substitute', 'webCmd', 'widgetOverride'
);

View File

@ -30,7 +30,7 @@ sub HMCCUCHN_Set ($@);
sub HMCCUCHN_Get ($@);
sub HMCCUCHN_Attr ($@);
my $HMCCUCHN_VERSION = '5.0 213001927';
my $HMCCUCHN_VERSION = '5.0 213011850';
######################################################################
# Initialize module
@ -360,12 +360,14 @@ sub HMCCUCHN_Set ($@)
elsif ($lcopt eq 'defaults') {
my $mode = shift @$a // 'update';
my $rc = 0;
my $retMsg = 'OK';
if ($mode ne 'old') {
$rc = HMCCU_SetDefaultAttributes ($hash, { mode => $mode, role => undef, roleChn => undef });
$retMsg = 'Please remove HMCCU 4.3 entries from attribute eventMap' if ($rc && $mode eq 'reset' && exists($attr{$name}{eventMap}));
}
$rc = HMCCU_SetDefaults ($hash) if (!$rc);
HMCCU_RefreshReadings ($hash) if ($rc);
return HMCCU_SetError ($hash, $rc == 0 ? "No default attributes found" : "OK");
return HMCCU_SetError ($hash, $rc == 0 ? 'No default attributes found' : $retMsg);
}
else {
return "Unknown argument $opt choose one of $syntax";

View File

@ -31,7 +31,7 @@ sub HMCCUDEV_Set ($@);
sub HMCCUDEV_Get ($@);
sub HMCCUDEV_Attr ($@);
my $HMCCUDEV_VERSION = '5.0 213001927';
my $HMCCUDEV_VERSION = '5.0 213011850';
######################################################################
# Initialize module
@ -448,12 +448,14 @@ sub HMCCUDEV_Set ($@)
elsif ($lcopt eq 'defaults') {
my $mode = shift @$a // 'update';
my $rc = 0;
my $retMsg = 'OK';
if ($mode ne 'old') {
$rc = HMCCU_SetDefaultAttributes ($hash, { mode => $mode, role => undef, roleChn => undef });
$retMsg = 'Please remove HMCCU 4.3 entries from attribute eventMap' if ($rc && $mode eq 'reset' && exists($attr{$name}{eventMap}));
}
$rc = HMCCU_SetDefaults ($hash) if (!$rc);
HMCCU_RefreshReadings ($hash) if ($rc);
return HMCCU_SetError ($hash, $rc == 0 ? 'No default attributes found' : 'OK');
return HMCCU_SetError ($hash, $rc == 0 ? 'No default attributes found' : $retMsg);
}
else {
return "Unknown argument $opt choose one of $syntax";