2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-05-02 06:55:26 +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 605ea92344
commit 51b313cf45
2 changed files with 45 additions and 1 deletions

View File

@ -213,6 +213,7 @@ MQTT2_SERVER_Set($@)
{ {
my ($hash, @a) = @_; my ($hash, @a) = @_;
my %sets = ( publish=>":textField,[-r] topic message", my %sets = ( publish=>":textField,[-r] topic message",
reopen=>":noArg",
clearRetain=>":noArg" ); clearRetain=>":noArg" );
shift(@a); shift(@a);
@ -238,7 +239,18 @@ MQTT2_SERVER_Set($@)
delete($hash->{READINGS}{$rname}); delete($hash->{READINGS}{$rname});
delete($hash->{retain}); delete($hash->{retain});
return undef; 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 sub
@ -786,6 +798,11 @@ MQTT2_SERVER_ReadDebug($$)
<li>clearRetain<br> <li>clearRetain<br>
delete all the retained topics. delete all the retained topics.
</li> </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> </ul>
<br> <br>

View File

@ -3463,7 +3463,10 @@ sub
FW_Set($@) FW_Set($@)
{ {
my ($hash, @a) = @_; my ($hash, @a) = @_;
my %cmd = ("rereadicons" => ":noArg", "clearSvgCache" => ":noArg"); my %cmd = ("clearSvgCache" => ":noArg",
"reopen" => ":noArg",
"rereadicons" => ":noArg");
if(AttrVal($hash->{NAME}, "rescueDialog", "")) { if(AttrVal($hash->{NAME}, "rescueDialog", "")) {
$cmd{"rescueStart"} = ""; $cmd{"rescueStart"} = "";
$cmd{"rescueTerminate"} = ":noArg"; $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") { if($a[1] eq "rescueStart") {
return "error: rescueStart needs two arguments: host and port" return "error: rescueStart needs two arguments: host and port"
if(!$a[2] || !$a[3] || $a[3] !~ m/[0-9]{1,5}/ || $a[3] > 65536); 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> <a id="FHEMWEB-set"></a>
<b>Set</b> <b>Set</b>
<ul> <ul>
<a id="FHEMWEB-set-rereadicons"></a>
<li>rereadicons<br> <li>rereadicons<br>
reads the names of the icons from the icon path. Use after adding or reads the names of the icons from the icon path. Use after adding or
deleting icons. deleting icons.
</li> </li>
<a id="FHEMWEB-set-clearSvgCache"></a>
<li>clearSvgCache<br> <li>clearSvgCache<br>
delete all files found in the www/SVGcache directory, which is used to delete all files found in the www/SVGcache directory, which is used to
cache SVG data, if the SVGcache attribute is set. cache SVG data, if the SVGcache attribute is set.
</li> </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> </ul>
<br> <br>
@ -4514,15 +4534,22 @@ FW_log($$)
<a id="FHEMWEB-set"></a> <a id="FHEMWEB-set"></a>
<b>Set</b> <b>Set</b>
<ul> <ul>
<a id="FHEMWEB-set-rereadicons"></a>
<li>rereadicons<br> <li>rereadicons<br>
Damit wird die Liste der Icons neu eingelesen, f&uuml;r den Fall, dass Damit wird die Liste der Icons neu eingelesen, f&uuml;r den Fall, dass
Sie Icons l&ouml;schen oder hinzuf&uuml;gen. Sie Icons l&ouml;schen oder hinzuf&uuml;gen.
</li> </li>
<a id="FHEMWEB-set-clearSvgCache"></a>
<li>clearSvgCache<br> <li>clearSvgCache<br>
Im Verzeichnis www/SVGcache werden SVG Daten zwischengespeichert, wenn Im Verzeichnis www/SVGcache werden SVG Daten zwischengespeichert, wenn
das Attribut SVGcache gesetzt ist. Mit diesem Befehl leeren Sie diesen das Attribut SVGcache gesetzt ist. Mit diesem Befehl leeren Sie diesen
Zwischenspeicher. Zwischenspeicher.
</li> </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> </ul>
<br> <br>