mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +00:00
SetExtensions.pm: add on-till-overnight
git-svn-id: https://svn.fhem.de/fhem/trunk@9413 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
5e193e7c4b
commit
9cb802c0a5
10
fhem/CHANGED
10
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: on/off-till-overnight (SetExtensions.pm)
|
||||
- bugfix: 73_km200: Bugfix for freeze in "Sounding"
|
||||
- change: 93_DbLog: changed min/max val 999999 to system specific (~0 >> 1)
|
||||
- feature: HUEbridge: added get touchlink
|
||||
@ -16,7 +17,8 @@
|
||||
- change: 93_DbLog: removed string length limitation for SQLITE.
|
||||
- bugfix: 93_DbLog: fixed ploteditor bug when DbLogType=History.
|
||||
- feature: 93_DbLog: added new setter 'reduceLog' to clean up database.
|
||||
- feature: new Modules 36_EleroStick.pm and 36_EleroDrive.pm for Elero shutters
|
||||
- feature: new Modules 36_EleroStick.pm and 36_EleroDrive.pm for Elero
|
||||
shutters
|
||||
- change: 55_InfoPanel.pm: support ReadingsVal in ticker #35228
|
||||
- bugfix: 31_MilightDevice.pm: improved previousState, fixed log errors
|
||||
- bugfix: 30_MilightBridge.pm: fixed ping definition
|
||||
@ -37,9 +39,9 @@
|
||||
- bugfix: 00_MAXLAN: set time on cube if it has none (by Tom_S)
|
||||
- bugfix: 14_CUL_MAX: work together with a-culfw
|
||||
- bugfix: 70_PushNotifier: bugfix regex deviceID
|
||||
- feature: new Module 74_AMAD to request Information and control Android Devices
|
||||
in cooperation with AutomagicApp on the Device (Forum #39773)
|
||||
(by M. Oldenburg)
|
||||
- feature: new Module 74_AMAD to request Information and control Android
|
||||
Devices in cooperation with AutomagicApp on the Device (Forum
|
||||
#39773) (by M. Oldenburg)
|
||||
- bugfix: 70_PushNotifier.pm: regex error handling
|
||||
- bugfix: 31_MilightDevice.pm: fixed bug that lead to crash on lost bridge
|
||||
connection, added module name prefix to round function
|
||||
|
@ -16,13 +16,15 @@ SetExtensions($$@)
|
||||
return "Unknown argument $cmd, choose one of " if(!$list);
|
||||
|
||||
my %se_list = (
|
||||
"on-for-timer" => 1,
|
||||
"off-for-timer" => 1,
|
||||
"on-till" => 1,
|
||||
"off-till" => 1,
|
||||
"blink" => 2,
|
||||
"intervals" => 0,
|
||||
"toggle" => 0
|
||||
"on-for-timer" => 1,
|
||||
"off-for-timer" => 1,
|
||||
"on-till" => 1,
|
||||
"off-till" => 1,
|
||||
"on-till-overnight" => 1,
|
||||
"off-till-overnight"=> 1,
|
||||
"blink" => 2,
|
||||
"intervals" => 0,
|
||||
"toggle" => 0
|
||||
);
|
||||
|
||||
my $hasOn = ($list =~ m/(^| )on\b/);
|
||||
@ -54,8 +56,8 @@ SetExtensions($$@)
|
||||
return "$cmd requires $se_list{$cmd} parameter";
|
||||
}
|
||||
|
||||
my $cmd1 = ($cmd =~ m/on.*/ ? "on" : "off");
|
||||
my $cmd2 = ($cmd =~ m/on.*/ ? "off" : "on");
|
||||
my $cmd1 = ($cmd =~ m/^on.*/ ? "on" : "off");
|
||||
my $cmd2 = ($cmd =~ m/^on.*/ ? "off" : "on");
|
||||
my $param = $a[0];
|
||||
|
||||
if($cmd eq "on-for-timer" || $cmd eq "off-for-timer") {
|
||||
@ -67,20 +69,22 @@ SetExtensions($$@)
|
||||
InternalTimer(gettimeofday()+$param,"SetExtensionsFn","SE $name $cmd",0);
|
||||
}
|
||||
|
||||
} elsif($cmd eq "on-till" || $cmd eq "off-till") {
|
||||
} elsif($cmd =~ m/^(on|off)-till/) {
|
||||
my ($err, $hr, $min, $sec, $fn) = GetTimeSpec($param);
|
||||
return "$cmd: $err" if($err);
|
||||
|
||||
my $at = $name . "_till";
|
||||
CommandDelete(undef, $at) if($defs{$at});
|
||||
|
||||
my @lt = localtime;
|
||||
my $hms_till = sprintf("%02d:%02d:%02d", $hr, $min, $sec);
|
||||
my $hms_now = sprintf("%02d:%02d:%02d", $lt[2], $lt[1], $lt[0]);
|
||||
if($hms_now ge $hms_till) {
|
||||
Log3 $hash, 4,
|
||||
"$cmd: won't switch as now ($hms_now) is later than $hms_till";
|
||||
return "";
|
||||
if($cmd =~ m/-till$/) {
|
||||
my @lt = localtime;
|
||||
my $hms_now = sprintf("%02d:%02d:%02d", $lt[2], $lt[1], $lt[0]);
|
||||
if($hms_now ge $hms_till) {
|
||||
Log3 $hash, 4,
|
||||
"$cmd: won't switch as now ($hms_now) is later than $hms_till";
|
||||
return "";
|
||||
}
|
||||
}
|
||||
DoSet($name, $cmd1);
|
||||
CommandDefine(undef, "$at at $hms_till set $name $cmd2");
|
||||
|
@ -1139,9 +1139,23 @@ The following local attributes are used by a wider range of devices:
|
||||
Issue the on command for the device, and create an at definition with
|
||||
<timedet> (in the form HH:MM[:SS]) to set it off. This definition
|
||||
is visible, and its name is deviceName+"_till". To cancel the scheduled
|
||||
off, delete the at definition.</li>
|
||||
off, delete the at definition. Note: on-till is not active, if the
|
||||
specified time is after the current time, in order to make things like
|
||||
<ul><code>
|
||||
define morningLight at *06:00 set Lamp on-till {sunrise()}
|
||||
</code></ul>
|
||||
easy.</li>
|
||||
<li>on-till-overnight <timedet><br>
|
||||
Like on-till, but wont compare the current time with the timespec, so
|
||||
following will work:
|
||||
<ul><code>
|
||||
define nightLight at *{sunset()} set Lamp on-till-overnight 01:00
|
||||
</code></ul>
|
||||
</li>
|
||||
<li>off-till <timedet><br>
|
||||
see on-till above.</li>
|
||||
<li>off-till-overnight <timedet><br>
|
||||
see on-till-overnight above.</li>
|
||||
<li>blink <number> <blink-period><br>
|
||||
set the device on for <blink-period> then off for
|
||||
<blink-period> and repeat this <number> times.
|
||||
|
@ -1202,9 +1202,24 @@ Die folgenden lokalen Attribute werden von mehreren Geräten verwendet:
|
||||
definiert, um es um <timedet> (Format: HH:MM[:SS]) per off
|
||||
auszuschalten. Diese at Instanz ist sichtbar unter dem Namen
|
||||
geräteName+"_till". Um das Ausschalten zu deaktivieren
|
||||
löscht man diese at Definition. </li>
|
||||
löscht man diese at Definition. Achtung: das Ein/Ausschalten wird
|
||||
nicht durchgeführt, falls die aktuelle Uhrzeit nach der
|
||||
spezifizierten Zeit ist, um folgende Szenarien zu vereinfachen:
|
||||
<ul><code>
|
||||
define morningLight at *06:00 set Lamp on-till {sunrise()}
|
||||
</code></ul>
|
||||
</li>
|
||||
<li>on-till-overnight <timedet><br>
|
||||
Wie on-till, aber die aktuelle Uhrzeit wird nicht mit der
|
||||
Spezifizierten verglichen, damit folgendes funktioniert:
|
||||
<ul><code>
|
||||
define nightLight at *{sunset()} set Lamp on-till-overnight 01:00
|
||||
</code></ul>
|
||||
</li>
|
||||
<li>off-till <timedet><br>
|
||||
siehe on-till.</li>
|
||||
<li>off-till-overnight <timedet><br>
|
||||
siehe on-till-overnight.</li>
|
||||
<li>blink <anzahl> <blink-periode><br>
|
||||
Das Gerät wird mit "on" für die <blink-periode>
|
||||
eingeschaltet, und das wird nach <blink-periode> wiederholt. Um
|
||||
|
Loading…
Reference in New Issue
Block a user