2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-28 11:01:59 +00:00

98_PID20.pm: remove smartmatch issues

git-svn-id: https://svn.fhem.de/fhem/trunk@28751 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
betateilchen 2024-04-05 10:18:01 +00:00
parent d1b0253d17
commit e1584846b2

View File

@ -100,14 +100,11 @@ package main;
use strict; use strict;
use warnings; use warnings;
no if $] >= 5.017011, warnings => 'experimental';
use feature qw/say switch/;
use vars qw(%defs); use vars qw(%defs);
use vars qw($readingFnAttributes); use vars qw($readingFnAttributes);
use vars qw(%modules); use vars qw(%modules);
my $PID20_Version = "1.0.0.9"; my $PID20_Version = "1.0.0.10";
sub PID20_Calc($); sub PID20_Calc($);
######################################## ########################################
sub PID20_Log($$$) sub PID20_Log($$$)
@ -383,14 +380,9 @@ sub PID20_Set($@)
my $desiredName = lc( AttrVal( $name, 'pidDesiredName', 'desired' ) ); my $desiredName = lc( AttrVal( $name, 'pidDesiredName', 'desired' ) );
#PID20_Log $hash, 3, "name:$name cmd:$cmd $desired:$desired"; #PID20_Log $hash, 3, "name:$name cmd:$cmd $desired:$desired";
given ($cmd) if ($cmd eq '?') {
{
when ('?')
{
return $usage; return $usage;
} } elsif ($cmd eq $desiredName) {
when ($desiredName)
{
return "Set " . AttrVal( $name, 'pidDesiredName', 'desired' ) . " needs a <value> parameter" return "Set " . AttrVal( $name, 'pidDesiredName', 'desired' ) . " needs a <value> parameter"
if ( @a != 3 ); if ( @a != 3 );
my $value = $a[2]; my $value = $a[2];
@ -399,23 +391,17 @@ sub PID20_Set($@)
if ( !defined($value) ); if ( !defined($value) );
readingsSingleUpdate( $hash, $cmd, $value, 1 ); readingsSingleUpdate( $hash, $cmd, $value, 1 );
PID20_Log $hash, 3, "set $name $cmd $a[2]"; PID20_Log $hash, 3, "set $name $cmd $a[2]";
} } elsif ($cmd eq 'start') {
when ('start')
{
return 'Set start needs a <value> parameter' return 'Set start needs a <value> parameter'
if ( @a != 2 ); if ( @a != 2 );
$hash->{helper}{stopped} = 0; $hash->{helper}{stopped} = 0;
PID20_RestartTimer($hash,1); PID20_RestartTimer($hash,1);
} } elsif ($cmd eq 'stop') {
when ('stop')
{
return 'Set stop needs a <value> parameter' return 'Set stop needs a <value> parameter'
if ( @a != 2 ); if ( @a != 2 );
$hash->{helper}{stopped} = 1; $hash->{helper}{stopped} = 1;
PID20_RestartTimer($hash,1); PID20_RestartTimer($hash,1);
} } elsif ($cmd eq 'restart') {
when ('restart')
{
return 'Set restart needs a <value> parameter' return 'Set restart needs a <value> parameter'
if ( @a != 3 ); if ( @a != 3 );
my $value = $a[2]; my $value = $a[2];
@ -428,16 +414,11 @@ sub PID20_Set($@)
$hash->{helper}{adjust} = $value; $hash->{helper}{adjust} = $value;
PID20_RestartTimer($hash,1); PID20_RestartTimer($hash,1);
PID20_Log $hash, 3, "set $name $cmd $value"; PID20_Log $hash, 3, "set $name $cmd $value";
} } elsif ($cmd eq 'calc') {
when ("calc") # inofficial function, only for debugging purposes
{
PID20_Calc($name); PID20_Calc($name);
} } else {
default
{
return $usage; return $usage;
} }
}
return; return;
} }
######################################## ########################################