contrib/commandref_modular.pl: implement modular commandref (Forum #39854)

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@11984 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2016-08-19 12:47:50 +00:00
parent 5ea1d56f1a
commit b4ae4fc171
58 changed files with 569 additions and 140 deletions

View File

@ -1143,6 +1143,8 @@ CUL_prefix($$$)
1;
=pod
=item summary connect devices with the culfw Firmware, e.g. Busware CUL
=item summary_DE Anbindung von Geraeten mit dem culfw Firmware, z.Bsp. Busware CUL
=begin html
<a name="CUL"></a>

View File

@ -395,6 +395,8 @@ FBAHA_Ready($)
1;
=pod
=item summary (deprecated) connection to the Fritz!OS AHA Server
=item summary_DE Anbindung des (veralteten) Fritz!OS AHA Servers
=begin html
<a name="FBAHA"></a>

View File

@ -228,6 +228,8 @@ FBAHAHTTP_Write($$$)
1;
=pod
=item summary connection to the Fritz!OS AHA Server via HTTP
=item summary_DE Anbindung des Fritz!OS AHA Servers &uuml;ber HTTP
=begin html
<a name="FBAHAHTTP"></a>

View File

@ -821,6 +821,8 @@ FHZ_Read($)
1;
=pod
=item summary connection to the ELV FHZ1000/FHZ1300 USB devices
=item summary_DE Anbindung der ELV FHZ1000/FHZ1300 USB Ger&auml;te
=begin html
<a name="FHZ"></a>

View File

@ -115,6 +115,8 @@ LIRC_Ready($)
1;
=pod
=item summary connection to the Linux Infrared Server (lirc)
=item summary_DE Anbindung der Linux Infrared (lirc) Servers
=begin html
<a name="LIRC"></a>

View File

@ -658,6 +658,8 @@ ZWCUL_Ready($)
1;
=pod
=item summary connection to a culfw Device in ZWave mode (e.g. CUL)
=item summary_DE Anbindung eines culfw Ger&auml;tes in ZWave Modus (z.Bsp. CUL)
=begin html
<a name="ZWCUL"></a>

View File

@ -952,6 +952,8 @@ ZWDongle_Ready($)
1;
=pod
=item summary connection to standard ZWave controller
=item summary_DE Anbindung von standard ZWave Controller
=begin html
<a name="ZWDongle"></a>

View File

@ -628,6 +628,8 @@ FW_answerCall($)
my $static = ($ext =~ m/(css|js|png|jpg)/i || $dir =~ m/^pgm2/);
my $fname = ($ext ? "$file.$ext" : $file);
if(-r "$ldir/$fname" || $static) { # no return for FLOORPLAN
$FW_RET .= "var csrfToken='$FW_CSRF';\n" # Hack?
if($FW_CSRF && $fname eq "fhemdoc_modular.js");
return FW_serveSpecial($file, $ext, $ldir, ($arg =~ m/nocache/) ? 0 : 1);
}
$arg = "/$dir/$ofile";
@ -1272,7 +1274,9 @@ FW_doDetail($)
FW_pH "cmd=style showDSI $d", "Extend devStateIcon", undef, "detLink showDSI";
FW_pH "cmd=delete $d", "Delete this device ($d)", undef, "detLink delDev"
if($d ne "global");
FW_pH "$FW_ME/docs/commandref.html#${t}", "Device specific help",
my $sfx = AttrVal("global", "language", "EN");
$sfx = ($sfx eq "EN" ? "" : "_$sfx");
FW_pH "$FW_ME/docs/commandref${sfx}.html#${t}", "Device specific help",
undef, "detLink devSpecHelp";
FW_pO "<br><br>";
FW_pO "</div>";
@ -1391,10 +1395,12 @@ FW_roomOverview($)
push @list1, $lr;
push @list2, "$FW_ME?room=".urlEncode($r);
}
my $sfx = AttrVal("global", "language", "EN");
$sfx = ($sfx eq "EN" ? "" : "_$sfx");
my @list = (
"Everything", "$FW_ME?room=all",
"", "",
"Commandref", "$FW_ME/docs/commandref.html",
"Commandref", "$FW_ME/docs/commandref${sfx}.html",
"Remote doc", "http://fhem.de/fhem.html#Documentation",
"Edit files", "$FW_ME?cmd=style%20list",
"Select style", "$FW_ME?cmd=style%20select",
@ -2989,6 +2995,8 @@ FW_widgetOverride($$)
=pod
=item helper
=item summary HTTP Server and FHEM Frontend
=item summary_DE HTTP Server und FHEM Frontend
=begin html
<a name="FHEMWEB"></a>

View File

@ -477,6 +477,8 @@ FBDECT_Undef($$)
1;
=pod
=item summary DECT devices connected via the Fritz!OS AHA Server
=item summary_DE &uuml;ber den Fritz!OS AHA Server angebundene DECT Ger&auml;te
=begin html
<a name="FBDECT"></a>

View File

@ -455,6 +455,8 @@ four2hex($$)
1;
=pod
=item summary devices communicating via the ELV FS20 protocol
=item summary_DE Anbindung von FS20 Ger&auml;ten
=begin html
<a name="FS20"></a>

View File

@ -4548,6 +4548,8 @@ s2Hex($)
1;
=pod
=item summary devices communicating via the ZWave protocol
=item summary_DE Anbindung von ZWave Ger&auml;ten
=begin html
<a name="ZWave"></a>

View File

@ -723,6 +723,8 @@ FHT_State($$$$)
1;
=pod
=item summary devices communicating via the ELV FHT protocol (FHT80b)
=item summary_DE Anbindung von ELV FHT Ger&auml;ten (FHT80b)
=begin html
<a name="FHT"></a>

View File

@ -122,6 +122,8 @@ FHT8V_Get($@)
1;
=pod
=item summary module for the FHT8v controlled directly by a culfw device
=item summary_DE Anbindung von FHT8v Ventilen &uuml;ber ein culfw Ger&auml;t
=begin html
<a name="FHT8V"></a>

View File

@ -240,6 +240,8 @@ HMS_Parse($$)
1;
=pod
=item summary devices communicating via the ELV HMS protocol
=item summary_DE Anbindung von ELV HMS Ger&auml;ten
=begin html
<a name="HMS"></a>

View File

@ -322,6 +322,8 @@ KS300_windIndex($)
1;
=pod
=item summary module for the ELV KS300 weather station
=item summary_DE Anbindung der ELV KS300 Wetterstation
=begin html
<a name="KS300"></a>

View File

@ -142,6 +142,8 @@ CUL_TX_Parse($$)
=pod
=item summary Some Lacrosse sensors (TX-3TH, etc)
=item summary_DE Einige Lacrosse Sensoren (TX-3TH, usw.)
=begin html
<a name="CUL_TX"></a>

View File

@ -364,6 +364,8 @@ CUL_WS_Attr(@)
1;
=pod
=item summary devices communicating via the ELV WS protocol (S300TH, etc)
=item summary_DE Anbindung von ELV Ger&auml;ten mit dem WS Protokoll (S300TH, usw.)
=begin html
<a name="CUL_WS"></a>

View File

@ -277,6 +277,8 @@ CUL_EM_Parse($$)
=pod
=item summary devices communicating via the ELV EM protocol (EM1000WZ, etc)
=item summary_DE Anbindung von ELV Ger&auml;ten mit dem EM Protokoll (EM1000WZ, usw.)
=begin html
<a name="CUL_EM"></a>

View File

@ -149,6 +149,8 @@ CUL_RFR_AddPrefix($$)
=pod
=item summary devices communicating over culfw RFR (SlowRF repeater)
=item summary_DE Anbindung von Ger&auml;ten &uuml;ber ein culfw RFR (SlowRF repeater)
=begin html
<a name="CUL_RFR"></a>

View File

@ -150,6 +150,8 @@ STACKABLE_CC_Undef($$)
=pod
=item summary Busware Stackable CC (SCC) base module
=item summary_DE Busware Stackabble CC (SCC) basis Modul
=begin html
<a name="STACKABLE_CC"></a>

View File

@ -61,6 +61,8 @@ CUL_HOERMANN_Parse($$)
1;
=pod
=item summary Hoermann Garage door opener (read-only)
=item summary_DE Hoermann Garagenfernbedienung (nur lesen)
=begin html
<a name="CUL_HOERMANN"></a>

View File

@ -425,6 +425,8 @@ EmGetDevData($)
1;
=pod
=item summary basis module for the ELV EM1010PC
=item summary_DE Anbindung der ELV EM1010PC
=begin html
<a name="EM"></a>

View File

@ -185,6 +185,8 @@ EMWZ_Define($$)
1;
=pod
=item summary EM1000WZ devices communicating over the EM1010PC
=item summary_DE EM1000WZ Ger&auml;te angebunden &uuml;ber ein EM1010PC
=begin html
<a name="EMWZ"></a>

View File

@ -139,6 +139,8 @@ EMEM_Define($$)
1;
=pod
=item summary EM1000EM devices communicating over the EM1010PC
=item summary_DE EM1000EM Ger&auml;te angebunden &uuml;ber ein EM1010PC
=begin html
<a name="EMEM"></a>

View File

@ -172,6 +172,8 @@ EMGZ_Define($$)
1;
=pod
=item summary EM1000GZ devices communicating over the EM1010PC
=item summary_DE EM1000GZ Ger&auml;te angebunden &uuml;ber ein EM1010PC
=begin html
<a name="EMGZ"></a>

View File

@ -383,6 +383,8 @@ EOF
1;
=pod
=item summary start an FHEM command at a later time
=item summary_DE FHEM Befehl zu einem sp&auml;teren Zeitpunkt starten
=item helper
=begin html

View File

@ -218,6 +218,8 @@ eventTypes_Get($@)
=pod
=item helper
=item summary collects FHEM Events to be used in frontends
=item summary_DE Sammelt FHEM Events f&uuml; die Frontends.
=begin html
<a name="eventTypes"></a>

View File

@ -269,6 +269,8 @@ notify_fhemwebFn($$$$)
=pod
=item helper
=item summary execute a command upon receiving an event
=item summary_DE f&uuml;hrt bei Events Anweisungen aus
=begin html
<a name="notify"></a>

View File

@ -131,6 +131,8 @@ sequence_Undef($$)
=pod
=item helper
=item summary generate an event upon reception of a defined sequence of events
=item summary_DE generiert Event nach Empfang einer definierten Event-Sequenz
=begin html
<a name="sequence"></a>

View File

@ -207,6 +207,8 @@ watchdog_Attr(@)
=pod
=item helper
=item summary execute a command, if no event is received within timeout
=item summary_DE f&uuml;hrt Befehl aus, falls innerhalb des Timeouts kein Event empfangen wurde
=begin html
<a name="watchdog"></a>

View File

@ -1065,6 +1065,8 @@ FileLog_regexpFn($$)
=pod
=item helper
=item summary log events to a file
=item summary_DE schreibt Events in eine Logdatei
=begin html
<a name="FileLog"></a>

View File

@ -322,6 +322,8 @@ FHEM2FHEM_Set($@)
=pod
=item helper
=item summary connect two FHEM instances
=item summary_DE verbindet zwei FHEM Installationen
=begin html
<a name="FHEM2FHEM"></a>

View File

@ -268,6 +268,8 @@ western_easter($)
=pod
=item helper
=item summary define holidays in a local file
=item summary_DE Urlaubs-/Feiertagskalender aus einer lokalen Datei
=begin html
<a name="holiday"></a>

View File

@ -211,6 +211,8 @@ allowed_Attr(@)
=pod
=item helper
=item summary authorize command execution based on frontend
=item summary_DE authorisiert Befehlsausf&uuml;hrung basierend auf dem Frontend
=begin html
<a name="allowed"></a>

View File

@ -97,6 +97,8 @@ CommandCULflash($$)
=pod
=item command
=item summary flash (USB-)CUL device with culfw
=item summary_DE USB-CUL Ger&auml;te mit Firmware versorgen (flashen)
=begin html
<a name="CULflash"></a>

View File

@ -130,6 +130,9 @@ CommandJsonList2($$)
=pod
=item command
=item summary show device data in JSON format
=item summary_DE zeigt Ger&auml;tedaten in JSON Format an
=begin html
<a name="JsonList2"></a>

View File

@ -2319,6 +2319,8 @@ plotAsPng(@)
=pod
=item helper
=item summary draw an SVG-Plot based on FileLog or DbLog data
=item summary_DE malt ein SVG-Plot aus FileLog oder DbLog Daten
=begin html
<a name="SVG"></a>

View File

@ -108,6 +108,8 @@ CommandXmlList($$)
=pod
=item command
=item summary show device data in XML format
=item summary_DE zeigt Ger&auml;tedaten in XML Format an
=begin html
<a name="XmlList"></a>

View File

@ -656,13 +656,15 @@ autocreate_Attr(@)
=pod
=item helper
=item summary automatically create not yet defined FHEM devices
=item summary_DE Erzeugt FHEM-Ger&auml;te automatisch
=begin html
<a name="autocreate"></a>
<h3>autocreate</h3>
<ul>
Automatically create not yet defined fhem devices upon reception of a message
Automatically create not yet defined FHEM devices upon reception of a message
generated by this device. Note: devices which are polled (like the EMEM/EMWZ
accessed through the EM1010PC) will NOT be automatically created.
@ -786,7 +788,7 @@ autocreate_Attr(@)
</code></ul>
This command will scan the /dev directory for attached USB devices, and
will try to identify them. With the argument scan you'll get back a list
of fhem commands to execute, with the argument create there will be no
of FHEM commands to execute, with the argument create there will be no
feedback, and the devices will be created instead.<br><br>
Note that switching a CUL to HomeMatic mode is still has to be done
@ -810,7 +812,7 @@ autocreate_Attr(@)
<h3>autocreate</h3>
<ul>
Erzeugt f&uuml;r noch nicht definierte fhem-Ger&auml;te automatisch die
Erzeugt f&uuml;r noch nicht definierte FHEM-Ger&auml;te automatisch die
geignete Definition (define). Diese Definition wird aus einer Nachricht
gewonnen, die von diesen neuen Ger&auml;ten empfangen wurde. Hinweis:
Ger&auml;te, die mit Polling arbeiten (wie z.B. der Zugriff auf EMEM/EMWZ
@ -952,7 +954,7 @@ autocreate_Attr(@)
</code></ul>
Dieser Befehl durchsucht das /dev-Verzeichnis nach angeschlossenen
USB-Ger&auml;ten und versucht gleichzeitig sie zu identifizieren. Mit dem
Argument scan wird eine Liste von ausf&uuml;hrbaren fhem-Befehlen
Argument scan wird eine Liste von ausf&uuml;hrbaren FHEM-Befehlen
zur&uuml;ckgegeben. Das Argument create gibt keine Liste o.&auml;.
zur&uuml;ck, die Ger&auml;te werden stattdessen erzeugt.<br><br>

View File

@ -191,6 +191,8 @@ average_Notify($$)
=pod
=item helper
=item summary add avarage Readings to arbitrary devices
=item summary_DE berechnet Durchschnittswerte (als Readings)
=begin html
<a name="average"></a>

View File

@ -227,6 +227,8 @@ createArchiv($$)
=pod
=item command
=item summary create a backup of the FHEM installation
=item summary_DE erzeugt eine Sicherungsdatei der FHEM Installation
=begin html
<a name="backup"></a>

View File

@ -100,6 +100,8 @@ CommandCmdAlias($$$)
=pod
=item command
=item summary create new commands or replace internal ones.
=item summary_DE neue FHEM Befehle definieren oder existierende &auml;ndern
=begin html
<a name="cmdalias"></a>

View File

@ -70,6 +70,8 @@ dummy_Define($$)
=pod
=item helper
=item summary dummy device
=item summary_DE dummy Ger&auml;t
=begin html
<a name="dummy"></a>

View File

@ -235,6 +235,8 @@ _myDiv($$)
=pod
=item command
=item summary display information about the system and FHEM definitions
=item summary_DE zeigt Systeminformationen an
=begin html
<a name="fheminfo"></a>

View File

@ -587,6 +587,8 @@ notice_Read($$$)
=pod
=item command
=item summary read and confirm system messages
=item summary_DE Systemnachrichten anzeigen und best&auml;tigen
=begin html
<a name="notice"></a>

View File

@ -91,6 +91,8 @@ restoreDir($$)
=pod
=item command
=item summary restore program files modified by the update command
=item summary_DE durch das update Befehl ge&auml;nderte Programmdateien wiederherstellen
=begin html
<a name="restore"></a>

View File

@ -510,6 +510,8 @@ structure_Attr($@)
=pod
=item helper
=item summary organize/structure multiple devices
=item summary_DE mehrere Ger&auml;te zu einem zusammenfassen
=begin html
<a name="structure"></a>

View File

@ -423,6 +423,8 @@ telnet_ActivateInform($)
=pod
=item helper
=item summary telnet server for FHEM
=item summary_DE FHEM telnet Server
=begin html
<a name="telnet"></a>

View File

@ -283,7 +283,9 @@ doUpdate($$$$)
}
my $canJoin;
my $cj = "$root/contrib/commandref_join.pl";
my $cmod = AttrVal('global', 'commandref', 'full');
my $cj = "$root/contrib/commandref_".
($cmod eq "full" ? "join":"modular").".pl";
if(-f $cj &&
-f "$root/docs/commandref_frame.html" &&
-w "$root/docs/commandref.html" &&
@ -394,8 +396,9 @@ doUpdate($$$$)
if($canJoin && $upd_needJoin && $curr == $max) {
chdir($root);
uLog(1, "Calling $^X $cj -noWarnings, this may take a while");
my $ret = `$^X $cj -noWarnings`;
$cj .= " -noWarnings" if($cmod eq "full");
uLog(1, "Calling $^X $cj, this may take a while");
my $ret = `$^X $cj`;
foreach my $l (split(/[\r\n]+/, $ret)) {
uLog(1, $l);
}
@ -621,6 +624,8 @@ upd_initRestoreDirs($)
=pod
=item command
=item summary update FHEM program files from the central repository
=item summary_DE FHEM Programmdateien aktualisieren
=begin html
<a name="update"></a>

View File

@ -138,6 +138,8 @@ weblink_FwFn($$$$)
=pod
=item helper
=item summary define a HTTP link for the FHEMWEB frontend
=item summary_DE HTTP Link fuer das FHEMWEB Frontend
=begin html
<a name="weblink"></a>

View File

@ -401,6 +401,8 @@ sub sunset_abs_dat (@) {
=pod
=item helper
=item summary perl functions to compute the sun position
=item summary_DE perl Funktionen f&uuml;r die Sonnenstandsberechnung
=begin html
<a name="SUNRISE_EL"></a>

View File

@ -248,6 +248,8 @@ round($$)
=pod
=item helper
=item summary FHEM utility functions
=item summary_DE FHEM Hilfsfunktionen
=begin html
<a name="Utils"></a>

View File

@ -0,0 +1,110 @@
#!/usr/bin/perl
# $Id$
use strict;
use warnings;
my @lang = ("EN", "DE");
my $modDir = "FHEM";
my $now = time();
for my $lang (@lang) {
my $sfx = ($lang eq "EN" ? "" : "_$lang");
my %modData;
my $cmdref = "docs/commandref_frame$sfx.html";
open(FH, $cmdref) || die("Cant open $cmdref: $!\n");
my $type = "";
while(my $l = <FH>) {
if($l =~ m/<!-- header:(.*) -->/) {
$type = $1; next;
}
if($type && $l =~ m/<a href="#([^"]+).*<!--(.*)-->/) {
$modData{$1}{type} = $type;
$modData{$1}{"summary$sfx"} = $2;
$modData{$1}{ts} = $now;
} else {
$type = "";
}
}
close(FH);
$cmdref = "docs/commandref${sfx}.html";
if(open(FH, $cmdref)) {
my $cmptime = (stat($cmdref))[9];
my $type = "device";
while(my $l = <FH>) {
$type = $1 if($l =~ m,<!-- header:(.*) -->,);
if($l =~ m,<td class='modname'><a href='#'>(.*)</a></td><td>(.*)</td>, &&
!$modData{$1}) { # commandref_frame has prio
$modData{$1}{type} = $type;
$modData{$1}{"summary$sfx"} = $2;
$modData{$1}{ts} = $cmptime;
}
}
close(FH);
}
opendir(DH, $modDir) || die "Cant open $modDir: $!\n";
while(my $fName = readdir DH) {
next if($fName !~ m/^\d\d_(.*)\.pm$/);
my $mName = $1;
my $ts = (stat("$modDir/$fName"))[9];
if(!$modData{$mName} || !$modData{$mName}{ts} || $modData{$mName}{ts}<$ts) {
print "Checking $fName for $lang short description\n";
$modData{$mName}{type}="device" if(!$modData{$mName}{type});
open(FH, "$modDir/$fName") || die("Cant open $modDir/$fName: $!\n");
while(my $l = <FH>) {
$modData{$mName}{type}=$1 if($l =~ m/^=item\s+(helper|command|device)/);
$modData{$mName}{$1} =$2 if($l =~ m/^=item\s+(summary[^ ]*)\s(.*)$/);
}
close(FH);
}
}
closedir(DH);
$cmdref = "docs/commandref_frame${sfx}.html";
open(IN, $cmdref) || die("Cant open $cmdref: $!\n");
$cmdref = ">docs/commandref${sfx}.html";
open(OUT, $cmdref) || die("Cant open $cmdref: $!\n");
while(my $l = <IN>) {
print OUT $l;
if($l =~ m,\s*<title>,) {
print OUT << 'EOF'
<script type="text/javascript" src="../pgm2/jquery.min.js"></script>
<script type="text/javascript" src="../pgm2/fhemdoc_modular.js"></script>
EOF
}
if($l =~ m,<!-- header:(.*) -->,) {
my $type = $1;
while(my $l = <IN>) {
last if($l !~ m/<a href="/);
}
print OUT "<table class='block summary class_$type'>\n";
my $rc = "odd";
for my $m (sort keys %modData) {
next if(!$modData{$m}{type} || $modData{$m}{type} ne $type);
my $d = $modData{$m}{"summary$sfx"};
if(!$d) {
my $osfx = ($lang eq "DE" ? "" : "_DE");
$d = $modData{$m}{"summary$sfx"};
if(!$d) {
$d = "keine Kurzbeschreibung vorhanden" if($lang eq "DE");
$d = "no short description available" if($lang eq "EN");
}
}
print OUT "<tr class='$rc'><td class='modname'><a href='#'>$m</a></td>".
"<td>$d</td><tr>\n";
$rc = ($rc eq "odd" ? "even" : "odd");
}
print OUT "</table>\n";
}
}
}

View File

@ -19,11 +19,21 @@
<div id="menu">
<h3>fhem.pl reference</h3>
Version: <b>EN</b>&nbsp;<a href="commandref_DE.html">DE</a>
<br><br>
<a href="#doctop">Scroll to top</a>
<br><br>
<a style="display:none" href="#" name="loadAll">Load complete doc</a>
<br><br>
<a id="otherLang" style="display:none" href="#" name="otherLang">
Load <span style="display:none" lang="DE">german</span>
<span style="display:none" lang="EN">english</span>
doc for <span class="mod"></span>
</a>
</div>
</div>
<div id="right">
<a name="doctop"></a>
<h3>Contents</h3>
<ul>
<a href="#intro">Introduction</a><br>
@ -35,38 +45,36 @@
<b>Fhem commands</b>
<ul>
<!-- header:command -->
<a href="#apptime">apptime</a> &nbsp;
<a href="#attr">attr</a> &nbsp;
<a href="#cancel">cancel</a> &nbsp;
<a href="#createlog">createlog</a> &nbsp;
<a href="#define">define</a> &nbsp;
<a href="#defmod">defmod</a> &nbsp;
<a href="#delete">delete</a> &nbsp;
<a href="#deleteattr">deleteattr</a> &nbsp;
<a href="#deletereading">deletereading</a> &nbsp;
<a href="#displayattr">displayattr</a> &nbsp;
<a href="#fheminfo">fheminfo</a> &nbsp;
<a href="#get">get</a> &nbsp;
<a href="#getstate">getstate</a> &nbsp;
<a href="#IF">IF</a> &nbsp;
<a href="#include">include</a> &nbsp;
<a href="#inform">inform</a> &nbsp;
<a href="#list">list</a> &nbsp;
<a href="#modify">modify</a> &nbsp;
<a href="#notice">notice</a> &nbsp;
<a href="#quit">quit</a> &nbsp;
<a href="#reload">reload</a> &nbsp;
<a href="#rename">rename</a> &nbsp;
<a href="#rereadcfg">rereadcfg</a> &nbsp;
<a href="#save">save</a> &nbsp;
<a href="#set">set</a> &nbsp;
<a href="#setdefaultattr">setdefaultattr</a> &nbsp;
<a href="#setreading">setreading</a> &nbsp;
<a href="#setstate">setstate</a> &nbsp;
<a href="#shutdown">shutdown</a> &nbsp;
<a href="#sleep">sleep</a> &nbsp;
<a href="#trigger">trigger</a> &nbsp;
<a href="#usb">usb</a> &nbsp;
<a href="#apptime">apptime</a> &nbsp; <!-- provides information about execution times -->
<a href="#attr">attr</a> &nbsp; <!-- set an attribute for a FHEM device -->
<a href="#cancel">cancel</a> &nbsp; <!-- cancel sleep -->
<a href="#createlog">createlog</a> &nbsp; <!-- add a FileLog and an SVG to an existing device -->
<a href="#define">define</a> &nbsp; <!-- define/create a FHEM device -->
<a href="#defmod">defmod</a> &nbsp; <!-- define or modify a FHEM device -->
<a href="#delete">delete</a> &nbsp; <!-- delete a FHEM device -->
<a href="#deleteattr">deleteattr</a> &nbsp; <!-- delete an attribute -->
<a href="#deletereading">deletereading</a> &nbsp; <!-- delete a reading -->
<a href="#displayattr">displayattr</a> &nbsp; <!-- show attributes -->
<a href="#get">get</a> &nbsp; <!-- retrieve a value from a FHEM device -->
<a href="#IF">IF</a> &nbsp; <!-- conditionally execute FHEM commands -->
<a href="#include">include</a> &nbsp; <!-- read in a file with FHEM commands -->
<a href="#inform">inform</a> &nbsp; <!-- show events in a telnet connection -->
<a href="#list">list</a> &nbsp; <!-- display definition,readings and attributes of a FHEM device -->
<a href="#modify">modify</a> &nbsp; <!-- change the definition of a FHEM device -->
<a href="#notice">notice</a> &nbsp; <!-- view and confirm of system messages -->
<a href="#quit">quit</a> &nbsp; <!-- end a telnet connection to FHEM -->
<a href="#reload">reload</a> &nbsp; <!-- reload a FHEM module (program definition) -->
<a href="#rename">rename</a> &nbsp; <!-- rename a FHEM device -->
<a href="#rereadcfg">rereadcfg</a> &nbsp; <!-- reread the FHEM configuration -->
<a href="#save">save</a> &nbsp; <!-- save the FHEM configuration -->
<a href="#set">set</a> &nbsp; <!-- set a value in a FHEM device -->
<a href="#setdefaultattr">setdefaultattr</a> &nbsp; <!-- define a default attribute -->
<a href="#setreading">setreading</a> &nbsp; <!-- set a reading for a FHEM device -->
<a href="#setstate">setstate</a> &nbsp; <!-- set the main state of a FHEM device -->
<a href="#shutdown">shutdown</a> &nbsp; <!-- shut down (terminate) FHEM -->
<a href="#sleep">sleep</a> &nbsp; <!-- sleep (delay execution) for a while -->
<a href="#trigger">trigger</a> &nbsp; <!-- generate a FHEM event -->
<a href="#usb">usb</a> &nbsp; <!-- discover USB devices -->
</ul>
@ -685,34 +693,6 @@ The following local attributes are used by a wider range of devices:
</ul>
</ul>
<a name="setdefaultattr"></a>
<h3>setdefaultattr</h3>
<ul>
<code>setdefaultattr [&lt;attrname&gt; [&lt;value&gt;]] </code><br>
<br>Add a default attribute. Each device defined from now on will receive
this attribute.<br> If no attrname is specified, then the default attribute
list will be deleted.
<br><br>
Example to set the attribute "room kitchen" and "loglevel 4" to
each of the lamps:
<ul>
<code>setdefaultattr room kitchen</code><br>
<code>setdefaultattr loglevel 4</code><br>
<code>define lamp1 FS20 1234 11</code><br>
<code>define lamp2 FS20 1234 12</code><br>
<code>define lamp3 FS20 1234 13</code><br>
<code>setdefaultattr</code><br>
</ul>
<br>
Notes:<br>
<ul>
<li>There is no way to delete a single default-attribute from the list</li>
</ul>
</ul>
<a name="cancel"></a>
<h3>cancel</h3>
<ul>
@ -871,26 +851,6 @@ The following local attributes are used by a wider range of devices:
</ul>
<a name="getstate"></a>
<h3>getstate</h3>
<ul>
<code>getstate &lt;devspec&gt;</code>
<br><br>
Output a short space seperated status for &lt;devspec&gt;. It is useful for
monitoring the device in e.g. Cacti.<br>
Examples:
<ul><code>
getstate lamp<br>
state:1<br>
<br>
getstate fl<br>
ack:0 actuator:2 day-temp:21.5 desired-temp:22.5 [...] measured-temp:22.9 [...]
</code></ul>
Note: to use this command copy the file contrib/getstate/99_getstate.pm into
your FHEM directory.
<br>
</ul>
<a name="include"></a>
<h3>include</h3>
@ -1171,6 +1131,34 @@ The following local attributes are used by a wider range of devices:
</ul>
</ul>
<a name="setdefaultattr"></a>
<h3>setdefaultattr</h3>
<ul>
<code>setdefaultattr [&lt;attrname&gt; [&lt;value&gt;]] </code><br>
<br>Add a default attribute. Each device defined from now on will receive
this attribute.<br> If no attrname is specified, then the default attribute
list will be deleted.
<br><br>
Example to set the attribute "room kitchen" and "loglevel 4" to
each of the lamps:
<ul>
<code>setdefaultattr room kitchen</code><br>
<code>setdefaultattr loglevel 4</code><br>
<code>define lamp1 FS20 1234 11</code><br>
<code>define lamp2 FS20 1234 12</code><br>
<code>define lamp3 FS20 1234 13</code><br>
<code>setdefaultattr</code><br>
</ul>
<br>
Notes:<br>
<ul>
<li>There is no way to delete a single default-attribute from the list</li>
</ul>
</ul>
<a name="setreading"></a>
<h3>setreading</h3>
<ul>
@ -1226,22 +1214,6 @@ The following local attributes are used by a wider range of devices:
</ul>
</ul>
<a name="trigger"></a>
<h3>trigger</h3>
<ul>
<code>trigger &lt;devspec&gt; &lt;state&gt;</code>
<br><br>
Trigger a <a href="#notify">notify</a> definition.
See the <a href="#devspec">Device specification</a> section for details on
&lt;devspec&gt;.
<br><br>
Example:
<ul>
<code>trigger btn3 on</code>
</ul>
</ul>
<a name="sleep"></a>
<h3>sleep</h3>
<ul>
@ -1271,6 +1243,22 @@ The following local attributes are used by a wider range of devices:
<br>
</ul>
<a name="trigger"></a>
<h3>trigger</h3>
<ul>
<code>trigger &lt;devspec&gt; &lt;state&gt;</code>
<br><br>
Trigger a <a href="#notify">notify</a> definition.
See the <a href="#devspec">Device specification</a> section for details on
&lt;devspec&gt;.
<br><br>
Example:
<ul>
<code>trigger btn3 on</code>
</ul>
</ul>
<!-- commands end - diese Zeile nicht entfernen! -->
<a name="global"></a>
@ -1759,5 +1747,6 @@ The .gnuplot file consists of 3 parts:
</ul>
</li>
</div> <!-- right -->
</body>
</html>

View File

@ -19,10 +19,21 @@
<div id="menu">
<h3>fhem.pl Referenz</h3>
Version: <a href="commandref.html">EN</a>&nbsp;<b>DE</b>
<br><br>
<a href="#doctop">Zum Anfang</a>
<br><br>
<a style="display:none" href="#" name="loadAll">Komplette Doku laden</a>
<br><br>
<a id="otherLang" style="display:none" href="#" name="otherLang">
<span style="display:none" lang="DE">Deutsche</span>
<span style="display:none" lang="EN">Englische</span>
Doku f&uuml;r <span class="mod"></span> laden
</a>
</div>
</div>
<div id="right">
<a name="doctop"></a>
<h3>Inhalt</h3>
<ul>
@ -35,6 +46,36 @@
<b>FHEM-Befehle</b>
<ul>
<!-- header:command -->
<a href="#apptime">apptime</a> &nbsp; <!-- liefert Daten &uuml;ber Ausf&uuml;hrungszeiten -->
<a href="#attr">attr</a> &nbsp; <!-- setzt ein Attribut f&uuml;r ein FHEM Ger&auml;t -->
<a href="#cancel">cancel</a> &nbsp; <!-- bricht ein sleep ab -->
<a href="#createlog">createlog</a> &nbsp; <!-- f&uuml;gt ein FileLog und ein SVG an einem existierenden FHEM Ger&auml;t -->
<a href="#define">define</a> &nbsp; <!-- definiert ein FHEM Ger&auml;t -->
<a href="#defmod">defmod</a> &nbsp; <!-- definiert oder modifiziert ein FHEM Ger&auml;t -->
<a href="#delete">delete</a> &nbsp; <!-- entfernt ein FHEM Ger&auml;t -->
<a href="#deleteattr">deleteattr</a> &nbsp; <!-- entfernt ein Attribut -->
<a href="#deletereading">deletereading</a> &nbsp; <!-- entfernt ein Reading -->
<a href="#displayattr">displayattr</a> &nbsp; <!-- zeigt Attribute eines FHEM Ger&auml;tes -->
<a href="#get">get</a> &nbsp; <!-- holt ein Wert von einem FHEM Ger&auml;t -->
<a href="#IF">IF</a> &nbsp; <!-- bedingte Ausf&uuml;hrung von FHEM Befehlen -->
<a href="#include">include</a> &nbsp; <!-- liest eine Datei mit FHEM Befehlen ein -->
<a href="#inform">inform</a> &nbsp; <!-- zeigt Events in einer telnet Verbindung -->
<a href="#list">list</a> &nbsp; <!-- zeigt Definition,Readings und Attribute eines FHEM Ger&auml;tes -->
<a href="#modify">modify</a> &nbsp; <!-- &auml;ndert die Definition eines FHEM Ger&auml;tes -->
<a href="#notice">notice</a> &nbsp; <!-- zeigt und best&auml;tigt Systemmeldungen -->
<a href="#quit">quit</a> &nbsp; <!-- endet eine telnet Verbindung zu FHEM -->
<a href="#reload">reload</a> &nbsp; <!-- l&auml;dt ein FHEM Modul (Programmdefinition) -->
<a href="#rename">rename</a> &nbsp; <!-- benennt ein FHEM Ger&auml;t um -->
<a href="#rereadcfg">rereadcfg</a> &nbsp; <!-- l&auml;dt die FHEM Konfiguration neu -->
<a href="#save">save</a> &nbsp; <!-- speichert die FHEM Konfiguration -->
<a href="#set">set</a> &nbsp; <!-- setzt ein Wert in einem FHEM Ger&auml;t -->
<a href="#setdefaultattr">setdefaultattr</a> &nbsp; <!-- definiert ein "default" Attribut -->
<a href="#setreading">setreading</a> &nbsp; <!-- setzt ein Reading f&uuml;r ein FHEM Ger&auml;t -->
<a href="#setstate">setstate</a> &nbsp; <!-- setzt den Status eines FHEM Ger&aumles -->
<a href="#shutdown">shutdown</a> &nbsp; <!-- beendet FHEM -->
<a href="#sleep">sleep</a> &nbsp; <!-- verz&ouml;gerte Ausf&uuml;hrung -->
<a href="#trigger">trigger</a> &nbsp; <!-- generiert ein FHEM Event -->
<a href="#usb">usb</a> &nbsp; <!-- sucht nach USB Ger&auml;ten -->
</ul>
@ -662,36 +703,6 @@ Die folgenden lokalen Attribute werden von mehreren Ger&auml;ten verwendet:
</ul>
</ul>
<a name="setdefaultattr"></a>
<h3>setdefaultattr</h3>
<ul>
<code>setdefaultattr [&lt;attrname&gt; [&lt;value&gt;]] </code><br>
<br>
F&uuml;gt Sie ein Standardattribut hinzu. Jedem nach dieser Zuweisung definierte
Ger&auml;t wird dieses Attribut zugewiesen. Wenn kein "attrname" angegeben wird,
dann wird die Liste der Standardattribute gel&ouml;scht.
<br><br>
Beispiel, um das Attribut "room kitchen" und "loglevel 4" allen Lampen
zuzuweisen:
<ul>
<code>setdefaultattr room kitchen</code><br>
<code>setdefaultattr loglevel 4</code><br>
<code>define lamp1 FS20 1234 11</code><br>
<code>define lamp2 FS20 1234 12</code><br>
<code>define lamp3 FS20 1234 13</code><br>
<code>setdefaultattr</code><br>
</ul>
<br>
Anmerkungen:<br>
<ul>
<li>es gibt keine M&ouml;glichkeit, ein einzelnes Standardattribut aus der Liste
tu l&ouml;schen.</li>
</ul>
</ul>
<a name="cancel"></a>
<h3>cancel</h3>
<ul>
@ -1190,6 +1201,36 @@ Die folgenden lokalen Attribute werden von mehreren Ger&auml;ten verwendet:
</ul>
</ul>
<a name="setdefaultattr"></a>
<h3>setdefaultattr</h3>
<ul>
<code>setdefaultattr [&lt;attrname&gt; [&lt;value&gt;]] </code><br>
<br>
F&uuml;gt Sie ein Standardattribut hinzu. Jedem nach dieser Zuweisung definierte
Ger&auml;t wird dieses Attribut zugewiesen. Wenn kein "attrname" angegeben wird,
dann wird die Liste der Standardattribute gel&ouml;scht.
<br><br>
Beispiel, um das Attribut "room kitchen" und "loglevel 4" allen Lampen
zuzuweisen:
<ul>
<code>setdefaultattr room kitchen</code><br>
<code>setdefaultattr loglevel 4</code><br>
<code>define lamp1 FS20 1234 11</code><br>
<code>define lamp2 FS20 1234 12</code><br>
<code>define lamp3 FS20 1234 13</code><br>
<code>setdefaultattr</code><br>
</ul>
<br>
Anmerkungen:<br>
<ul>
<li>es gibt keine M&ouml;glichkeit, ein einzelnes Standardattribut aus der Liste
tu l&ouml;schen.</li>
</ul>
</ul>
<a name="setreading"></a>
<h3>setreading</h3>
@ -1840,7 +1881,6 @@ Die folgenden lokalen Attribute werden von mehreren Ger&auml;ten verwendet:
</ul>
</li></ul>
</div></body></html>
</div> <!-- right -->
</body>
</html>

View File

@ -273,6 +273,7 @@ my @globalAttrList = qw(
backupdir
backupsymlink
blockingCallMax
commandref:modular,full
configfile
dnsServer
dupTimeout
@ -2452,6 +2453,14 @@ GlobalAttr($$$$)
$featurelevel = $val;
}
elsif($name eq "commandref" && $init_done) {
my $root = $attr{global}{modpath};
if($val eq "full") {
return `$^X $root/contrib/commandref_join.pl -noWarnings`;
} else {
return `$^X $root/contrib/commandref_modular.pl`;
}
}
return undef;
}

166
www/pgm2/fhemdoc_modular.js Normal file
View File

@ -0,0 +1,166 @@
var fd_Hash={}, fd_List=[], fd_All={}, fd_AllCnt, fd_Progress=0, fd_Lang,
fd_Offsets=[], scrolled=0;
function
fd_status(txt)
{
var errmsg = $("#errmsg");
if(!$(errmsg).length) {
$('#menuScrollArea').append('<div id="errmsg">');
errmsg = $("#errmsg");
}
if(txt == "")
$(errmsg).remove();
else
$(errmsg).html(txt);
}
function
fd_fC(fn, callback)
{
var p = location.pathname;
var cmd = p.substr(0,p.indexOf('/doc'))+
'?cmd='+fn+
(typeof(csrfToken)!='undefined'?csrfToken:'')+
'&XHR=1';
var ax = $.ajax({ cache:false, url:cmd });
ax.done(callback);
ax.fail(function(req, stat, err) {
console.log("FAIL ERR:"+err+" STAT:"+stat);
});
}
function
loadOneDoc(mname, lang)
{
function
done(err, calc)
{
if(fd_Progress) {
fd_status(fd_Progress+" / "+fd_AllCnt);
if(++fd_Progress > fd_AllCnt) {
fd_Progress = 0;
setTimeout(calcOffsets,100); // Firefox returns wrong offsets
fd_status("");
}
} else {
if(calc)
setTimeout(calcOffsets,100);
if(!err)
location.href = "#"+mname;
}
}
if(fd_Hash[mname] && fd_Hash[mname] == lang)
return done(false, false);
fd_fC("help "+mname+" "+lang, function(ret){
//console.log(mname+" "+lang+" => "+ret.length);
if(ret.indexOf("<html>") != 0 || ret.indexOf("<html>No help found") == 0)
return done(true, false);
ret = ret.replace(/<\/?html>/g,'');
ret = ret.replace(/Keine deutsche Hilfe gefunden!<br\/>/,'');
ret = '<div id="FD_'+mname+'">'+ret+'</div>';
if(fd_Hash[mname])
$("div#FD_"+mname).remove();
if(!fd_Hash[mname])
fd_List.push(mname);
fd_Hash[mname] = lang;
fd_List.sort();
var idx=0;
while(fd_List[idx] != mname)
idx++;
var toIns = "perl";
if(idx < fd_List.length-1)
toIns = fd_List[idx+1];
$(ret).insertBefore("a[name="+toIns+"]");
console.log("insert "+mname+" before "+toIns);
return done(false, true);
});
}
function
calcOffsets()
{
fd_Offsets=[];
for(var i1=0; i1<fd_List.length; i1++) {
var cr = $("a[name="+fd_List[i1]+"]").offset();
fd_Offsets.push(cr ? cr.top : -1);
}
checkScroll();
}
function
checkScroll()
{
if(!scrolled) {
setTimeout(checkScroll, 500);
return;
}
scrolled = 0;
var viewTop=$(window).scrollTop(), viewBottom=viewTop+$(window).height();
var idx=0;
while(idx<fd_Offsets.length) {
if(fd_Offsets[idx] >= viewTop && viewBottom > fd_Offsets[idx]+30)
break;
idx++;
}
if(idx >= fd_Offsets.length) {
$("a#otherLang").hide();
} else {
var mname = fd_List[idx];
var l1 = fd_Hash[mname], l2 = (l1=="EN" ? "DE" : "EN");
$("a#otherLang span.mod").html(mname);
$("a#otherLang span[lang="+l1+"]").hide();
$("a#otherLang span[lang="+l2+"]").show();
$("a#otherLang").show();
}
}
function
loadOtherLang()
{
var mname = $("a#otherLang span.mod").html();
loadOneDoc(mname, fd_Hash[mname]=="EN" ? "DE" : "EN");
}
$(document).ready(function(){
var p = location.pathname;
fd_Lang = p.substring(p.indexOf("commandref")+11,p.indexOf(".html"));
if(!fd_Lang || fd_Lang == '.')
fd_Lang = "EN";
$("h3").each(function(){ fd_Hash[$(this).html()] = fd_Lang; });
$("table.summary td.modname a")
.each(function(){ fd_All[$(this).html()]=1; })
.click(function(e){
e.preventDefault();
loadOneDoc($(this).html(), fd_Lang);
});
if(location.hash)
loadOneDoc(location.hash.substr(1), fd_Lang);
$("a[name=loadAll]").show().click(function(e){
e.preventDefault();
$("a[name=loadAll]").hide();
location.href = "#doctop";
fd_AllCnt = 0;
for(var m in fd_All) fd_AllCnt++
fd_Progress = 1;
for(var mname in fd_All)
loadOneDoc(mname, fd_Lang);
});
$("a#otherLang").click(loadOtherLang);
window.onscroll = function(){
if(!scrolled++)
setTimeout(checkScroll, 500);
};
});

View File

@ -9,6 +9,7 @@ textarea { font-family:Arial, sans-serif; font-size:16px;}
#menu { position:absolute; top: 2px; left:65px; }
#hdr { position:absolute; top:40px; left:65px; }
#content { position:absolute; top:85px; left: 0px; right: 0px;}
#right { position:absolute; top:30px; left: 0px; right: 0px; }
#errmsg { left:0px; }
.devType { font-size:12px;}