Autocreate modifications

git-svn-id: https://svn.fhem.de/fhem/trunk@521 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig
2009-12-22 11:00:54 +00:00
parent c543fc3fde
commit d9bfef9486
16 changed files with 362 additions and 86 deletions

View File

@@ -32,6 +32,7 @@
<a href="#modify">modify</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;
@@ -93,12 +94,14 @@
<a href="#PachLog">PachLog</a> &nbsp;
<a href="#SUNRISE_EL">SUNRISE_EL</a> &nbsp;
<a href="#at">at</a> &nbsp;
<a href="#autocreate">autocreate</a> &nbsp;
<a href="#dummy">dummy</a> &nbsp;
<a href="#dumpdef">dumpdef</a> &nbsp;
<a href="#holiday">holiday</a> &nbsp;
<a href="#notify">notify</a> &nbsp;
<a href="#watchdog">watchdog</a> &nbsp;
<a href="#weblink">weblink</a> &nbsp;
</ul>
<br>
@@ -365,7 +368,9 @@ A line ending with \ will be concatenated with the next one, so long lines
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.
"lamp off" instead of "Device 5673, Button 00, Code 00 (off)". <br>
Use "define &lt;name&gt; ?" to get a list of possible types.
Use "define &lt;name&gt; ?" to get a list of possible types.<br>
After definition, the global event "DEFINED" will be generated, see the
notify section for details.<br>
<br><br>
Each device takes different additional arguments at definition, see the
@@ -401,6 +406,8 @@ A line ending with \ will be concatenated with the next one, so long lines
Delete something created with the <a href="#define">define</a> command.
See the <a href="#devspec">Device specification</a> section for details on
&lt;devspec&gt;.<br>
After deletion, the global event "DELETED" will be generated, see the notify
section for details.<br>
Examples:
<ul>
<code>delete lamp</code><br>
@@ -592,6 +599,22 @@ A line ending with \ will be concatenated with the next one, so long lines
</ul>
</ul>
<a name="rename"></a>
<h3>rename</h3>
<ul>
<code>rename &lt;oldname&gt; &lt;newname&gt;</code>
<br><br>
Rename a device from the &lt;oldname&gt; to &lt;newname&gt;, together with
its attributes. The global event RENAMED will be generated, see the notify
section for details.
<br><br>
Example:
<ul>
<code>rename FHT_1234 fht.kitchen</code>
</ul>
</ul>
<a name="rereadcfg"></a>
<h3>rereadcfg</h3>
<ul>
@@ -758,6 +781,15 @@ A line ending with \ will be concatenated with the next one, so long lines
<b>Attributes</b>
<ul>
<a name="autoload_undefined_devices"></a>
<li>autoload_undefined_devices<br>
If set, automatically load the corresponding module when a message
of this type is received. This is used by the <a href="#autocreate">
autocreate</a> device, to automatically create a fhem device upon
receiving a corresponding message.
</li><br>
<a name="allowfrom"></a>
<li>allowfrom<br>
Comma (,) separated list of ip-addresses or hostnames. If set,
@@ -3312,7 +3344,8 @@ A line ending with \ will be concatenated with the next one, so long lines
<a name="weblinkdefine"></a>
<b>Define</b>
<ul>
<code>define &lt;name&gt; weblink [link|fileplot] &lt;argument&gt;</code>
<code>define &lt;name&gt; weblink [link|fileplot|image]
&lt;argument&gt;</code>
<br><br>
This is a placeholder used with webpgm2 to be able to integrate links
into it, and to be able to put more than one gnuplot/SVG picture on one
@@ -3320,8 +3353,9 @@ A line ending with \ will be concatenated with the next one, so long lines
Examples:
<ul>
<code>define wl_1 weblink link http://www.fhem.de</code><br>
<code>define wl_2 weblink fileplot &lt;logdevice&gt;:&lt;gnuplot-file&gt;:&lt;logfile&gt;</code><br>
<code>define homepage weblink link http://www.fhem.de</code><br>
<code>define MyPlot weblink fileplot &lt;logdevice&gt;:&lt;gnuplot-file&gt;:&lt;logfile&gt;</code><br>
<code>define webcam weblink image http://w.x.y.z/current.jpg</code><br>
</ul>
<br>
@@ -3332,9 +3366,8 @@ A line ending with \ will be concatenated with the next one, so long lines
<a href="#logtype">logtype</a>) and convert it to weblink. Now you
can group these weblinks by putting them into rooms. If you convert
the current logfile to a weblink, it will always refer to the current
file (and not the one you originally specified).</li>
</ul>
</ul>
file, even if its name changes regularly (and not the one you
originally specified).</li> </ul> </ul>
<b>Set</b> <ul>N/A</ul><br>
@@ -3575,6 +3608,82 @@ A line ending with \ will be concatenated with the next one, so long lines
</ul>
<a name="autocreate"></a>
<h3>autocreate</h3>
<ul>
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.
<br>
<a name="autocreatedefine"></a>
<b>Define</b>
<ul>
<code>define &lt;name&gt; autocreate</code><br>
<br>
<ul>
It makes no sense to create more than one instance of this module.
By defining an instance, the global attribute <a href=
"#autoload_undefined_devices">autoload_undefined_devices</a>
is set, so that modules for unknnown devices are automatically loaded.
The autocreate module intercepts the UNDEFINED event generated by each
module, creates a device and optionally also FileLog and weblink
entries.<br>
<b>Note:</b>devices will be created with a unique name, which contains
the type and a unique id for this type. When <a href="#rename">renaming
</a> the device, the automatically created filelog and weblink devices
will also be renamed.
</ul>
<br>
Example:<PRE>
define autocreate autocreate
attr autocreate autosave
attr autocreate device_room %TYPE
attr autocreate filelog test2/log/%NAME-%Y.log
attr autocreate weblink
attr autocreate weblink_room Plots
</PRE>
</ul>
<b>Set</b> <ul>N/A</ul><br>
<b>Get</b> <ul>N/A</ul><br>
<b>Attributes</b>
<ul>
<a name="autosave"></a>
<li>autosave<br>
After creating a device, automatically save the config file with the
command <a href="#save">save</a> command.</li><br>
<a name="device_room"></a>
<li>device_room<br>
"Put" the newly created device in this room. The name can contain the
wildcards %TYPE and %NAME, see the example above.</li><br>
<a name="filelog"></a>
<li>filelog<br>
Create a filelog associated with the device. The filename can contain
the wildcards %TYPE and %NAME, see the example above. The filelog will
be "put" in the same room as the device.</li><br>
<a name="weblink"></a>
<li>weblink<br>
Create a weblinkn associated with the device/filelog.</li><br>
<a name="weblink_room"></a>
<li>weblink_room<br>
"Put" the newly weblink in this room. The name can contain the
wildcards %TYPE and %NAME, see the example above.</li><br>
</ul>
<br>
</ul>
<a name="holiday"></a>
<h3>holiday</h3>
<ul>
@@ -3726,21 +3835,21 @@ A line ending with \ will be concatenated with the next one, so long lines
<li>To use database logging, copy the file contrib/91_DbLog.pm into your
modules directory, and change the $dbconn parameter in the file.</li>
<li>Each undefined device (FS20, HMS, FHT) will be reported with the
device name "UNDEFINED". The % parameter will contain the type (FS20,
HMS100T, etc) and device number, separated by a space.</li>
<li>After defining a device, the event "DEFINED" will be triggered. This
can be used in the fhem.cfg to set some values of the device.</li>
<li>After initialization finished, the event "INITIALIZED" for the device
"global" will be triggered.</li>
<li>Following special events will be generated for the device "global"
<ul>
<li>INITIALIZED after initialization is finished.
<li>DEFINED &lt;devname&gt; after a device is defined.
<li>DELETED &lt;devname&gt; after a device was deleted.
<li>RENAMED &lt;old&gt; &lt;new&gt; after a device was renamed.
<li>UNDEFINED &lt;defspec&gt; upon reception of a message for an
undefined device.
</ul>
<li>Notify can be used to store macros for manual execution. Use the <a
href="#trigger">trigger</a> command to execute the macro. E.g.<br>
<pre>
fhem> define MyMacro notify MyMacro { Log 1, "Hello"}
fhem> trigger MyMacro</pre>
href="#trigger">trigger</a> command to execute the macro.
E.g.<br>
<code>fhem> define MyMacro notify MyMacro { Log 1, "Hello"}</code><br>
<code>fhem> trigger MyMacro</pre></code><br>
</ul>
@@ -4032,7 +4141,7 @@ A line ending with \ will be concatenated with the next one, so long lines
define FileLog fhtlog1 fht1:.*(temp|actuator).*
/var/log/fht1-%Y-%U.log
</li>
<li>ks300_1<br>
<li>ks300<br>
Plots the temperature and rain (per hour and per day) of a
ks300. The corresponding filelog definitions (for the KS300
device named ks300) looks like:<br>