diff --git a/fhem/CHANGED b/fhem/CHANGED
index dff3ba9d9..f16ce0bef 100644
--- a/fhem/CHANGED
+++ b/fhem/CHANGED
@@ -1,5 +1,7 @@
# 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 option to change behavior
+ when disable cond. ends (forum #14010, msg. 970714)
- change: 70_ONKYO_AVR: deleting attribute 'model'
- bugfix: 98_weekprofile: time calculation for HM
- bugfix: 49_SSCam: FHEM crash when sending data by telegramBot Forum:#105486
diff --git a/fhem/FHEM/98_RandomTimer.pm b/fhem/FHEM/98_RandomTimer.pm
index 5320120d7..c6f4f16fb 100644
--- a/fhem/FHEM/98_RandomTimer.pm
+++ b/fhem/FHEM/98_RandomTimer.pm
@@ -41,6 +41,7 @@ sub RandomTimer_Attr($$$);
sub RandomTimer_addDays ($$);
sub RandomTimer_device_switch ($);
sub RandomTimer_device_toggle ($);
+sub RandomTimer_disableDown($);
sub RandomTimer_down($);
sub RandomTimer_Exec($);
sub RandomTimer_getSecsToNextAbschaltTest($);
@@ -64,7 +65,7 @@ sub RandomTimer_Initialize($) {
$hash->{DefFn} = "RandomTimer_Define";
$hash->{UndefFn} = "RandomTimer_Undef";
$hash->{AttrFn} = "RandomTimer_Attr";
- $hash->{AttrList} = "onCmd offCmd switchmode disable:0,1 disableCond ".
+ $hash->{AttrList} = "onCmd offCmd switchmode disable:0,1 disableCond disableCondCmd:none,offCmd,onCmd ".
"runonce:0,1 keepDeviceAlive:0,1 forceStoptimeSameDay:0,1 ".
$readingFnAttributes;
}
@@ -203,13 +204,27 @@ sub RandomTimer_device_toggle ($) {
}
}
+sub RandomTimer_disableDown($) {
+ my ($hash) = @_;
+ my $disableCondCmd = AttrVal($hash->{NAME}, "disableCondCmd", 0);
+
+ if ($disableCondCmd ne "none") {
+ Log3 $hash, 4, "[".$hash->{NAME}."]"." setting requested disableCondCmd on $hash->{DEVICE}: ";
+ $hash->{COMMAND} = AttrVal($hash->{NAME}, "disableCondCmd", 0) eq "onCmd" ? "on" : "off";
+ RandomTimer_device_switch($hash);
+ } else {
+ Log3 $hash, 4, "[".$hash->{NAME}."]"." no action requested on $hash->{DEVICE}: ";
+ }
+}
+
sub RandomTimer_down($) {
my ($hash) = @_;
-
+ Log3 $hash, 4, "[".$hash->{NAME}."]"." setting requested keepDeviceAlive on $hash->{DEVICE}: ";
$hash->{COMMAND} = AttrVal($hash->{NAME}, "keepDeviceAlive", 0) ? "on" : "off";
RandomTimer_device_switch($hash);
}
+
sub RandomTimer_Exec($) {
my ($myHash) = @_;
@@ -226,16 +241,16 @@ sub RandomTimer_Exec($) {
if ($active) {
# wenn temporär ausgeschaltet
if ($disabled) {
- Log3 $hash, 3, "[".$hash->{NAME}."]"." ending RandomTimer on $hash->{DEVICE}: "
+ Log3 $hash, 3, "[".$hash->{NAME}."]"." disabled before stop-time , ending RandomTimer on $hash->{DEVICE}: "
. strftime("%H:%M:%S(%d)",localtime($hash->{helper}{startTime})) . " - "
. strftime("%H:%M:%S(%d)",localtime($hash->{helper}{stopTime}));
- RandomTimer_down($hash);
+ RandomTimer_disableDown($hash);
RandomTimer_setActive($hash,0);
RandomTimer_setState ($hash);
}
# Wenn aktiv und Abschaltzeit erreicht, dann Gerät ausschalten, Meldung ausgeben und Timer schließen
if ($stopTimeReached) {
- Log3 $hash, 3, "[".$hash->{NAME}."]"." ending RandomTimer on $hash->{DEVICE}: "
+ Log3 $hash, 3, "[".$hash->{NAME}."]"." stop-time reached, ending RandomTimer on $hash->{DEVICE}: "
. strftime("%H:%M:%S(%d)",localtime($hash->{helper}{startTime})) . " - "
. strftime("%H:%M:%S(%d)",localtime($hash->{helper}{stopTime}));
RandomTimer_down($hash);
@@ -614,12 +629,22 @@ sub RandomTimer_GetHashIndirekt ($$) {
keepDeviceAlive
attr ZufallsTimerZ keepDeviceAlive
disableCondCmd
attr ZufallsTimerZ disableCondCmd offCmd