2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-12 22:56:34 +00:00

feature: on-for-timer added for X10 modules

git-svn-id: https://svn.fhem.de/fhem/trunk@571 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
borisneubert 2010-02-06 17:07:09 +00:00
parent 382f0f9d0f
commit 44768e110f
4 changed files with 66 additions and 22 deletions

View File

@ -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)

View File

@ -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};

View File

@ -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)

View File

@ -1521,7 +1521,7 @@ A line ending with \ will be concatenated with the next one, so long lines
<a name="CUL_FHTTK"></a>
<h3>CUL_FHTTK</h3>
<ul>
This module handles messages from the FHT80 TF "Fenster-Tür-Kontakt" (Window-Door-Contact)
This module handles messages from the FHT80 TF "Fenster-T<EFBFBD>r-Kontakt" (Window-Door-Contact)
which are normally only acted upon by the <a href="#FHT">FHT80B</a>. With this module,
FHT80 TFs are in a limited way (see <a href="http://fhz4linux.info/tiki-index.php?page=FHT+protocol">Wiki</a>
for detailed explanation of TF's mode of operation) usable similar to HMS100 TFK. The name
@ -2322,6 +2322,7 @@ A line ending with \ will be concatenated with the next one, so long lines
off
on
on-till # Special, see the note
on-for-timer # Special, see the note
</pre>
Examples:
<ul>
@ -2329,6 +2330,7 @@ A line ending with \ will be concatenated with the next one, so long lines
<code>set lamp1,lamp2 off</code><br>
<code>set pump off</code><br>
<code>set lamp2 on-till 19:59</code><br>
<code>set lamp2 on-for-timer 00:02:30</code><br>
</ul>
<br>
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.
</li>
<li><code>on-for-timer</code> requires a relative time in the "at" format
(HH:MM:SS, HH:MM) or { &lt;perl code&gt; }, where the perl code
returns a time specification).
</li>
</ul>
</ul>
<br>
@ -2367,11 +2373,10 @@ A line ending with \ will be concatenated with the next one, so long lines
<b>Attributes</b>
<ul>
<li><a href="#follow-on-for-timer">follow-on-for-timer</a></li><br>
<li><a href="#do_not_notify">do_not_notify</a></li><br>
<li><a href="#attrdummy">dummy</a></li><br>
<li><a href="#showtime">showtime</a></li><br>
<li><a href="#model">model</a> (lm12,lm15,am12,tm13)</li><br>
<li><a href="#do_not_notify">do_not_notify</a></li>
<li><a href="#attrdummy">dummy</a></li>
<li><a href="#showtime">showtime</a></li>
<li><a href="#model">model</a> (lm12,lm15,am12,tm13)</li>
<li><a href="#loglevel">loglevel</a></li>
<li><a href="#IODev">IODev</a></li><br>
</ul>