2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 03:06:37 +00:00

98_serviced: v1.2.8 - fix interval not starting after FHEM start, add attr disabledForIntervals, adapt new help format for commandref

git-svn-id: https://svn.fhem.de/fhem/trunk@24390 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
deespe 2021-05-06 22:25:17 +00:00
parent e859bdfced
commit 7663e4da33
2 changed files with 65 additions and 71 deletions

View File

@ -1,5 +1,8 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # 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. # Do not insert empty lines here, update check depends on it.
- bugfix: 98_serviced: interval not starting after FHEM start
- feature: 98_serviced: add attr disabledForIntervals
- change: 98_serviced: adapt new help format for commandref
- feature: 98_todoist: added title="<item>" option for addTask - feature: 98_todoist: added title="<item>" option for addTask
- bugfix: 10_WS980: v1.3.0 - fix invalid values like 0xffff - bugfix: 10_WS980: v1.3.0 - fix invalid values like 0xffff
- bugfix: 73_AutoShuttersControl: roolback fix #1149463 - bugfix: 73_AutoShuttersControl: roolback fix #1149463

View File

@ -16,7 +16,7 @@ use Blocking;
use Time::HiRes; use Time::HiRes;
use vars qw{%defs}; use vars qw{%defs};
my $servicedVersion = "1.2.7"; my $servicedVersion = "1.2.8";
sub serviced_shutdownwait($); sub serviced_shutdownwait($);
@ -31,6 +31,7 @@ sub serviced_Initialize($)
$hash->{ShutdownFn} = "serviced_Shutdown"; $hash->{ShutdownFn} = "serviced_Shutdown";
$hash->{UndefFn} = "serviced_Undef"; $hash->{UndefFn} = "serviced_Undef";
$hash->{AttrList} = "disable:1,0 ". $hash->{AttrList} = "disable:1,0 ".
"disabledForIntervals ".
"serviceAutostart ". "serviceAutostart ".
"serviceAutostop ". "serviceAutostop ".
"serviceGetStatusOnInit:0,1 ". "serviceGetStatusOnInit:0,1 ".
@ -76,8 +77,8 @@ sub serviced_Define($$)
$attr{$name}{homebridgeMapping} = "On=state,valueOff=/stopped|failed/,cmdOff=stop,cmdOn=start\n". $attr{$name}{homebridgeMapping} = "On=state,valueOff=/stopped|failed/,cmdOff=stop,cmdOn=start\n".
"StatusJammed=state,values=/error|failed/:JAMMED;/.*/:NOT_JAMMED"; "StatusJammed=state,values=/error|failed/:JAMMED;/.*/:NOT_JAMMED";
} }
readingsSingleUpdate($hash,"state","Initialized",1);
} }
readingsSingleUpdate($hash,"state","Initialized",1) if ($init_done);
return undef; return undef;
} }
@ -86,7 +87,7 @@ sub serviced_Undef($$)
my ($hash,$name) = @_; my ($hash,$name) = @_;
RemoveInternalTimer($hash); RemoveInternalTimer($hash);
BlockingKill($hash->{helper}{RUNNING_PID}) if ($hash->{helper}{RUNNING_PID}); BlockingKill($hash->{helper}{RUNNING_PID}) if ($hash->{helper}{RUNNING_PID});
return undef; return undef;
} }
sub serviced_Notify($$) sub serviced_Notify($$)
@ -99,10 +100,10 @@ sub serviced_Notify($$)
return if (!$events); return if (!$events);
if ($devname eq "global" && grep /^INITIALIZED$/,@{$events}) if ($devname eq "global" && grep /^INITIALIZED$/,@{$events})
{ {
if (AttrNum($name,"serviceGetStatusOnInit",1) && !AttrNum($name,"serviceStatusInterval",0)) if (AttrNum($name,"serviceGetStatusOnInit",1) || AttrNum($name,"serviceStatusInterval",0))
{ {
Log3 $name,3,"$name: get status of service \"$hash->{SERVICENAME}\" due to startup"; Log3 $name,4,"$name: get status of service \"$hash->{SERVICENAME}\" due to startup and/or interval";
serviced_Set($hash,$name,"status"); serviced_GetUpdate($hash);
} }
my $delay = AttrVal($name,"serviceAutostart",0); my $delay = AttrVal($name,"serviceAutostart",0);
$delay = $delay > 300 ? 300 : $delay; $delay = $delay > 300 ? 300 : $delay;
@ -464,13 +465,13 @@ sub serviced_shutdownwait($)
=item summary_DE lokale/entfernte Dienste Verwaltung =item summary_DE lokale/entfernte Dienste Verwaltung
=begin html =begin html
<a name="serviced"></a> <a id="serviced"></a>
<h3>serviced</h3> <h3>serviced</h3>
<ul> <ul>
With <i>serviced</i> you are able to control running services either running on localhost or a remote host.<br> With <i>serviced</i> you are able to control running services either running on localhost or a remote host.<br>
The usual command are available: start/restart/stop/status.<br> The usual command are available: start/restart/stop/status.<br>
<br> <br>
<a name="serviced_define"></a> <a id="serviced-define"></a>
<p><b>Define</b></p> <p><b>Define</b></p>
<ul> <ul>
<code>define &lt;name&gt; serviced &lt;service name&gt; [&lt;user@ip-address&gt;]</code><br> <code>define &lt;name&gt; serviced &lt;service name&gt; [&lt;user@ip-address&gt;]</code><br>
@ -506,127 +507,122 @@ sub serviced_shutdownwait($)
<br><br> <br><br>
If you have homebridgeMapping in your attributes an appropriate mapping will be added, genericDeviceType as well. If you have homebridgeMapping in your attributes an appropriate mapping will be added, genericDeviceType as well.
<br> <br>
<a name="serviced_set"></a> <a id="serviced-set"></a>
<p><b>Set</b></p> <p><b>Set</b></p>
<ul> <ul>
<li> <li>
<i>start</i><br> <a id="serviced-set-start">start</a><br>
start the stopped service start the stopped service
</li> </li>
<li> <li>
<i>stop</i><br> <a id="serviced-set-stop">stop</a><br>
stop the started service stop the started service
</li> </li>
<li> <li>
<i>restart</i><br> <a id="serviced-set-restart">restart</a><br>
restart the service restart the service
</li> </li>
<li> <li>
<i>status</i><br> <a id="serviced-set-status">status</a><br>
get status of service get status of service
</li> </li>
</ul> </ul>
<br> <br>
<a name="serviced_get"></a> <a id="serviced-get"></a>
<p><b>Get</b></p> <p><b>Get</b></p>
<ul> <ul>
<li> <li>
<i>status</i><br> <a id="serviced-get-status">status</a><br>
get status of service<br> get status of service<br>
same like 'set status' same like 'set status'
</li> </li>
</ul> </ul>
<br> <br>
<a name="serviced_attr"></a> <a id="serviced-attr"></a>
<p><b>Attributes</b></p> <p><b>Attributes</b></p>
<ul> <ul>
<li> <li>
<i>disable</i><br> <a id="serviced-attr-serviceAutostart">serviceAutostart</a><br>
stop polling and disable device completely<br>
default: 0
</li>
<li>
<i>serviceAutostart</i><br>
delay in seconds to automatically (re)start service after start of FHEM<br> delay in seconds to automatically (re)start service after start of FHEM<br>
default: default:
</li> </li>
<li> <li>
<i>serviceAutostop</i><br> <a id="serviced-attr-serviceAutostop">serviceAutostop</a><br>
timeout in seconds to automatically stop service while shutdown of FHEM<br> timeout in seconds to automatically stop service while shutdown of FHEM<br>
default: default:
</li> </li>
<li> <li>
<i>serviceGetStatusOnInit</i><br> <a id="serviced-attr-serviceGetStatusOnInit">serviceGetStatusOnInit</a><br>
get status of service automatically on FHEM start<br> get status of service automatically on FHEM start<br>
default: 1 default: 1
</li> </li>
<li> <li>
<i>serviceInitd</i><br> <a id="serviced-attr-serviceInitd">serviceInitd</a><br>
use initd (system) instead of systemd (systemctl)<br> use initd (system) instead of systemd (systemctl)<br>
default: 0 default: 0
</li> </li>
<li> <li>
<i>serviceLogin</i><br> <a id="serviced-attr-serviceLogin">serviceLogin</a><br>
ssh login string for services running on remote hosts<br> ssh login string for services running on remote hosts<br>
passwordless ssh is mandatory<br> passwordless ssh is mandatory<br>
default: default:
</li> </li>
<li> <li>
<i>servicePort</i><br> <a id="serviced-attr-servicePort">servicePort</a><br>
ssh port to use if other than default port (22)<br> ssh port to use if other than default port (22)<br>
default: 22 default: 22
</li> </li>
<li> <li>
<i>serviceRegexFailed</i><br> <a id="serviced-attr-serviceRegexFailed">serviceRegexFailed</a><br>
regex for failed status<br> regex for failed status<br>
default: dead|failed|exited default: dead|failed|exited
</li> </li>
<li> <li>
<i>serviceRegexStarted</i><br> <a id="serviced-attr-serviceRegexStarted">serviceRegexStarted</a><br>
regex for running status<br> regex for running status<br>
default: running|active default: running|active
</li> </li>
<li> <li>
<i>serviceRegexStarting</i><br> <a id="serviced-attr-serviceRegexStarting">serviceRegexStarting</a><br>
regex for starting status<br> regex for starting status<br>
default: activating|starting default: activating|starting
</li> </li>
<li> <li>
<i>serviceRegexStopped</i><br> <a id="serviced-attr-serviceRegexStopped">serviceRegexStopped</a><br>
regex for stopped status<br> regex for stopped status<br>
default: inactive|stopped default: inactive|stopped
</li> </li>
<li> <li>
<i>serviceStatusInterval</i><br> <a id="serviced-attr-serviceStatusInterval">serviceStatusInterval</a><br>
interval of getting status automatically<br> interval of getting status automatically<br>
default: default:
</li> </li>
<li> <li>
<i>serviceStatusLine</i><br> <a id="serviced-attr-serviceStatusLine">serviceStatusLine</a><br>
line number of status output containing the status information<br> line number of status output containing the status information<br>
default: 3 default: 3
</li> </li>
<li> <li>
<i>serviceSudo</i><br> <a id="serviced-attr-serviceSudo">serviceSudo</a><br>
use sudo<br> use sudo<br>
default: 1 default: 1
</li> </li>
</ul> </ul>
<br> <br>
<a name="serviced_read"></a> <a id="serviced-read"></a>
<p><b>Readings</b></p> <p><b>Readings</b></p>
<p>All readings updates will create events.</p> <p>All readings updates will create events.</p>
<ul> <ul>
<li> <li>
<i>error</i><br> <a id="serviced-read-error">error</a><br>
last occured error, none if no error occured<br> last occured error, none if no error occured<br>
</li> </li>
<li> <li>
<i>state</i><br> <a id="serviced-read-state">state</a><br>
current state current state
</li> </li>
<li> <li>
<i>status</i><br> <a id="serviced-read-status">status</a><br>
last status line from 'get/set status' last status line from 'get/set status'
</li> </li>
</ul> </ul>
@ -635,13 +631,13 @@ sub serviced_shutdownwait($)
=end html =end html
=begin html_DE =begin html_DE
<a name="serviced"></a> <a id="serviced"></a>
<h3>serviced</h3> <h3>serviced</h3>
<ul> <ul>
Mit <i>serviced</i> k&ouml;nnen lokale und entfernte Dienste verwaltet werden.<br> Mit <i>serviced</i> k&ouml;nnen lokale und entfernte Dienste verwaltet werden.<br>
Die &uuml;blichen Kommandos sind verf&uuml;gbar: start/restart/stop/status.<br> Die &uuml;blichen Kommandos sind verf&uuml;gbar: start/restart/stop/status.<br>
<br> <br>
<a name="serviced_define"></a> <a id="serviced-define"></a>
<p><b>Define</b></p> <p><b>Define</b></p>
<ul> <ul>
<code>define &lt;name&gt; serviced &lt;Dienst Name&gt; [&lt;user@ip-adresse&gt;]</code><br> <code>define &lt;name&gt; serviced &lt;Dienst Name&gt; [&lt;user@ip-adresse&gt;]</code><br>
@ -677,127 +673,122 @@ sub serviced_shutdownwait($)
<br><br> <br><br>
Wenn homebridgeMapping in der Attributliste ist, so wird ein entsprechendes Mapping hinzugef&uuml;gt, ebenso genericDeviceType. Wenn homebridgeMapping in der Attributliste ist, so wird ein entsprechendes Mapping hinzugef&uuml;gt, ebenso genericDeviceType.
<br> <br>
<a name="serviced_set"></a> <a id="serviced-set"></a>
<p><b>Set</b></p> <p><b>Set</b></p>
<ul> <ul>
<li> <li>
<i>start</i><br> <a id="serviced-set-start">start</a><br>
angehaltenen Dienst starten angehaltenen Dienst starten
</li> </li>
<li> <li>
<i>stop</i><br> <a id="serviced-set-stop">stop</a><br>
laufenden Dienst anhalten laufenden Dienst anhalten
</li> </li>
<li> <li>
<i>restart</i><br> <a id="serviced-set-restart">restart</a><br>
Dienst neu starten Dienst neu starten
</li> </li>
<li> <li>
<i>status</i><br> <a id="serviced-set-status">status</a><br>
Status des Dienstes abrufen Status des Dienstes abrufen
</li> </li>
</ul> </ul>
<br> <br>
<a name="serviced_get"></a> <a id="serviced-get"></a>
<p><b>Get</b></p> <p><b>Get</b></p>
<ul> <ul>
<li> <li>
<i>status</i><br> <a id="serviced-get-status">status</a><br>
Status des Dienstes abrufen<br> Status des Dienstes abrufen<br>
identisch zu 'set status' identisch zu 'set status'
</li> </li>
</ul> </ul>
<br> <br>
<a name="serviced_attr"></a> <a id="serviced-attr"></a>
<p><b>Attribute</b></p> <p><b>Attribute</b></p>
<ul> <ul>
<li> <li>
<i>disable</i><br> <a id="serviced-attr-serviceAutostart">serviceAutostart</a><br>
Anhalten der automatischen Abfrage und komplett deaktivieren<br>
Voreinstellung: 0
</li>
<li>
<i>serviceAutostart</i><br>
Verz&ouml;gerung in Sekunden um den Dienst nach Start von FHEM (neu) zu starten<br> Verz&ouml;gerung in Sekunden um den Dienst nach Start von FHEM (neu) zu starten<br>
Voreinstellung: Voreinstellung:
</li> </li>
<li> <li>
<i>serviceAutostop</i><br> <a id="serviced-attr-serviceAutostop">serviceAutostop</a><br>
Timeout in Sekunden um den Dienst bei Beenden von FHEM ebenso zu beenden<br> Timeout in Sekunden um den Dienst bei Beenden von FHEM ebenso zu beenden<br>
Voreinstellung: Voreinstellung:
</li> </li>
<li> <li>
<i>serviceGetStatusOnInit</i><br> <a id="serviced-attr-serviceGetStatusOnInit">serviceGetStatusOnInit</a><br>
beim Start von FHEM automatisch den Status des Dienstes abrufen<br> beim Start von FHEM automatisch den Status des Dienstes abrufen<br>
Voreinstellung: 1 Voreinstellung: 1
</li> </li>
<li> <li>
<i>serviceInitd</i><br> <a id="serviced-attr-serviceInitd">serviceInitd</a><br>
benutze initd (system) statt systemd (systemctl)<br> benutze initd (system) statt systemd (systemctl)<br>
Voreinstellung: 0 Voreinstellung: 0
</li> </li>
<li> <li>
<i>serviceLogin</i><br> <a id="serviced-attr-serviceLogin">serviceLogin</a><br>
SSH Anmeldedaten f&uuml;r entfernten Dienst<br> SSH Anmeldedaten f&uuml;r entfernten Dienst<br>
passwortloser SSH Zugang ist Grundvoraussetzung<br> passwortloser SSH Zugang ist Grundvoraussetzung<br>
Voreinstellung: Voreinstellung:
</li> </li>
<li> <li>
<i>servicePort</i><br> <a id="serviced-attr-servicePort">servicePort</a><br>
SSH Port falls ein anderer als der Standard Port (22) verwendet wird<br> SSH Port falls ein anderer als der Standard Port (22) verwendet wird<br>
Voreinstellung: 22 Voreinstellung: 22
</li> </li>
<li> <li>
<i>serviceRegexFailed</i><br> <a id="serviced-attr-serviceRegexFailed">serviceRegexFailed</a><br>
Regex f&uuml;r failed Status<br> Regex f&uuml;r failed Status<br>
Voreinstellung: dead|failed|exited Voreinstellung: dead|failed|exited
</li> </li>
<li> <li>
<i>serviceRegexStarted</i><br> <a id="serviced-attr-serviceRegexStarted">serviceRegexStarted</a><br>
Regex f&uuml;r running Status<br> Regex f&uuml;r running Status<br>
Voreinstellung: running|active Voreinstellung: running|active
</li> </li>
<li> <li>
<i>serviceRegexStarting</i><br> <a id="serviced-attr-serviceRegexStarting">serviceRegexStarting</a><br>
Regex f&uuml;r starting Status<br> Regex f&uuml;r starting Status<br>
Voreinstellung: activating|starting Voreinstellung: activating|starting
</li> </li>
<li> <li>
<i>serviceRegexStopped</i><br> <a id="serviced-attr-serviceRegexStopped">serviceRegexStopped</a><br>
Regex f&uuml;r stopped Status<br> Regex f&uuml;r stopped Status<br>
Voreinstellung: inactive|stopped Voreinstellung: inactive|stopped
</li> </li>
<li> <li>
<i>serviceStatusInterval</i><br> <a id="serviced-attr-serviceStatusInterval">serviceStatusInterval</a><br>
Interval um den Status automatisch zu aktualisieren<br> Interval um den Status automatisch zu aktualisieren<br>
Voreinstellung: Voreinstellung:
</li> </li>
<li> <li>
<i>serviceStatusLine</i><br> <a id="serviced-attr-serviceStatusLine">serviceStatusLine</a><br>
Zeilennummer der Status R&uuml;ckgabe welche die Status Information enth&auml;lt<br> Zeilennummer der Status R&uuml;ckgabe welche die Status Information enth&auml;lt<br>
Voreinstellung: 3 Voreinstellung: 3
</li> </li>
<li> <li>
<i>serviceSudo</i><br> <a id="serviced-attr-serviceSudo">serviceSudo</a><br>
sudo benutzen<br> sudo benutzen<br>
Voreinstellung: 1 Voreinstellung: 1
</li> </li>
</ul> </ul>
<br> <br>
<a name="serviced_read"></a> <a id="serviced-read"></a>
<p><b>Readings</b></p> <p><b>Readings</b></p>
<p>Alle Aktualisierungen der Readings erzeugen Events.</p> <p>Alle Aktualisierungen der Readings erzeugen Events.</p>
<ul> <ul>
<li> <li>
<i>error</i><br> <a id="serviced-read-error">error</a><br>
letzter aufgetretener Fehler, none wenn kein Fehler aufgetreten ist letzter aufgetretener Fehler, none wenn kein Fehler aufgetreten ist
</li> </li>
<li> <li>
<i>state</i><br> <a id="serviced-read-state">state</a><br>
aktueller Zustand aktueller Zustand
</li> </li>
<li> <li>
<i>status</i><br> <a id="serviced-read-status">status</a><br>
letzte Statuszeile von 'get/set status' letzte Statuszeile von 'get/set status'
</li> </li>
</ul> </ul>