mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-28 05:01:57 +00:00
fhem.pl: add -temporary option to the define command (Forum #39610)
git-svn-id: https://svn.fhem.de/fhem/trunk@9118 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
07bb31b3c5
commit
6182d2fb3f
@ -732,7 +732,7 @@ The following local attributes are used by a wider range of devices:
|
|||||||
<a name="define"></a>
|
<a name="define"></a>
|
||||||
<h3>define</h3>
|
<h3>define</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<code>define <name> <type> <type-specific></code><br>
|
<code>define [option] <name> <type> <type-specific></code><br>
|
||||||
<br>
|
<br>
|
||||||
Define a device. You need devices if you want to manipulate them (e.g.
|
Define a device. You need devices if you want to manipulate them (e.g.
|
||||||
set on/off), and the logfile is also more readable if it contains e.g.
|
set on/off), and the logfile is also more readable if it contains e.g.
|
||||||
@ -744,6 +744,19 @@ The following local attributes are used by a wider range of devices:
|
|||||||
Each device takes different additional arguments at definition, see the
|
Each device takes different additional arguments at definition, see the
|
||||||
corresponding device section for details.<br>
|
corresponding device section for details.<br>
|
||||||
<br>
|
<br>
|
||||||
|
Options:<br>
|
||||||
|
<ul>
|
||||||
|
<li>-temporary<br>
|
||||||
|
Add the TEMPORARY flag to the definition, which will prevent saving the
|
||||||
|
device to fhem.cfg.
|
||||||
|
</li><br>
|
||||||
|
<li>-ignoreErr<br>
|
||||||
|
Reduce the number of errors displayed when a certain FHEM-module cannot
|
||||||
|
be loaded. Used by fhem.cfg.demo, as using the RSS example requires the
|
||||||
|
installation of several uncommon perl modules.
|
||||||
|
</li><br>
|
||||||
|
</ul>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<a name="defmod"></a>
|
<a name="defmod"></a>
|
||||||
|
@ -760,7 +760,7 @@ Die folgenden lokalen Attribute werden von mehreren Geräten verwendet:
|
|||||||
<a name="define"></a>
|
<a name="define"></a>
|
||||||
<h3>define</h3>
|
<h3>define</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<code>define <name> <type> <type-specific></code><br>
|
<code>define [option] <name> <type> <type-specific></code><br>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
Definiert ein Gerät. Sie müssen Geräte einrichten um sie zu
|
Definiert ein Gerät. Sie müssen Geräte einrichten um sie zu
|
||||||
@ -773,7 +773,19 @@ Die folgenden lokalen Attribute werden von mehreren Geräten verwendet:
|
|||||||
|
|
||||||
Je nach Typ benötigt man unterscheidliche Argumente, lesen Sie sich
|
Je nach Typ benötigt man unterscheidliche Argumente, lesen Sie sich
|
||||||
bitte die zu dem jeweiligen Gerät gehörenden Abschnitte durch.
|
bitte die zu dem jeweiligen Gerät gehörenden Abschnitte durch.
|
||||||
<br>
|
<br><br>
|
||||||
|
Optionen:<br>
|
||||||
|
<ul>
|
||||||
|
<li>-temporary<br>
|
||||||
|
Setzt den TEMPORARY Marker, was das Abspeichern dieser Definition in
|
||||||
|
fhem.cfg verhindert.
|
||||||
|
</li><br>
|
||||||
|
<li>-ignoreErr<br>
|
||||||
|
Reduziert die Anzahl der Fehlermeldungen, falls ein FHEM-Modul nicht
|
||||||
|
geladen werden kann. Wird in fhem.cfg.demo verwendet, da das RSS Beispiel
|
||||||
|
etliche, normalerweise nicht installierte perl-Module benötigt.
|
||||||
|
</li><br>
|
||||||
|
</ul>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<a name="defmod"></a>
|
<a name="defmod"></a>
|
||||||
|
@ -1627,7 +1627,7 @@ CommandDefine($$)
|
|||||||
{
|
{
|
||||||
my ($cl, $def) = @_;
|
my ($cl, $def) = @_;
|
||||||
my @a = split("[ \t]+", $def, 3);
|
my @a = split("[ \t]+", $def, 3);
|
||||||
my $ignoreErr;
|
my ($ignoreErr, $temporary);
|
||||||
|
|
||||||
# used by RSS in fhem.cfg.demo, with no GD installed
|
# used by RSS in fhem.cfg.demo, with no GD installed
|
||||||
if($a[0] && $a[0] eq "-ignoreErr") {
|
if($a[0] && $a[0] eq "-ignoreErr") {
|
||||||
@ -1635,6 +1635,12 @@ CommandDefine($$)
|
|||||||
@a = split("[ \t][ \t]*", $def, 3);
|
@a = split("[ \t][ \t]*", $def, 3);
|
||||||
$ignoreErr = 1;
|
$ignoreErr = 1;
|
||||||
}
|
}
|
||||||
|
if($a[0] && $a[0] eq "-temporary") { # Forum #39610
|
||||||
|
$def =~ s/\s*-temporary\s*//;
|
||||||
|
@a = split("[ \t][ \t]*", $def, 3);
|
||||||
|
$temporary = 1;
|
||||||
|
}
|
||||||
|
|
||||||
my $name = $a[0];
|
my $name = $a[0];
|
||||||
return "Usage: define <name> <type> <type dependent arguments>"
|
return "Usage: define <name> <type> <type dependent arguments>"
|
||||||
if(int(@a) < 2);
|
if(int(@a) < 2);
|
||||||
@ -1679,6 +1685,7 @@ CommandDefine($$)
|
|||||||
delete $attr{$name};
|
delete $attr{$name};
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
$hash{TEMPORARY} = 1 if($temporary);
|
||||||
foreach my $da (sort keys (%defaultattr)) { # Default attributes
|
foreach my $da (sort keys (%defaultattr)) { # Default attributes
|
||||||
CommandAttr($cl, "$name $da $defaultattr{$da}");
|
CommandAttr($cl, "$name $da $defaultattr{$da}");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user