2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-08 07:24:21 +00:00

MQTT2_SERVER/FHEMWEB: add reopen command (Forum #129788)

git-svn-id: https://svn.fhem.de/fhem/trunk@26581 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2022-10-24 13:43:17 +00:00
parent b3d5b71348
commit ceac5cb48a
2 changed files with 45 additions and 1 deletions

View File

@ -213,6 +213,7 @@ MQTT2_SERVER_Set($@)
{
my ($hash, @a) = @_;
my %sets = ( publish=>":textField,[-r] topic message",
reopen=>":noArg",
clearRetain=>":noArg" );
shift(@a);
@ -238,7 +239,18 @@ MQTT2_SERVER_Set($@)
delete($hash->{READINGS}{$rname});
delete($hash->{retain});
return undef;
} elsif($a[0] eq "reopen") {
TcpServer_Close($hash);
delete($hash->{stacktrace});
my ($port, $global) = split("[ \t]+", $hash->{DEF});
my $ret = TcpServer_Open($hash, $port, $global);
return $ret if($ret);
TcpServer_SetSSL($hash) if(AttrVal($hash->{NAME}, "SSL", 0));
return undef;
}
}
sub
@ -786,6 +798,11 @@ MQTT2_SERVER_ReadDebug($$)
<li>clearRetain<br>
delete all the retained topics.
</li>
<a id="MQTT2_SERVER-set-reopen"></a>
<li>reopen<br>
reopen the server port. This is an alternative to restart FHEM when
the SSL certificate is replaced.
</li>
</ul>
<br>

View File

@ -3463,7 +3463,10 @@ sub
FW_Set($@)
{
my ($hash, @a) = @_;
my %cmd = ("rereadicons" => ":noArg", "clearSvgCache" => ":noArg");
my %cmd = ("clearSvgCache" => ":noArg",
"reopen" => ":noArg",
"rereadicons" => ":noArg");
if(AttrVal($hash->{NAME}, "rescueDialog", "")) {
$cmd{"rescueStart"} = "";
$cmd{"rescueTerminate"} = ":noArg";
@ -3492,6 +3495,16 @@ FW_Set($@)
}
}
if($a[1] eq "reopen") {
TcpServer_Close($hash);
delete($hash->{stacktrace});
my ($port, $global) = split("[ \t]+", $hash->{DEF});
my $ret = TcpServer_Open($hash, $port, $global);
return $ret if($ret);
TcpServer_SetSSL($hash) if(AttrVal($hash->{NAME}, "SSL", 0));
return undef;
}
if($a[1] eq "rescueStart") {
return "error: rescueStart needs two arguments: host and port"
if(!$a[2] || !$a[3] || $a[3] !~ m/[0-9]{1,5}/ || $a[3] > 65536);
@ -3705,14 +3718,21 @@ FW_log($$)
<a id="FHEMWEB-set"></a>
<b>Set</b>
<ul>
<a id="FHEMWEB-set-rereadicons"></a>
<li>rereadicons<br>
reads the names of the icons from the icon path. Use after adding or
deleting icons.
</li>
<a id="FHEMWEB-set-clearSvgCache"></a>
<li>clearSvgCache<br>
delete all files found in the www/SVGcache directory, which is used to
cache SVG data, if the SVGcache attribute is set.
</li>
<a id="FHEMWEB-set-reopen"></a>
<li>reopen<br>
reopen the server port. This is an alternative to restart FHEM when
the SSL certificate is replaced.
</li>
</ul>
<br>
@ -4514,15 +4534,22 @@ FW_log($$)
<a id="FHEMWEB-set"></a>
<b>Set</b>
<ul>
<a id="FHEMWEB-set-rereadicons"></a>
<li>rereadicons<br>
Damit wird die Liste der Icons neu eingelesen, f&uuml;r den Fall, dass
Sie Icons l&ouml;schen oder hinzuf&uuml;gen.
</li>
<a id="FHEMWEB-set-clearSvgCache"></a>
<li>clearSvgCache<br>
Im Verzeichnis www/SVGcache werden SVG Daten zwischengespeichert, wenn
das Attribut SVGcache gesetzt ist. Mit diesem Befehl leeren Sie diesen
Zwischenspeicher.
</li>
<a id="FHEMWEB-set-reopen"></a>
<li>reopen<br>
Schlie&szlig;t und &ouml;ffnet der Serverport. Das kann eine Alternative
zu FHEM-Neustart sein, wenn das SSL-Zertifikat sich ge&auml;ndert hat.
</li>
</ul>
<br>