mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
60_Watches.pm: contrib 0.27.0
git-svn-id: https://svn.fhem.de/fhem/trunk@22590 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
6a309f1dd3
commit
dd28a852dc
@ -75,7 +75,7 @@ BEGIN {
|
|||||||
|
|
||||||
# Versions History intern
|
# Versions History intern
|
||||||
my %vNotesIntern = (
|
my %vNotesIntern = (
|
||||||
"0.27.0" => "12.08.2020 control buttons, new attr hideButtons, controlButtonSize, ".
|
"0.27.0" => "12.08.2020 control buttons, new attr hideButtons, controlButtonSize, some more changes according PBP".
|
||||||
"fix Random triggering of alarm or random time display at start / resume ",
|
"fix Random triggering of alarm or random time display at start / resume ",
|
||||||
"0.26.0" => "01.08.2020 add attr timeAsReading -> write into reading 'currtime' if time is displayed, ".
|
"0.26.0" => "01.08.2020 add attr timeAsReading -> write into reading 'currtime' if time is displayed, ".
|
||||||
"add \$readingFnAttributes, set release_status to stable ",
|
"add \$readingFnAttributes, set release_status to stable ",
|
||||||
@ -132,6 +132,9 @@ my %hset = ( #
|
|||||||
displayTextDel => {fn => "_setDisplayTextDel" },
|
displayTextDel => {fn => "_setDisplayTextDel" },
|
||||||
displayTextSet => {fn => "_setDisplayTextSet" },
|
displayTextSet => {fn => "_setDisplayTextSet" },
|
||||||
stop => {fn => "_setStop" },
|
stop => {fn => "_setStop" },
|
||||||
|
resume => {fn => "_setResume" },
|
||||||
|
countDownInit => {fn => "_setCountDownInit" },
|
||||||
|
alarmDel => {fn => "_setAlarmDel" },
|
||||||
);
|
);
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
@ -242,6 +245,7 @@ sub Set { ## no critic 'compl
|
|||||||
prop => $prop,
|
prop => $prop,
|
||||||
prop1 => $prop1,
|
prop1 => $prop1,
|
||||||
prop2 => $prop2,
|
prop2 => $prop2,
|
||||||
|
addp => $addp,
|
||||||
aref => \@a,
|
aref => \@a,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -275,22 +279,51 @@ sub Set { ## no critic 'compl
|
|||||||
readingsSingleUpdate($hash, "alarmed", 0, 0);
|
readingsSingleUpdate($hash, "alarmed", 0, 0);
|
||||||
readingsSingleUpdate($hash, "alarmTime", $at, 1);
|
readingsSingleUpdate($hash, "alarmTime", $at, 1);
|
||||||
|
|
||||||
} elsif ($opt eq "alarmDel") {
|
} else {
|
||||||
|
return "$setlist";
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# Setter alarmDel
|
||||||
|
################################################################
|
||||||
|
sub _setAlarmDel { ## no critic "not used"
|
||||||
|
my $paref = shift;
|
||||||
|
my $name = $paref->{name};
|
||||||
|
|
||||||
delReadings ($name, "alarmTime");
|
delReadings ($name, "alarmTime");
|
||||||
delReadings ($name, "alarmed");
|
delReadings ($name, "alarmed");
|
||||||
|
|
||||||
} elsif ($opt eq "countDownInit") {
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# Setter countDownInit
|
||||||
|
################################################################
|
||||||
|
sub _setCountDownInit { ## no critic "not used"
|
||||||
|
my $paref = shift;
|
||||||
|
my $hash = $paref->{hash};
|
||||||
|
my $name = $paref->{name};
|
||||||
|
my $opt = $paref->{opt};
|
||||||
|
my $prop = $paref->{prop};
|
||||||
|
my $prop1 = $paref->{prop1};
|
||||||
|
my $prop2 = $paref->{prop2};
|
||||||
|
|
||||||
my $ct;
|
my $ct;
|
||||||
|
my $msg = qq{The value for "$opt" is invalid. Use parameter "hh mm ss" like "19 45 13" \nor alternatively only one entry in seconds.};
|
||||||
|
|
||||||
if($prop && $prop1) { # Format: hh mm ss
|
if($prop && $prop1) { # Format: hh mm ss
|
||||||
$prop2 = ($prop2 ne "") ? $prop2 : 70; # Sekunden
|
$prop2 = defined $prop2 ? $prop2 : 70; # Sekunden
|
||||||
return qq{The value for "$opt" is invalid. Use parameter "hh mm ss" like "19 45 13" \nor alternatively only one entry in seconds.} if($prop>23 || $prop1>59 || $prop2>59);
|
return $msg if($prop>23 || $prop1>59 || $prop2>59);
|
||||||
$ct = $prop*3600 + $prop1*60 + $prop2; # in Sekunden umgewandelt !
|
$ct = $prop*3600 + $prop1*60 + $prop2; # in Sekunden umgewandelt !
|
||||||
|
|
||||||
} elsif ($prop && !$prop1) { # Format: Sekundenangabe
|
} elsif ($prop && !$prop1) { # Format: Sekundenangabe
|
||||||
$ct = $prop;
|
$ct = $prop;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return qq{The value for "$opt" is invalid. Use parameter "hh mm ss" like "19 45 13" \nor alternatively only one entry in seconds.};
|
return $msg;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -301,7 +334,18 @@ sub Set { ## no critic 'compl
|
|||||||
readingsBulkUpdate ($hash, "state", "initialized");
|
readingsBulkUpdate ($hash, "state", "initialized");
|
||||||
readingsEndUpdate ($hash, 1);
|
readingsEndUpdate ($hash, 1);
|
||||||
|
|
||||||
} elsif ($opt eq "resume") {
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# Setter resume
|
||||||
|
################################################################
|
||||||
|
sub _setResume { ## no critic "not used"
|
||||||
|
my $paref = shift;
|
||||||
|
my $hash = $paref->{hash};
|
||||||
|
my $name = $paref->{name};
|
||||||
|
my $addp = $paref->{addp};
|
||||||
|
|
||||||
return qq{Please set "countDownInit" before !} if($addp =~ /countdownwatch/x && !ReadingsVal($name, "countInitVal", ""));
|
return qq{Please set "countDownInit" before !} if($addp =~ /countdownwatch/x && !ReadingsVal($name, "countInitVal", ""));
|
||||||
return if(ReadingsVal($name, "state", "") eq "started");
|
return if(ReadingsVal($name, "state", "") eq "started");
|
||||||
|
|
||||||
@ -309,10 +353,6 @@ sub Set { ## no critic 'compl
|
|||||||
readingsSingleUpdate($hash, "starttime", $ms, 0);
|
readingsSingleUpdate($hash, "starttime", $ms, 0);
|
||||||
readingsSingleUpdate($hash, "state", "resumed", 1);
|
readingsSingleUpdate($hash, "state", "resumed", 1);
|
||||||
|
|
||||||
} else {
|
|
||||||
return "$setlist";
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user