Patch that fixes Perl Warnings when arguments for setExtensions blink command are missing.
2020.12.05 16:39:11 1: PERL WARNING: Use of uninitialized value $p2 in pattern match (m//) at FHEM/SetExtensions.pm line 155.
2020.12.05 16:39:11 1: PERL WARNING: Use of uninitialized value $p2 in concatenation (.) or string at FHEM/SetExtensions.pm line 164.
2020.12.05 16:39:11 1: PERL WARNING: Use of uninitialized value $p2 in addition (+) at FHEM/SetExtensions.pm line 169.
2020.12.05 17:02:57 1: PERL WARNING: Use of uninitialized value $param in pattern match (m//) at FHEM/SetExtensions.pm line 155.
--- - 2020-12-05 17:15:43.343935101 +0100
+++ /srv/fhem/FHEM/SetExtensions.pm 2020-12-05 17:14:03.174184585 +0100
@@ -153,13 +153,13 @@
} elsif($cmd eq "blink") {
my $p2 = $a[1];
return "$cmd requires 2 numbers as argument"
- if($param !~ m/^\d+$/ || $p2 !~ m/^\d*\.?\d*$/);
+ if(!defined($param) || !defined($p2) || $param !~ m/^\d+$/ || $p2 !~ m/^\d*\.?\d*$/);
if($param) {
delete($hash->{SetExtensionsCommand}) if($param == 1 && $a[2]);
SE_DoSet($name, $a[2] ? $offCmd : $onCmd);
$param-- if($a[2]);
- if($param) {
+ if($param && defined($p2)) {
$hash->{TIMED_OnOff} = {
START=>time(), START_FMT=>TimeNow(), DURATION=>$param,
CMD=>$cmd, NEXTCMD=>"$cmd $param $p2 ".($a[2] ? "0" : "1"),
The second part of this patch will never be reached in processing, because processing will be terminated if $p2 is not defined (see first part of your patch)
Yes, can be simplified indeed.
Thanks for the hint, I changed the code in order to avoid the warnings.