diff --git a/fhem/CHANGED b/fhem/CHANGED index 08ed0b132..1f676b78f 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. + - feature: 98_RandomTimer: Add execNow option - change: 93_DbRep: minor internal code chane, commandref revised - bugfix: 73_AutoShuttersControl: fix selfdefense bug - bugfix: 73_AutoShuttersControl: fix time format problem diff --git a/fhem/FHEM/98_RandomTimer.pm b/fhem/FHEM/98_RandomTimer.pm index c6f4f16fb..383cbb819 100644 --- a/fhem/FHEM/98_RandomTimer.pm +++ b/fhem/FHEM/98_RandomTimer.pm @@ -36,6 +36,7 @@ sub RandomTimer_Initialize($); sub RandomTimer_Define($$); sub RandomTimer_Undef($$); +sub RandomTimer_Set($@); sub RandomTimer_Attr($$$); sub RandomTimer_addDays ($$); @@ -64,6 +65,7 @@ sub RandomTimer_Initialize($) { $hash->{DefFn} = "RandomTimer_Define"; $hash->{UndefFn} = "RandomTimer_Undef"; + $hash->{SetFn} = "RandomTimer_Set"; $hash->{AttrFn} = "RandomTimer_Attr"; $hash->{AttrList} = "onCmd offCmd switchmode disable:0,1 disableCond disableCondCmd:none,offCmd,onCmd ". "runonce:0,1 keepDeviceAlive:0,1 forceStoptimeSameDay:0,1 ". @@ -152,6 +154,28 @@ sub RandomTimer_Attr($$$) { return undef; } +sub RandomTimer_Set($@) { + my ($hash, @a) = @_; + + return "no set value specified" if(int(@a) < 2); + return "Unknown argument $a[1], choose one of execNow:noArg" if($a[1] eq "?"); + + my $name = shift @a; + my $v = join(" ", @a); + + if ($v eq "execNow") { + Log3 ($hash, 3, "[$name] set $name $v"); + if (AttrVal($name, "disable", 0)) { + Log3 ($hash, 3, "[$name] is disabled, set execNow not possible"); + } else { + RandomTimer_RemoveInternalTimer("Exec", $hash); + RandomTimer_InternalTimer("Exec", time()+1, "RandomTimer_Exec", $hash, 0); + } + } + return undef; +} + + # module Fn ################################################################### sub RandomTimer_addDays ($$) { my ($now, $days) = @_; @@ -603,7 +627,19 @@ sub RandomTimer_GetHashIndirekt ($$) { -
+ +
+
+ +