mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-20 07:16:03 +00:00
98_WeekdayTimer: 'state' inactive if disabled (#133492) + another try to fix holiday bug
git-svn-id: https://svn.fhem.de/fhem/trunk@27586 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
c87a771b34
commit
80ca7208ea
@ -1,4 +1,4 @@
|
|||||||
# $Id$
|
# $Id$we Beta-User $
|
||||||
#############################################################################
|
#############################################################################
|
||||||
#
|
#
|
||||||
# 98_WeekdayTimer.pm
|
# 98_WeekdayTimer.pm
|
||||||
@ -1308,7 +1308,7 @@ sub getDaysAsHash {
|
|||||||
################################################################################
|
################################################################################
|
||||||
sub getDaysAsCondition {
|
sub getDaysAsCondition {
|
||||||
my $tage = shift;
|
my $tage = shift;
|
||||||
my $overrulewday = shift // 0;
|
my $overrulewday = shift;
|
||||||
|
|
||||||
my %days = map {$_ => 1} @{$tage};
|
my %days = map {$_ => 1} @{$tage};
|
||||||
|
|
||||||
@ -1316,7 +1316,7 @@ sub getDaysAsCondition {
|
|||||||
my $notWe = $days{8}; delete $days{8}; #!$we
|
my $notWe = $days{8}; delete $days{8}; #!$we
|
||||||
|
|
||||||
my $tageExp = 'defined $days->{$wday}';
|
my $tageExp = 'defined $days->{$wday}';
|
||||||
$tageExp .= ' && !$we' if $overrulewday;
|
$tageExp .= ' && !$we' if defined $overrulewday;
|
||||||
$tageExp .= ' || $we' if defined $we;
|
$tageExp .= ' || $we' if defined $we;
|
||||||
$tageExp .= ' || !$we' if defined $notWe;
|
$tageExp .= ' || !$we' if defined $notWe;
|
||||||
return $tageExp;
|
return $tageExp;
|
||||||
@ -1327,11 +1327,11 @@ sub Attr {
|
|||||||
my ($cmd, $name, $attrName, $attrVal) = @_;
|
my ($cmd, $name, $attrName, $attrVal) = @_;
|
||||||
$attrVal = 0 if !defined $attrVal;
|
$attrVal = 0 if !defined $attrVal;
|
||||||
|
|
||||||
my $hash = $defs{$name};
|
my $hash = $defs{$name} // return 'error: device not defined!';
|
||||||
if ( $attrName eq 'WDT_eventMap' ) {
|
if ( $attrName eq 'WDT_eventMap' ) {
|
||||||
if($cmd eq 'set') {
|
if($cmd eq 'set') {
|
||||||
my @ret = split m{[: \r\n]}x, $attrVal;
|
my @ret = split m{[: \r\n]}x, $attrVal;
|
||||||
return "WDT_eventMap: Odd number of elements" if int(@ret) % 2;
|
return 'WDT_eventMap: Odd number of elements' if int(@ret) % 2;
|
||||||
my %ret = @ret;
|
my %ret = @ret;
|
||||||
for (keys %ret) {
|
for (keys %ret) {
|
||||||
$ret{$_} =~ s{\+}{ }gxms;
|
$ret{$_} =~ s{\+}{ }gxms;
|
||||||
@ -1341,22 +1341,22 @@ sub Attr {
|
|||||||
delete $hash->{WDT_EVENTMAP};
|
delete $hash->{WDT_EVENTMAP};
|
||||||
}
|
}
|
||||||
$attr{$name}{$attrName} = $attrVal;
|
$attr{$name}{$attrName} = $attrVal;
|
||||||
return if (!$init_done);
|
return if !$init_done;
|
||||||
return WDT_Start($hash);
|
return WDT_Start($hash);
|
||||||
}
|
}
|
||||||
return if !$init_done;
|
return if !$init_done;
|
||||||
if( $attrName eq 'disable' ) {
|
if( $attrName eq 'disable' ) {
|
||||||
_DeleteTimer($hash);
|
_DeleteTimer($hash);
|
||||||
###RemoveInternalTimer($fnHash);
|
|
||||||
readingsSingleUpdate ($hash, 'disabled', $attrVal, 1);
|
readingsSingleUpdate ($hash, 'disabled', $attrVal, 1);
|
||||||
$attr{$name}{$attrName} = $attrVal;
|
$attr{$name}{$attrName} = $attrVal;
|
||||||
return RemoveInternalTimer($hash,\&WDT_SetTimerOfDay) if $attrVal;
|
if ( $attrVal ) {
|
||||||
|
readingsSingleUpdate ($hash, 'state', 'inactive', 1);
|
||||||
|
return RemoveInternalTimer($hash,\&WDT_SetTimerOfDay);
|
||||||
|
}
|
||||||
return WDT_Start($hash);
|
return WDT_Start($hash);
|
||||||
#return WDT_SetTimerOfDay( { HASH => $hash} ) if !$attrVal;
|
|
||||||
}
|
}
|
||||||
if ( $attrName eq 'weekprofile' ) {
|
if ( $attrName eq 'weekprofile' ) {
|
||||||
$attr{$name}{$attrName} = $attrVal;
|
$attr{$name}{$attrName} = $attrVal;
|
||||||
#return WDT_Start($hash);
|
|
||||||
}
|
}
|
||||||
if ( $attrName eq 'switchInThePast' ) {
|
if ( $attrName eq 'switchInThePast' ) {
|
||||||
$attr{$name}{$attrName} = $attrVal;
|
$attr{$name}{$attrName} = $attrVal;
|
||||||
@ -1385,7 +1385,6 @@ sub Attr {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
sub WeekdayTimer_SetParm {
|
sub WeekdayTimer_SetParm {
|
||||||
my $name = shift // return;
|
my $name = shift // return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user