From 0ff2aa0c2b2cf3ba0dbfa3d36f4f07635e68438b Mon Sep 17 00:00:00 2001 From: zap <> Date: Tue, 16 Nov 2021 16:55:32 +0000 Subject: [PATCH] HMCCU: Fixed some bugs git-svn-id: https://svn.fhem.de/fhem/trunk@25236 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/88_HMCCU.pm | 203 +++++++++++++++++++++-------------- fhem/FHEM/88_HMCCUCHN.pm | 4 +- fhem/FHEM/88_HMCCUDEV.pm | 6 +- fhem/FHEM/88_HMCCURPCPROC.pm | 2 +- 5 files changed, 134 insertions(+), 82 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 80b6991e3..be636e43b 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -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: Fixed some bugs - bugfix: 73_AutoShuttersControl: Fix uninitialized value within %charHash in substitution iterator - bugfix: 88_HMCCU: Fixed ePaper and BSL bugs diff --git a/fhem/FHEM/88_HMCCU.pm b/fhem/FHEM/88_HMCCU.pm index 7c437d4dc..eeaa9c0b5 100755 --- a/fhem/FHEM/88_HMCCU.pm +++ b/fhem/FHEM/88_HMCCU.pm @@ -57,7 +57,7 @@ my %HMCCU_CUST_CHN_DEFAULTS; my %HMCCU_CUST_DEV_DEFAULTS; # HMCCU version -my $HMCCU_VERSION = '5.0 213171649'; +my $HMCCU_VERSION = '5.0 213201747'; # Timeout for CCU requests (seconds) my $HMCCU_TIMEOUT_REQUEST = 4; @@ -162,7 +162,7 @@ sub HMCCU_Detail ($$$$); sub HMCCU_PostInit ($); # Aggregation -sub HMCCU_AggregateReadings ($$); +sub HMCCU_AggregateReadingsRule ($$); sub HMCCU_AggregationRules ($$); # Handling of default attributes @@ -192,7 +192,7 @@ sub HMCCU_SubstRule ($$$); sub HMCCU_SubstVariables ($$$); # Update client device readings -sub HMCCU_BulkUpdate ($$$;$); +sub HMCCU_BulkUpdate ($$$;$$); sub HMCCU_GetUpdate ($$;$$); sub HMCCU_RefreshReadings ($;$); sub HMCCU_UpdateCB ($$$); @@ -336,7 +336,7 @@ sub HMCCU_CorrectName ($); sub HMCCU_Encrypt ($); sub HMCCU_Decrypt ($); sub HMCCU_DefStr ($;$$); -sub HMCCU_DeleteReadings ($$); +sub HMCCU_DeleteReadings ($;$); sub HMCCU_EncodeEPDisplay ($); sub HMCCU_ExprMatch ($$$); sub HMCCU_ExprNotMatch ($$$); @@ -479,7 +479,7 @@ sub HMCCU_Define ($$$) $hash->{config} = $HMCCU_CONFIG_VERSION; $hash->{ccutype} = 'CCU2/3'; $hash->{RPCState} = 'inactive'; - $hash->{NOTIFYDEV} = 'global,TYPE=(HMCCU|HMCCUDEV|HMCCUCHN)'; + $hash->{NOTIFYDEV} = 'global,TYPE=HMCCU'; $hash->{hmccu}{rpcports} = undef; HMCCU_Log ($hash, 1, "Initialized version $HMCCU_VERSION"); @@ -610,17 +610,17 @@ sub HMCCU_Attr ($@) return HMCCU_SetError ($hash, 'Syntax error in attribute ccuaggregate') if ($rc == 0); } elsif ($attrname eq 'ccuackstate') { - return "HMCCU: Attribute ccuackstate is depricated. Use ccuflags with 'ackState' instead"; + return "HMCCU: [$name] Attribute ccuackstate is depricated. Use ccuflags with 'ackState' instead"; } elsif ($attrname eq 'ccureadings') { - return "HMCCU: Attribute ccureadings is depricated. Use ccuflags with 'noReadings' instead"; + return "HMCCU: [$name] Attribute ccureadings is depricated. Use ccuflags with 'noReadings' instead"; } elsif ($attrname eq 'ccuflags') { my $ccuflags = AttrVal ($name, 'ccuflags', 'null'); my @flags = ($attrval =~ /(intrpc|extrpc|procrpc)/g); - return "Flags extrpc, procrpc and intrpc cannot be combined" if (scalar (@flags) > 1); + return "HMCCU: [$name] Flags extrpc, procrpc and intrpc cannot be combined" if (scalar (@flags) > 1); if ($attrval =~ /(intrpc|extrpc)/) { - HMCCU_Log ($hash, 1, "RPC server mode $1 no longer supported. Using procrpc instead"); + HMCCU_Log ($hash, 1, "HMCCU: [$name] RPC server mode $1 no longer supported. Using procrpc instead"); $attrval =~ s/(extrpc|intrpc)/procrpc/; $_[3] = $attrval; } @@ -632,20 +632,32 @@ sub HMCCU_Attr ($@) $hash->{hmccu}{ccuvarsint} = $interval; RemoveInternalTimer ($hash, "HMCCU_UpdateVariables"); if ($interval > 0) { - HMCCU_Log ($hash, 2, "Updating CCU system variables every $interval seconds"); + HMCCU_Log ($hash, 2, "HMCCU: [$name] Updating CCU system variables every $interval seconds"); InternalTimer (gettimeofday()+$interval, "HMCCU_UpdateVariables", $hash); } } + elsif ($attrname eq 'eventMap') { + my @av = map { $_ =~ /^rpcserver (on|off):(on|off)$/ || $_ eq '' ? () : $_ } split (/\//, $attrval); + if (scalar(@av) > 0) { + $_[3] = '/'.join('/',@av).'/'; + HMCCU_Log ($hash, 2, "HMCCU: [$name] Removed rpcserver entries from attribute eventMap"); + } + else { + # Workaround because FHEM is ignoring error values for attribute eventMap + delete $attr{$name}{eventMap} if (exists($attr{$name}{eventMap})); + return "HMCCU: [$name] Ignored attribute eventMap because it contains only obsolet rpcserver entries"; + } + } elsif ($attrname eq 'rpcdevice') { - return "HMCCU: Attribute rpcdevice is depricated. Please remove it"; + return "HMCCU: [$name] Attribute rpcdevice is depricated. Please remove it"; } elsif ($attrname eq 'rpcport') { - return 'HMCCU: Attribute rpcport is no longer supported. Use rpcinterfaces instead'; + return "HMCCU: [$name] Attribute rpcport is no longer supported. Use rpcinterfaces instead"; } } elsif ($cmd eq 'del') { if ($attrname eq 'ccuaggregate') { - HMCCU_AggregationRules ($hash, ''); + HMCCU_AggregationRules ($hash, ''); } elsif ($attrname eq 'ccuGetVars') { RemoveInternalTimer ($hash, "HMCCU_UpdateVariables"); @@ -675,10 +687,9 @@ sub HMCCU_AggregationRules ($$) my ($hash, $rulestr) = @_; my $name = $hash->{NAME}; - return 0 if ($rulestr eq ''); - # Delete existing aggregation rules if (exists($hash->{hmccu}{agg})) { delete $hash->{hmccu}{agg}; } + return if ($rulestr eq ''); my @pars = ('name', 'filter', 'if', 'else'); @@ -1042,44 +1053,18 @@ sub HMCCU_Notify ($$) InternalTimer (gettimeofday()+$delay, "HMCCU_PostInit", $hash, 0); } elsif ($event =~ /^(ATTR|DELETEATTR)/ && $init_done) { - # Attribute of client device set or deleted - my $refreshAttrList = 'ccucalculate|ccuflags|ccureadingfilter|ccureadingformat|'. - 'ccureadingname|ccuReadingPrefix|ccuscaleval|controldatapoint|hmstatevals|'. - 'statedatapoint|statevals|substitute|substexcl|stripnumber'; - my ($aCmd, $aDev, $aAtt, $aVal) = split (/\s+/, $event); $aAtt = $aVal if ($aCmd eq 'DELETEATTR'); if (defined($aAtt)) { my $clHash = $defs{$aDev}; # Consider attr event only for HMCCUCHN or HMCCUDEV devices assigned to current IO device - HMCCU_RefreshReadings ($clHash) + my $setDefaults = $clHash->{hmccu}{setDefaults} // 0; + HMCCU_RefreshReadings ($clHash, $aAtt) if (defined($clHash->{TYPE}) && ($clHash->{TYPE} eq 'HMCCUCHN' || $clHash->{TYPE} eq 'HMCCUDEV') && - defined($clHash->{IODev}) && $clHash->{IODev} == $hash && $aAtt =~ /^($refreshAttrList)$/i); + defined($clHash->{IODev}) && $clHash->{IODev} == $hash && $setDefaults == 0); } } } - else { - # Device must be assigned to IO device - return if (($devtype ne 'HMCCUDEV' && $devtype ne 'HMCCUCHN') || $devhash->{IODev} != $hash); - - # Update aggregated readings - my ($r, $v) = split (": ", $event); - return if (!defined($v) || HMCCU_IsFlag ($name, 'noagg')); - - foreach my $rule (keys %{$hash->{hmccu}{agg}}) { - my $ftype = $hash->{hmccu}{agg}{$rule}{ftype}; - my $fexpr = $hash->{hmccu}{agg}{$rule}{fexpr}; - my $fread = $hash->{hmccu}{agg}{$rule}{fread}; - next if ($r !~ $fread || - ($ftype eq 'name' && $devname !~ /$fexpr/) || - ($ftype eq 'type' && $devhash->{ccutype} !~ /$fexpr/) || - ($ftype eq 'group' && AttrVal ($devname, 'group', 'null') !~ /$fexpr/) || - ($ftype eq 'room' && AttrVal ($devname, 'room', 'null') !~ /$fexpr/) || - ($ftype eq 'alias' && AttrVal ($devname, 'alias', 'null') !~ /$fexpr/)); - - HMCCU_AggregateReadings ($hash, $rule); - } - } } return; @@ -1121,12 +1106,50 @@ sub HMCCU_Detail ($$$$) return $links; } +sub HMCCU_IsAggregation ($) +{ + my ($ioHash) = @_; + + return (HMCCU_IsFlag ($ioHash->{NAME}, 'noagg') || AttrVal ($ioHash->{NAME}, 'ccuaggregate', '') eq '') ? 0 : 1; +} + ###################################################################### -# Calculate reading aggregations. -# Called by Notify or via command get aggregation. +# Calculate reading aggregations ###################################################################### -sub HMCCU_AggregateReadings ($$) +sub HMCCU_AggregateReadings ($) +{ + my ($clHash) = @_; + + my $ioHash = HMCCU_GetHash ($clHash); + return if (!defined($ioHash) || !exists($clHash->{hmccu}{updateReadings}) || !HMCCU_IsAggregation ($ioHash)); + + my $name = $clHash->{NAME}; + + foreach my $r (keys %{$clHash->{hmccu}{updateReadings}}) { + foreach my $rule (keys %{$ioHash->{hmccu}{agg}}) { + my $ftype = $ioHash->{hmccu}{agg}{$rule}{ftype}; + my $fexpr = $ioHash->{hmccu}{agg}{$rule}{fexpr}; + my $fread = $ioHash->{hmccu}{agg}{$rule}{fread}; + next if ($r !~ $fread || + ($ftype eq 'name' && $name !~ /$fexpr/) || + ($ftype eq 'type' && $clHash->{ccutype} !~ /$fexpr/) || + ($ftype eq 'group' && AttrVal ($name, 'group', 'null') !~ /$fexpr/) || + ($ftype eq 'room' && AttrVal ($name, 'room', 'null') !~ /$fexpr/) || + ($ftype eq 'alias' && AttrVal ($name, 'alias', 'null') !~ /$fexpr/)); + + HMCCU_AggregateReadingsRule ($ioHash, $rule); + } + } + + delete $clHash->{hmccu}{updateReadings}; +} + +###################################################################### +# Calculate reading aggregations by rule. +###################################################################### + +sub HMCCU_AggregateReadingsRule ($$) { my ($hash, $rule) = @_; @@ -1335,7 +1358,7 @@ sub HMCCU_Set ($@) my $name = shift @$a; my $opt = shift @$a // return 'No set command specified'; my $options = "var clear delete execute hmscript cleardefaults:noArg datapoint ". - "importdefaults rpcregister:all rpcserver:on,off ackmessages:noArg authentication ". + "importdefaults rpcregister:all ackmessages:noArg authentication ". "prgActivate prgDeactivate on:noArg off:noArg"; $opt = lc($opt); @@ -1930,14 +1953,14 @@ sub HMCCU_Get ($@) if ($rule eq 'all') { foreach my $r (keys %{$hash->{hmccu}{agg}}) { - my $rc = HMCCU_AggregateReadings ($hash, $r); + my $rc = HMCCU_AggregateReadingsRule ($hash, $r); $result .= "$r = $rc\n"; } } else { return HMCCU_SetError ($hash, "HMCCU: Aggregation rule $rule does not exist") if (!exists($hash->{hmccu}{agg}{$rule})); - $result = HMCCU_AggregateReadings ($hash, $rule); + $result = HMCCU_AggregateReadingsRule ($hash, $rule); $result = "$rule = $result"; } @@ -2166,6 +2189,7 @@ sub HMCCU_ParseObject ($$$) # or # [N:][Channel-No[,Channel-No].]Datapoint-Expr # Multiple filter rules must be separated by ; +# Return: 0=Do not update reading, 1=Update reading ###################################################################### sub HMCCU_FilterReading ($$$;$) @@ -4582,7 +4606,7 @@ sub HMCCU_UpdateParamsetReadings ($$$;$) my $clInt = $clHash->{ccuif}; my ($sc, $sd, $cc, $cd) = HMCCU_GetSCDatapoints ($clHash); - readingsBeginUpdate ($clHash); + HMCCU_BeginBulkUpdate ($clHash); # Loop over all addresses foreach my $a (@addList) { @@ -4650,10 +4674,10 @@ sub HMCCU_UpdateParamsetReadings ($$$;$) $results{$devAddr}{$c}{$ps}{$p} = $cv if ($devAddr eq $a); my @rnList = HMCCU_GetReadingName ($clHash, $clInt, $a, $c, $p, '', $clRF, $ps); - my $dispFlag = HMCCU_FilterReading ($clHash, $chnAddr, $p, $ps) ? '' : '.'; + my $hide = HMCCU_FilterReading ($clHash, $chnAddr, $p, $ps) ? 0 : 1; foreach my $rn (@rnList) { - HMCCU_Trace ($clHash, 2, "rn=$rn, dispFlag=$dispFlag, fv=$fv, cv=$cv"); - HMCCU_BulkUpdate ($clHash, $dispFlag.$rn, $fv, $cv); + HMCCU_Trace ($clHash, 2, "rn=$rn, hide=$hide, fv=$fv, cv=$cv"); + HMCCU_BulkUpdate ($clHash, $rn, $fv, $cv, $hide); } } } @@ -4677,7 +4701,7 @@ sub HMCCU_UpdateParamsetReadings ($$$;$) HMCCU_BulkUpdate ($clHash, $hms_read, $hms_val, $hms_val) if (defined($hms_val)); } - readingsEndUpdate ($clHash, 1); + HMCCU_EndBulkUpdate ($clHash); return \%results; } @@ -4697,7 +4721,7 @@ sub HMCCU_RefreshReadings ($;$) return if (defined($attribute) && $attribute !~ /^($refreshAttrList)$/i); - HMCCU_DeleteReadings ($clHash, '.*'); + HMCCU_DeleteReadings ($clHash); my %objects; my ($devAddr, undef) = HMCCU_SplitChnAddr ($clHash->{ccuaddr}); @@ -4815,14 +4839,14 @@ sub HMCCU_GetAffectedAddresses ($) my @addlist = (); if ($clHash->{TYPE} eq 'HMCCUDEV' || $clHash->{TYPE} eq 'HMCCUCHN') { - my $ioHash = HMCCU_GetHash ($clHash); - my $ccuFlags = defined($ioHash) ? HMCCU_GetFlags ($ioHash) : 'null'; - if (exists($clHash->{ccuaddr})) { + if (HMCCU_IsDeviceActive ($clHash)) { + my $ioHash = HMCCU_GetHash ($clHash); + my $ccuFlags = defined($ioHash) ? HMCCU_GetFlags ($ioHash) : 'null'; my ($devaddr, $cnum) = HMCCU_SplitChnAddr ($clHash->{ccuaddr}); push @addlist, $devaddr; - } - if ($clHash->{ccuif} eq 'VirtualDevices' && $ccuFlags =~ /updGroupMembers/ && exists($clHash->{ccugroup}) && $clHash->{ccugroup} ne '') { - push @addlist, split (',', $clHash->{ccugroup}); + if ($clHash->{ccuif} eq 'VirtualDevices' && $ccuFlags =~ /updGroupMembers/ && exists($clHash->{ccugroup}) && $clHash->{ccugroup} ne '') { + push @addlist, split (',', $clHash->{ccugroup}); + } } } @@ -5756,9 +5780,10 @@ sub HMCCU_IsDeviceActive ($) if (defined($clHash)) { my $disabled = AttrVal ($clHash->{NAME}, 'disable', 0); my $devstate = $clHash->{ccudevstate} // 'pending'; - return $disabled == 0 && exists($clHash->{ccuaddr}) && $devstate ne 'inactive' ? 1 : 0; + return 1 if ($disabled == 0 && exists($clHash->{ccuaddr}) && exists($clHash->{ccuif}) && $devstate ne 'inactive'); } + HMCCU_Log ($clHash, 2, "Device disabled or inactive and/or address or interface is missing"); return 0; } @@ -6774,11 +6799,9 @@ sub HMCCU_DeleteAttributes ($$;$) $sem //= 0; my $clName = $clHash->{NAME}; - $clHash->{hmccu}{setDefaults} = $sem; foreach my $a (@$attrList) { CommandDeleteAttr (undef, "$clName $a") if (exists($attr{$clName}{$a})); } - $clHash->{hmccu}{setDefaults} = 0; } ###################################################################### @@ -8489,7 +8512,7 @@ sub HMCCU_DetectDevice ($$$) my $dpn = $di{stateRole}{$di{defSCh}}{datapoint} // ''; my $dpr = $di{stateRole}{$di{defSCh}}{role} // ''; if ($dpn eq '') { - HMCCU_Log ($ioHash, 2, "State datapoint not defined for channel $di{defSCh}, role $dpr"); + HMCCU_Log ($ioHash, 5, "State datapoint not defined for channel $di{defSCh}, role $dpr"); } else { $di{defSDP} = $di{defSCh}.'.'.$dpn; @@ -8914,14 +8937,35 @@ sub HMCCU_HMScriptExt ($$;$$$) # Bulk update of reading considering attribute substexcl. ###################################################################### -sub HMCCU_BulkUpdate ($$$;$) +sub HMCCU_BeginBulkUpdate ($) { - my ($hash, $reading, $orgval, $subval) = @_; + my ($hash) = @_; + + readingsBeginUpdate ($hash); +} + +sub HMCCU_BulkUpdate ($$$;$$) +{ + my ($hash, $reading, $orgval, $subval, $hide) = @_; $subval //= $orgval; + $hide //= 0; + my $ioHash = HMCCU_GetHash ($hash); my $excl = AttrVal ($hash->{NAME}, 'substexcl', ''); + my $rv = $excl ne '' && $reading =~ /$excl/ ? $orgval : $subval; + $hash->{hmccu}{updateReadings}{$reading} = $rv if (HMCCU_IsAggregation ($ioHash)); - readingsBulkUpdate ($hash, $reading, ($excl ne '' && $reading =~ /$excl/ ? $orgval : $subval)); + my $disp = $hide ? '.' : ''; + readingsBulkUpdate ($hash, $disp.$reading, $rv); +} + +sub HMCCU_EndBulkUpdate ($) +{ + my ($hash) = @_; + + HMCCU_AggregateReadings ($hash); + + readingsEndUpdate ($hash, 1); } ###################################################################### @@ -9666,6 +9710,7 @@ sub HMCCU_UpdateDeviceStates ($) '0.DEVICE_IN_BOOTLOADER' => 'boot', '0.STICKY_UNREACH' => 'stickyUnreach', '0.UPDATE_PENDING' => 'updPending', + '0.SABOTAGE' => 'sabotage' ); # Datapoints to be converted to readings @@ -9675,7 +9720,8 @@ sub HMCCU_UpdateDeviceStates ($) '0.RSSI_PEER' => 'rssipeer', '0.LOW_BAT' => 'battery', '0.LOWBAT' => 'battery', - '0.UNREACH' => 'activity' + '0.UNREACH' => 'activity', + '0.SABOTAGE' => 'sabotage' ); # The new readings @@ -10055,7 +10101,7 @@ sub HMCCU_Decrypt ($) # Readings 'state' and 'control' are ignored. ###################################################################### -sub HMCCU_DeleteReadings ($$) +sub HMCCU_DeleteReadings ($;$) { my ($hash, $rnexp) = @_; $rnexp //= '.*'; @@ -10533,7 +10579,14 @@ sub HMCCU_MaxHashEntries ($$)
  • set <name> initialize
    Initialize I/O device if state of CCU is unreachable.

  • -
  • set <name> prgActivate <program>
    +
  • set <name> off
    + Stop RPC server(s). See also 'set on' command. +

  • +
  • set <name> on
    + Start RPC server(s). This command will fork a RPC server process for each RPC interface defined in attribute 'rpcinterfaces'. + Until operation is completed only a few set/get commands are available and you may get the error message 'CCU busy'. +

  • +
  • set <name> prgActivate <program>
    Activate a CCU program.

  • set <name> prgDeactivate <program>
    @@ -10542,12 +10595,6 @@ sub HMCCU_MaxHashEntries ($$)
  • set <name> rpcregister [{all | <interface>}]
    Register RPC servers at CCU.

  • -
  • set <name> rpcserver {on | off | restart}
    - Start, stop or restart RPC server(s). This command executed with option 'on' - will fork a RPC server process for each RPC interface defined in attribute 'rpcinterfaces'. - Until operation is completed only a few set/get commands are available and you - may get the error message 'CCU busy'. -

  • set <name> var <variable> <Value>
    Set CCU system variable value. Special characters \_ in value are substituted by blanks. diff --git a/fhem/FHEM/88_HMCCUCHN.pm b/fhem/FHEM/88_HMCCUCHN.pm index eb0185467..0976b7b86 100644 --- a/fhem/FHEM/88_HMCCUCHN.pm +++ b/fhem/FHEM/88_HMCCUCHN.pm @@ -30,7 +30,7 @@ sub HMCCUCHN_Set ($@); sub HMCCUCHN_Get ($@); sub HMCCUCHN_Attr ($@); -my $HMCCUCHN_VERSION = '5.0 213171649'; +my $HMCCUCHN_VERSION = '5.0 213201747'; ###################################################################### # Initialize module @@ -369,12 +369,14 @@ sub HMCCUCHN_Set ($@) if ($mode !~ /^(forceReset|reset|old|update)$/); my $rc = 0; my $retMsg = ''; + $hash->{hmccu}{setDefaults} = 1; # Make sure that readings are not refreshed after each set attribute command ($rc, $retMsg) = HMCCU_SetDefaultAttributes ($hash, { mode => $mode, role => undef, roleChn => undef }) if ($mode ne 'old'); if (!$rc) { $rc = HMCCU_SetDefaults ($hash); $retMsg .= $rc ? "\nSet version 4.3 attributes" : "\nNo version 4.3 default attributes found"; } $retMsg = 'OK' if ($retMsg eq ''); + $hash->{hmccu}{setDefaults} = 0; HMCCU_RefreshReadings ($hash) if ($rc); return HMCCU_SetError ($hash, $retMsg); } diff --git a/fhem/FHEM/88_HMCCUDEV.pm b/fhem/FHEM/88_HMCCUDEV.pm index 484b9a172..b12e40b7d 100644 --- a/fhem/FHEM/88_HMCCUDEV.pm +++ b/fhem/FHEM/88_HMCCUDEV.pm @@ -31,7 +31,7 @@ sub HMCCUDEV_Set ($@); sub HMCCUDEV_Get ($@); sub HMCCUDEV_Attr ($@); -my $HMCCUDEV_VERSION = '5.0 213171649'; +my $HMCCUDEV_VERSION = '5.0 213201747'; ###################################################################### # Initialize module @@ -380,7 +380,7 @@ sub HMCCUDEV_Attr ($@) } } } - + return; } @@ -456,12 +456,14 @@ sub HMCCUDEV_Set ($@) if ($mode !~ /^(forceReset|reset|old|update)$/); my $rc = 0; my $retMsg = ''; + $hash->{hmccu}{setDefaults} = 1; # Make sure that readings are not refreshed after each set attribute command ($rc, $retMsg) = HMCCU_SetDefaultAttributes ($hash, { mode => $mode, role => undef, roleChn => undef }) if ($mode ne 'old'); if (!$rc) { $rc = HMCCU_SetDefaults ($hash); $retMsg .= $rc ? "\nSet version 4.3 attributes" : "\nNo version 4.3 default attributes found"; } $retMsg = 'OK' if ($retMsg eq ''); + $hash->{hmccu}{setDefaults} = 0; HMCCU_RefreshReadings ($hash) if ($rc); return HMCCU_SetError ($hash, $retMsg); } diff --git a/fhem/FHEM/88_HMCCURPCPROC.pm b/fhem/FHEM/88_HMCCURPCPROC.pm index a2d68872a..9e86c31d4 100755 --- a/fhem/FHEM/88_HMCCURPCPROC.pm +++ b/fhem/FHEM/88_HMCCURPCPROC.pm @@ -39,7 +39,7 @@ require "$attr{global}{modpath}/FHEM/88_HMCCU.pm"; ###################################################################### # HMCCURPC version -my $HMCCURPCPROC_VERSION = '5.0 213171649'; +my $HMCCURPCPROC_VERSION = '5.0 213201747'; # Maximum number of events processed per call of Read() my $HMCCURPCPROC_MAX_EVENTS = 100;