diff --git a/fhem/CHANGED b/fhem/CHANGED index d92ac28b6..85009fd40 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: bugfixes and improvements - bugfix: 70_ESCVP21net: bugfixes - feature: 73_GardenaSmartBridge: asyncron response processing, no blocking if more then 3-4 devices diff --git a/fhem/FHEM/88_HMCCU.pm b/fhem/FHEM/88_HMCCU.pm index f1b882d56..49feec026 100755 --- a/fhem/FHEM/88_HMCCU.pm +++ b/fhem/FHEM/88_HMCCU.pm @@ -12,7 +12,7 @@ # CCU group devices, HomeGear, CUxD, Osram Lightify, Homematic Virtual Layer # and Philips Hue (not tested) # -# (c) 2021 by zap (zap01 t-online de) +# (c) 2022 by zap (zap01 t-online de) # ############################################################################## # @@ -57,7 +57,7 @@ my %HMCCU_CUST_CHN_DEFAULTS; my %HMCCU_CUST_DEV_DEFAULTS; # HMCCU version -my $HMCCU_VERSION = '5.0 220301356'; +my $HMCCU_VERSION = '5.0 220431743'; # Timeout for CCU requests (seconds) my $HMCCU_TIMEOUT_REQUEST = 4; @@ -2485,15 +2485,15 @@ sub HMCCU_ModifyReadingName ($$) my $f = 0; foreach my $rr (@$srl) { - my ($rold, $rnew) = split (':', $rr); - if (!defined ($rnew) || $rnew eq '') { - # Suppress reading - $f = 1; - next; - } - my @rnewList = split (',', $rnew); + my ($rold, $rnw) = split (':', $rr); + next if (!defined($rold) || $rold eq ''); if ($rn =~ /$rold/) { - foreach my $rnew (@rnewList) { + if (!defined ($rnw) || $rnw eq '') { + # Suppress reading + $f = 1; + next; + } + foreach my $rnew (split (',', $rnw)) { my $radd = $rn; if ($rnew =~ /^\+(.+)$/) { # Add new reading @@ -2718,10 +2718,14 @@ sub HMCCU_Log ($$$;$) if (ref($msg) eq 'ARRAY') { foreach my $m (@$msg) { + # Remove credentials from URLs + $m =~ s/(https?:\/\/)[^\@]+\@/$1/g; Log3 $logname, $level, "$type [$name] $m"; } } else { + # Remove credentials from URLs + $msg =~ s/(https?:\/\/)[^\@]+\@/$1/g; Log3 $logname, $level, "$type [$name] $msg"; } @@ -7837,8 +7841,11 @@ sub HMCCU_ExecuteGetParameterCommand ($@) my %objects; foreach my $a (@$addList) { - my $devDesc = HMCCU_GetDeviceDesc ($ioHash, $a, $clHash->{ccuif}) // return HMCCU_Log ( - $clHash, 2, "Can't get device description", undef); + my $devDesc = HMCCU_GetDeviceDesc ($ioHash, $a, $clHash->{ccuif}); + if (!defined($devDesc)) { + HMCCU_Log ($clHash, 2, "Can't get device description"); + return undef; + } my $paramset = $defParamset eq '' ? $devDesc->{PARAMSETS} : $defParamset; my ($da, $dc) = HMCCU_SplitChnAddr ($a, 'd'); @@ -10088,6 +10095,15 @@ sub HMCCU_Min ($$) { my ($a, $b) = @_; + if (!defined($a) || !defined($b)) { + HMCCU_Log (undef, 2, "Argument not defined in HMCCU_Min ".stacktraceAsString(undef)); + return 0; + } + if (!HMCCU_IsFltNum($a) || !HMCCU_IsFltNum($b)) { + HMCCU_Log (undef, 2, "Argument $a or $b isn't numeric in HMCCU_Min ".stacktraceAsString(undef)); + return 0; + } + return $a < $b ? $a : $b; } @@ -10095,6 +10111,15 @@ sub HMCCU_Max ($$) { my ($a, $b) = @_; + if (!defined($a) || !defined($b)) { + HMCCU_Log (undef, 2, "Argument not defined in HMCCU_Min ".stacktraceAsString(undef)); + return 0; + } + if (!HMCCU_IsFltNum($a) || !HMCCU_IsFltNum($b)) { + HMCCU_Log (undef, 2, "Argument $a or $b isn't numeric in HMCCU_Max ".stacktraceAsString(undef)); + return 0; + } + return $a > $b ? $a : $b; } @@ -10537,7 +10562,7 @@ sub HMCCU_BitsToStr ($$) sub HMCCU_AdjustValue ($$$) { - my ($value, $low, $high); + my ($value, $low, $high) = @_;; return $low if ($value < $low); return $high if ($value > $high); diff --git a/fhem/FHEM/88_HMCCUCHN.pm b/fhem/FHEM/88_HMCCUCHN.pm index 7f84093a0..ce7e151ef 100644 --- a/fhem/FHEM/88_HMCCUCHN.pm +++ b/fhem/FHEM/88_HMCCUCHN.pm @@ -6,7 +6,7 @@ # # Version 5.0 # -# (c) 2021 zap (zap01 t-online de) +# (c) 2022 zap (zap01 t-online de) # ###################################################################### # Client device for Homematic channels. @@ -19,7 +19,7 @@ use strict; use warnings; use SetExtensions; -require "$attr{global}{modpath}/FHEM/88_HMCCU.pm"; +# require "$attr{global}{modpath}/FHEM/88_HMCCU.pm"; sub HMCCUCHN_Initialize ($); sub HMCCUCHN_Define ($@); @@ -30,7 +30,7 @@ sub HMCCUCHN_Set ($@); sub HMCCUCHN_Get ($@); sub HMCCUCHN_Attr ($@); -my $HMCCUCHN_VERSION = '5.0 220301356'; +my $HMCCUCHN_VERSION = '5.0 220431743'; ###################################################################### # Initialize module diff --git a/fhem/FHEM/88_HMCCUDEV.pm b/fhem/FHEM/88_HMCCUDEV.pm index 91445d2cb..f7414bfec 100644 --- a/fhem/FHEM/88_HMCCUDEV.pm +++ b/fhem/FHEM/88_HMCCUDEV.pm @@ -6,7 +6,7 @@ # # Version 5.0 # -# (c) 2021 zap (zap01 t-online de) +# (c) 2022 zap (zap01 t-online de) # ###################################################################### # Client device for Homematic devices. @@ -20,7 +20,7 @@ use warnings; # use Data::Dumper; use SetExtensions; -require "$attr{global}{modpath}/FHEM/88_HMCCU.pm"; +# require "$attr{global}{modpath}/FHEM/88_HMCCU.pm"; sub HMCCUDEV_Initialize ($); sub HMCCUDEV_Define ($@); @@ -31,7 +31,7 @@ sub HMCCUDEV_Set ($@); sub HMCCUDEV_Get ($@); sub HMCCUDEV_Attr ($@); -my $HMCCUDEV_VERSION = '5.0 220301356'; +my $HMCCUDEV_VERSION = '5.0 220431743'; ###################################################################### # Initialize module @@ -719,12 +719,12 @@ sub HMCCUDEV_Get ($@) commands are allowed:

    -
  • text1-3=Text - Content of display line 2-4
  • -
  • icon1-3=IconCode - Icons of display line 2-4
  • -
  • sound=SoundCode - Sound
  • -
  • signal=SignalCode - Optical signal
  • -
  • pause=Seconds - Pause between signals (1-160)
  • -
  • repeat=Count - Repeat count for sound (0-15)
  • +
  • text1-3:Text - Content of display line 2-4
  • +
  • icon1-3:IconCode - Icons of display line 2-4
  • +
  • sound:SoundCode - Sound
  • +
  • signal:SignalCode - Optical signal
  • +
  • pause:Seconds - Pause between signals (1-160)
  • +
  • repeat:Count - Repeat count for sound (0-15)

IconCode := ico_off, ico_on, ico_open, ico_closed, ico_error, ico_ok, ico_info, @@ -734,7 +734,7 @@ sub HMCCUDEV_Get ($@) snd_long

Example:
- set HM_EPDISP datapoint 3.SUBMIT "text1:Line2,text2:Has Blank,text3:10:05:21,sound:snd_short,signal:sig_red + set HM_EPDISP datapoint 3.SUBMIT text1:Line2,text2:Has Blank,text3:10:05:21,sound:snd_short,signal:sig_red diff --git a/fhem/FHEM/88_HMCCURPCPROC.pm b/fhem/FHEM/88_HMCCURPCPROC.pm index 220708dcf..56dc9dabd 100755 --- a/fhem/FHEM/88_HMCCURPCPROC.pm +++ b/fhem/FHEM/88_HMCCURPCPROC.pm @@ -17,7 +17,7 @@ # RPC::XML::Client # RPC::XML::Server # -# ND deaktiviert in Read und Write!! +# ND deactivated in Read and Write!! ############################################################################## @@ -31,7 +31,7 @@ use RPC::XML::Client; use RPC::XML::Server; use SetExtensions; -require "$attr{global}{modpath}/FHEM/88_HMCCU.pm"; +# require "$attr{global}{modpath}/FHEM/88_HMCCU.pm"; ###################################################################### @@ -39,7 +39,7 @@ require "$attr{global}{modpath}/FHEM/88_HMCCU.pm"; ###################################################################### # HMCCURPC version -my $HMCCURPCPROC_VERSION = '5.0 220301356'; +my $HMCCURPCPROC_VERSION = '5.0 220431743'; # Maximum number of events processed per call of Read() my $HMCCURPCPROC_MAX_EVENTS = 100; @@ -1001,17 +1001,23 @@ sub HMCCURPCPROC_ProcessEvent ($$) # Detect event type and clkey my ($et, $clkey, $evdata) = split (/\|/, $event, 3); - return HMCCU_Log ($hash, 2, "Syntax error in RPC event data $event", undef) - if (!defined($evdata)); + + if (!defined($evdata)) { + HMCCU_Log ($hash, 2, "Syntax error in RPC event data $event"); + return undef; + } # Check for valid server - return HMCCU_Log ($hash, 2, "Received $et event for unknown RPC server $clkey", undef) - if ($clkey ne $rpcname); + if ($clkey ne $rpcname) { + HMCCU_Log ($hash, 2, "Received $et event for unknown RPC server $clkey"); + return undef; + } # Check event type if (!exists ($rpceventargs{$et})) { $et =~ s/([\x00-\xFF])/sprintf("0x%X ",ord($1))/eg; - return HMCCU_Log ($hash, 2, "Received unknown event from CCU: $et", undef); + HMCCU_Log ($hash, 2, "Received unknown event from CCU: $et"); + return undef; } # Parse event @@ -1019,8 +1025,10 @@ sub HMCCURPCPROC_ProcessEvent ($$) my $tc = scalar(@t); # Check event parameters - return HMCCU_Log ($hash, 2, "Wrong number of $tc parameters in event $event. Expected ". - $rpceventargs{$et}, undef) if ($tc != $rpceventargs{$et}); + if ($tc != $rpceventargs{$et}) { + HMCCU_Log ($hash, 2, "Wrong number of $tc parameters in event $event. Expected ".$rpceventargs{$et}); + return undef; + } # Update statistic counters $rh->{rec}{$et}++; @@ -1061,7 +1069,8 @@ sub HMCCURPCPROC_ProcessEvent ($$) return ($et, $clkey, ($srun == 0 ? 1 : 0), $srun); } else { - return HMCCU_Log ($hash, 0, "Received SL event. Wrong PID=".$t[0]." for RPC server $clkey", undef); + HMCCU_Log ($hash, 0, "Received SL event. Wrong PID=".$t[0]." for RPC server $clkey"); + return undef; } } elsif ($et eq 'IN') { @@ -1454,15 +1463,19 @@ sub HMCCURPCPROC_InitRPCServer ($$$$) if ($prot eq 'B') { $server->{__daemon} = IO::Socket::INET->new (LocalPort => $cbPort, Type => SOCK_STREAM, Reuse => 1, Listen => SOMAXCONN); - return HMCCU_Log ($name, 1, "Can't create RPC callback server $clkey. Port $cbPort in use?", undef) - if (!($server->{__daemon})); + if (!($server->{__daemon})) { + HMCCU_Log ($name, 1, "Can't create RPC callback server $clkey. Port $cbPort in use?"); + return undef; + } return $server; } # Create XML RPC server $server = RPC::XML::Server->new (port => $cbPort); - return HMCCU_Log ($name, 1, "Can't create RPC callback server $clkey. Port $cbPort in use?", undef) - if (!ref($server)); + if (!ref($server)) { + HMCCU_Log ($name, 1, "Can't create RPC callback server $clkey. Port $cbPort in use?"); + return undef; + } HMCCU_Log ($name, 2, "Callback server $clkey created. Listening on port $cbPort"); # Callback for events diff --git a/fhem/FHEM/HMCCUConf.pm b/fhem/FHEM/HMCCUConf.pm index b4cf85908..89ff051d6 100644 --- a/fhem/FHEM/HMCCUConf.pm +++ b/fhem/FHEM/HMCCUConf.pm @@ -8,7 +8,7 @@ # # Configuration parameters for HomeMatic devices. # -# (c) 2021 by zap (zap01 t-online de) +# (c) 2022 by zap (zap01 t-online de) # ######################################################################### @@ -208,6 +208,9 @@ $HMCCU_CONFIG_VERSION = '5.0'; 'THERMALCONTROL_TRANSMIT' => { F => 3, S => 'ACTUAL_TEMPERATURE', C => 'SET_TEMPERATURE', V => 'on:30.5,off:4.5', P => 2 }, + 'TILT_SENSOR' => { + F => 3, S => 'STATE', C => '', V => '', P => 1 + }, 'VIRTUAL_KEY' => { F => 3, S => 'PRESS_SHORT', C => 'PRESS_SHORT', V => 'pressed:true', P => 1 },