diff --git a/fhem/FHEM/59_Twilight.pm b/fhem/FHEM/59_Twilight.pm index 0206d87ee..ceb68b5d4 100644 --- a/fhem/FHEM/59_Twilight.pm +++ b/fhem/FHEM/59_Twilight.pm @@ -361,8 +361,10 @@ sub Twilight_fireEvent($) my $nextEvent = $hash->{TW}{$sx}{NEXTE}; my $nextEventTime = "undefined"; - $nextEventTime = strftime("%H:%M:%S",localtime($hash->{TW}{$nextEvent}{TIME})) if ($hash->{TW}{$nextEvent}{TIME} ne "nan"); - Log3 $hash, 4, "[".$hash->{NAME}."] " . sprintf ("%-10s state=%-2s light=%-2s nextEvent=%-10s %-14s deg=%+.1f°",$sx, $state, $light, $nextEvent, strftime("%d.%m.%Y %H:%M:%S",localtime($hash->{TW}{$nextEvent}{TIME})), $deg); + if ($hash->{TW}{$nextEvent}{TIME} ne "nan") { + $nextEventTime = strftime("%H:%M:%S",localtime($hash->{TW}{$nextEvent}{TIME})); + Log3 $hash, 4, "[".$hash->{NAME}."] " . sprintf ("%-10s state=%-2s light=%-2s nextEvent=%-10s %-14s deg=%+.1f°",$sx, $state, $light, $nextEvent, strftime("%d.%m.%Y %H:%M:%S",localtime($hash->{TW}{$nextEvent}{TIME})), $deg); + } my $eventTime = $hash->{TW}{$sx}{TIME}; my $now = time(); diff --git a/fhem/FHEM/98_Heating_Control.pm b/fhem/FHEM/98_Heating_Control.pm index b6d0606d2..7dafd777d 100644 --- a/fhem/FHEM/98_Heating_Control.pm +++ b/fhem/FHEM/98_Heating_Control.pm @@ -39,14 +39,34 @@ sub Heating_Control_Initialize($) } # Consumer + $hash->{SetFn} = "Heating_Control_Set"; $hash->{DefFn} = "Heating_Control_Define"; $hash->{UndefFn} = "Heating_Control_Undef"; $hash->{GetFn} = "Heating_Control_Get"; + $hash->{AttrFn} = "Heating_Control_Attr"; $hash->{UpdFn} = "Heating_Control_Update"; $hash->{AttrList}= "disable:0,1 windowSensor ". $readingFnAttributes; } ################################################################################ +sub Heating_Control_Set($@) { + my ($hash, @a) = @_; + return "no set value specified" if(int(@a) < 2); + return "Unknown argument $a[1], choose one of enable/disable refresh" if($a[1] eq "?"); + + my $name = shift @a; + my $v = join(" ", @a); + + Log3 $hash, 3, "[$name] set $name $v"; + + if ($v eq "enable") { + fhem("attr $name disable 1"); + } elsif ($v eq "disable") { + fhem("attr $name disable 1"); + } + return undef; +} +################################################################################ sub Heating_Control_Get($@) { my ($hash, @a) = @_; @@ -461,7 +481,7 @@ sub Heating_Control_Device_Schalten($$$$) { my $mod = "[".$hash->{NAME} ."] "; ### #modifier des Zieldevices auswaehlen - my $setModifier = isHeizung($hash); + my $setModifier = Heating_Control_isHeizung($hash); # Kommando aufbauen if (defined $hash->{helper}{CONDITION}) { @@ -513,7 +533,17 @@ sub Heating_Control_Device_Schalten($$$$) { } } ######################################################################## -sub isHeizung($) { +sub Heating_Control_Attr($$$) { + my ($cmd, $name, $attrName, $attrVal) = @_; + + if( $attrName eq "disable" ) { + my $hash = $defs{$name}; + readingsSingleUpdate ($hash, "disabled", $attrVal, 1); + } + return undef; +} +######################################################################## +sub Heating_Control_isHeizung($) { my ($hash) = @_; my %setmodifiers = @@ -532,8 +562,8 @@ sub isHeizung($) { "HM-CC-RT-DN" => 1 } ); my $dHash = $defs{$hash->{DEVICE}}; ### my $dType = $dHash->{TYPE}; - Log3 $hash, 5, "dType------------>$dType"; return "" if (!defined($dType)); + Log3 $hash, 5, "dType------------>$dType"; my $setModifier = $setmodifiers{$dType}; $setModifier = "" if (!defined($setModifier)); @@ -654,6 +684,49 @@ sub SortNumber { by well-known Block with {}.
Note: if a command is defined only this command are executed. In case of executing a "set desired-temp" command, you must define it explicitly.
+ + + +
  • in the command section you can access the event: +
  • + +
  • Note: the following is deprecated and will be removed in a future + release. The described replacement is attempted if none of the above + variables ($NAME/$EVENT/etc) found in the command. +
  • + + + The following parameter are replaced:
    1. @ => the device to switch
    2. @@ -806,7 +879,22 @@ sub SortNumber { - Set
      + Set + + set <name> <value> +

      + where value is one of:
      +
      +    enable                # enables  the Heating_Control
      +    disable               # disables the Heating_Control
      +    
      + + Examples: + + Get
      diff --git a/fhem/FHEM/98_WeekdayTimer.pm b/fhem/FHEM/98_WeekdayTimer.pm index ec5dd1230..3bb9f7ffd 100644 --- a/fhem/FHEM/98_WeekdayTimer.pm +++ b/fhem/FHEM/98_WeekdayTimer.pm @@ -25,8 +25,7 @@ package main; use strict; use warnings; use POSIX; - -##################################### +######################################################################## sub WeekdayTimer_Initialize($) { my ($hash) = @_; @@ -37,6 +36,8 @@ sub WeekdayTimer_Initialize($) } # Consumer + $hash->{SetFn} = "WeekdayTimer_Set"; + $hash->{AttrFn} = "WeekdayTimer_Attr"; $hash->{DefFn} = "WeekdayTimer_Define"; $hash->{UndefFn} = "WeekdayTimer_Undef"; $hash->{GetFn} = "WeekdayTimer_Get"; @@ -44,12 +45,21 @@ sub WeekdayTimer_Initialize($) $hash->{AttrList}= "disable:0,1 ". $readingFnAttributes; } - +################################################################################ +sub WeekdayTimer_Set($@) { + my ($hash, @a) = @_; + return "no set value specified" if(int(@a) < 2); + return "Unknown argument $a[1], choose one of enable/disable refresh" if($a[1] eq "?"); + + Heating_Control_Set($@); + + return undef; +} +######################################################################## sub WeekdayTimer_Get($@) { return Heating_Control_Get($@); } - - +######################################################################## sub WeekdayTimer_Define($$){ my ($hash, $def) = @_; @@ -57,22 +67,32 @@ sub WeekdayTimer_Define($$){ $hash->{helper}{DESIRED_TEMP_READING} = ""; return $ret; } - +######################################################################## sub WeekdayTimer_Undef($$){ my ($hash, $arg) = @_; return Heating_Control_Undef($hash, $arg); } - +######################################################################## sub WeekdayTimer_UpdatePerlTime($) { my ($hash) = @_; Heating_Control_UpdatePerlTime($hash); } - +######################################################################## sub WeekdayTimer_Update($){ my ($hash) = @_; return Heating_Control_Update($hash); } -# +######################################################################## +sub WeekdayTimer_Attr($$$) { + my ($cmd, $name, $attrName, $attrVal) = @_; + + if( $attrName eq "disable" ) { + my $hash = $defs{$name}; + readingsSingleUpdate ($hash, "disabled", $attrVal, 1); + } + return undef; +} +######################################################################## sub WeekdayTimer_SetAllParms() { # {WeekdayTimer_SetAllParms()} foreach my $hc ( sort keys %{$modules{WeekdayTimer}{defptr}} ) { @@ -169,7 +189,22 @@ sub WeekdayTimer_SetAllParms() { # {WeekdayTimer_SetAllParms()} - Set
      + Set + + set <name> <value> +

      + where value is one of:
      +
      +    disable               # disables the Weekday_Timer
      +    enable                # enables  the Weekday_Timer
      +    
      + + Examples: + + Get