diff --git a/fhem/CHANGED b/fhem/CHANGED index dddbc623e..ebce34f26 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -570,3 +570,4 @@ - bugfix: dummy/structure was listed twice in list and xmllist - feature: 11_FHT.pm added new readings for warnings on battery, lowtemp, window and windowsensor (M.Fischer) + - feature: on-for-timer added for X10 modules (Boris) \ No newline at end of file diff --git a/fhem/FHEM/20_X10.pm b/fhem/FHEM/20_X10.pm index c303fca0f..f333491e0 100755 --- a/fhem/FHEM/20_X10.pm +++ b/fhem/FHEM/20_X10.pm @@ -74,6 +74,7 @@ my %functions_set = ( "on" => 0, "dimup" => 1, "dimdown" => 1, "on-till" => 1, + "on-for-timer" => 1, ); @@ -102,7 +103,7 @@ X10_Initialize($) $hash->{DefFn} = "X10_Define"; $hash->{UndefFn} = "X10_Undef"; $hash->{ParseFn} = "X10_Parse"; - $hash->{AttrList} = "IODev follow-on-for-timer:1,0 do_not_notify:1,0 " . + $hash->{AttrList} = "IODev do_not_notify:1,0 " . "dummy:1,0 showtime:1,0 model:lm12,lm15,am12,tm13 " . "loglevel:0,1,2,3,4,5,6"; @@ -134,9 +135,38 @@ X10_Do_On_Till($@) return ""; } + if($modules{X10}{ldata}{$a[0]}) { + CommandDelete(undef, $a[0] . "_timer"); + delete $modules{FS20}{ldata}{$a[0]}; + } + $modules{X10}{ldata}{$a[0]} = "$hms_till"; + my @b = ($a[0], "on"); X10_Set($hash, @b); - CommandDefine(undef, $hash->{NAME} . "_till at $hms_till set $a[0] off"); + CommandDefine(undef, $hash->{NAME} . "_timer at $hms_till set $a[0] off"); + +} +############################# +sub +X10_Do_On_For_Timer($@) +{ + my ($hash, @a) = @_; + return "Timespec (HH:MM[:SS]) needed for the on-for-timer command" if(@a != 3); + + my ($err, $hr, $min, $sec, $fn) = GetTimeSpec($a[2]); + return $err if($err); + + my $hms_for_timer = sprintf("+%02d:%02d:%02d", $hr, $min, $sec); + + if($modules{X10}{ldata}{$a[0]}) { + CommandDelete(undef, $a[0] . "_timer"); + delete $modules{FS20}{ldata}{$a[0]}; + } + $modules{X10}{ldata}{$a[0]} = "$hms_for_timer"; + + my @b = ($a[0], "on"); + X10_Set($hash, @b); + CommandDefine(undef, $hash->{NAME} . "_timer at $hms_for_timer set $a[0] off"); } @@ -195,6 +225,11 @@ X10_Set($@) # special for on-till return X10_Do_On_Till($hash, @a) if($function eq "on-till"); + # special for on-for-timer + return X10_Do_On_For_Timer($hash, @a) if($function eq "on-for-timer"); + + + # argument evaluation my $model= $hash->{MODEL}; diff --git a/fhem/HISTORY b/fhem/HISTORY index 2727e62f6..3fce8eef0 100644 --- a/fhem/HISTORY +++ b/fhem/HISTORY @@ -446,9 +446,9 @@ KS300 CUL_WS CUL_EM X10. - Mon Nov 16 2009 (MartinH) - - pgm3: Google-Weather-Api added. Display of all Logs including the - FS20-devices (grep on fhem.log) The status of the batteries of FHT and HMS - are shown in the graphics. php4 disabled. Now only php5 is supported. A + - pgm3: Google-Weather-Api added. Display of all Logs including the + FS20-devices (grep on fhem.log) The status of the batteries of FHT and HMS + are shown in the graphics. php4 disabled. Now only php5 is supported. A lot of examples of the UserDefs are added. The pgm3-section of fhem.html was changed. @@ -472,3 +472,6 @@ Webcam and Google-Weather. Output of html better formated and skinable -- change the colors. +- Sat Feb 6 2010 (Boris) + - feature: on-for-timer added for X10 modules and bug fixed for overlapping + on-till and on-for-timer commands (Boris) \ No newline at end of file diff --git a/fhem/docs/commandref.html b/fhem/docs/commandref.html index d400e2f05..822713cf9 100644 --- a/fhem/docs/commandref.html +++ b/fhem/docs/commandref.html @@ -500,7 +500,7 @@ A line ending with \ will be concatenated with the next one, so long lines <devspec>.
If value is specified, then output this property (like DEF, TYPE, etc) or - reading (actuator, measured-temp) for all devices from the devspec. + reading (actuator, measured-temp) for all devices from the devspec.

Example:
  fhem> list
@@ -788,7 +788,7 @@ A line ending with \ will be concatenated with the next one, so long lines
   
Examples:
Notes: @@ -2359,6 +2361,10 @@ A line ending with \ will be concatenated with the next one, so long lines command is ignored, else an "on" command is generated, and for the given "till-time" an off command is scheduleld via the at command. +
  • on-for-timer requires a relative time in the "at" format + (HH:MM:SS, HH:MM) or { <perl code> }, where the perl code + returns a time specification). +

  • @@ -2367,11 +2373,10 @@ A line ending with \ will be concatenated with the next one, so long lines Attributes @@ -3094,7 +3099,7 @@ audio Note:
    If the owserver-ip:port is called none, then - no device will be opened, so you can experiment without hardware attached.

    + no device will be opened, so you can experiment without hardware attached.

    Example: Note:
    - Currently supported type: DS18S20.

    + Currently supported type: DS18S20.

    Example:
    - + Get
    Attributes