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

MQTT: dokumentation

git-svn-id: https://svn.fhem.de/fhem/trunk@6720 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
ntruchsess 2014-10-09 08:49:59 +00:00
parent d31500cab7
commit 440bac9efa
3 changed files with 109 additions and 133 deletions

View File

@ -518,45 +518,37 @@ sub client_stop($) {
<a name="MQTT"></a>
<h3>MQTT</h3>
<ul>
connects fhem to <a href="http://mqtt.org">mqtt</a>
<br><br>
A single MQTT device can serve multiple <a href="#MQTT_DEVICE">MQTT_DEVICE</a> clients.<br><br>
Each <a href="#MQTT_DEVICE">MQTT_DEVICE</a> acts as a bridge in between an fhem-device and mqtt.
Note: this module is based on module <a href="https://metacpan.org/pod/distribution/Net-MQTT/lib/Net/MQTT.pod">Net::MQTT</a>.
<br><br>
<p>connects fhem to <a href="http://mqtt.org">mqtt</a>.</p>
<p>A single MQTT device can serve multiple <a href="#MQTT_DEVICE">MQTT_DEVICE</a> and <a href="#MQTT_BRIDGE">MQTT_BRIDGE</a> clients.<br/>
Each <a href="#MQTT_DEVICE">MQTT_DEVICE</a> acts as a bridge in between an fhem-device and mqtt.<br/>
Note: this module is based on module <a href="https://metacpan.org/pod/distribution/Net-MQTT/lib/Net/MQTT.pod">Net::MQTT</a>.</p>
<a name="MQTTdefine"></a>
<b>Define</b><br>
<ul><br>
<code>define &lt;name&gt; MQTT &lt;ip:port&gt;</code> <br>
Specifies the MQTT device.<br>
<br>
<br>
<a name="MQTTset"></a>
<b>Set</b>
<ul>
<li>
<code>set &lt;name&gt; connect</code><br>
(re-)connects the MQTT-device to the mqtt-broker
</li><br>
<li>
<code>set &lt;name&gt; disconnect</code><br>
disconnects the MQTT-device from the mqtt-broker
</li>
</ul>
<br><br>
<a name="MQTTattr"></a>
<b>Attributes</b><br>
<ul>
<li>keep-alive<br>
sets the keep-alive time (in seconds).
</li>
</ul>
<p><b>Define</b></p>
<ul>
<p><code>define &lt;name&gt; MQTT &lt;ip:port&gt;</code></p>
<p>Specifies the MQTT device.</p>
</ul>
<a name="MQTTset"></a>
<p><b>Set</b></p>
<ul>
<li>
<p><code>set &lt;name&gt; connect</code><br/>
(re-)connects the MQTT-device to the mqtt-broker</p>
</li>
<li>
<p><code>set &lt;name&gt; disconnect</code><br/>
disconnects the MQTT-device from the mqtt-broker</p>
</li>
</ul>
<a name="MQTTattr"></a>
<p><b>Attributes</b></p>
<ul>
<li>
<p>keep-alive<br/>
sets the keep-alive time (in seconds).</p>
</li>
</ul>
</ul>
<br>
=end html
=cut

View File

@ -187,58 +187,50 @@ sub onmessage($$$) {
<a name="MQTT_BRIDGE"></a>
<h3>MQTT_BRIDGE</h3>
<ul>
acts as a bridge in between an fhem-device and <a href="http://mqtt.org">mqtt</a>-topics.
<br><br>
requires a <a href="#MQTT">MQTT</a>-device as IODev<br><br>
Note: this module is based on module <a href="https://metacpan.org/pod/distribution/Net-MQTT/lib/Net/MQTT.pod">Net::MQTT</a>.
<br><br>
<p>acts as a bridge in between an fhem-device and <a href="http://mqtt.org/">mqtt</a>-topics.</p>
<p>requires a <a href="#MQTT">MQTT</a>-device as IODev<br/>
Note: this module is based on module <a href="https://metacpan.org/pod/distribution/Net-MQTT/lib/Net/MQTT.pod">Net::MQTT</a>.</p>
<a name="MQTT_BRIDGEdefine"></a>
<b>Define</b><br>
<ul><br>
<code>define &lt;name&gt; MQTT_BRIDGE &lt;fhem-device-name&gt;</code> <br>
Specifies the MQTT device.<br>
&lt;fhem-device-name&gt; is the fhem-device this MQTT_BRIDGE is linked to.<br>
<br>
<a name="MQTT_BRIDGEget"></a>
<b>Get</b>
<ul>
<li>
<code>get &lt;name&gt; readings</code><br>
retrieves all existing readings from fhem-device and configures (default-)topics for them.<br>
attribute 'publish-topic-base' is prepended if set.
</li><br>
</ul>
<br><br>
<a name="MQTT_BRIDGEattr"></a>
<b>Attributes</b><br>
<ul>
<li>
<code>attr &lt;name&gt; subscribeSet &lt;topic&gt;</code><br>
configures a topic that will issue a 'set &lt;message&gt; whenever a message is received<br>
</li>
<li>
<code>attr &lt;name&gt; subscribeSet_&lt;reading&gt; &lt;topic&gt;</code><br>
configures a topic that will issue a 'set &lt;reading&gt; &lt;message&gt; whenever a message is received<br>
</li>
<li>
<code>attr &lt;name&gt; publishState &lt;topic&gt;</code><br>
configures a topic such that a message is sent to topic whenever the device state changes.<br>
</li>
<li>
<code>attr &lt;name&gt; publishReading_&lt;reading&gt; &lt;topic&gt;</code><br>
configures a topic such that a message is sent to topic whenever the device readings value changes.<br>
</li>
<li>
<code>attr &lt;name&gt; publish-topic-base &lt;topic&gt;</code><br>
this is used as base path when issueing 'get &lt;device&gt; readings' to construct topics to publish to based on the devices existing readings<br>
</li>
</ul>
<p><b>Define</b></p>
<ul>
<p><code>define &lt;name&gt; MQTT_BRIDGE &lt;fhem-device-name&gt;</code></p>
<p>Specifies the MQTT device.<br/>
&lt;fhem-device-name&gt; is the fhem-device this MQTT_BRIDGE is linked to.</p>
</ul>
<a name="MQTT_BRIDGEget"></a>
<p><b>Get</b></p>
<ul>
<li>
<p><code>get &lt;name&gt; readings</code><br/>
retrieves all existing readings from fhem-device and configures (default-)topics for them.<br/>
attribute 'publish-topic-base' is prepended if set.</p>
</li>
</ul>
<a name="MQTT_BRIDGEattr"></a>
<p><b>Attributes</b></p>
<ul>
<li>
<p><code>attr &lt;name&gt; subscribeSet &lt;topic&gt;</code><br/>
configures a topic that will issue a 'set &lt;message&gt; whenever a message is received</p>
</li>
<li>
<p><code>attr &lt;name&gt; subscribeSet_&lt;reading&gt; &lt;topic&gt;</code><br/>
configures a topic that will issue a 'set &lt;reading&gt; &lt;message&gt; whenever a message is received</p>
</li>
<li>
<p><code>attr &lt;name&gt; publishState &lt;topic&gt;</code><br/>
configures a topic such that a message is sent to topic whenever the device state changes.</p>
</li>
<li>
<p><code>attr &lt;name&gt; publishReading_&lt;reading&gt; &lt;topic&gt;</code><br/>
configures a topic such that a message is sent to topic whenever the device readings value changes.</p>
</li>
<li>
<p><code>attr &lt;name&gt; publish-topic-base &lt;topic&gt;</code><br/>
this is used as base path when issueing 'get &lt;device&gt; readings' to construct topics to publish to based on the devices existing readings</p>
</li>
</ul>
</ul>
<br>
=end html
=cut

View File

@ -191,57 +191,49 @@ sub onmessage($$$) {
<a name="MQTT_DEVICE"></a>
<h3>MQTT_DEVICE</h3>
<ul>
acts as a fhem-device that is mapped to <a href="http://mqtt.org">mqtt</a>-topics.
<br><br>
requires a <a href="#MQTT">MQTT</a>-device as IODev<br><br>
Note: this module is based on module <a href="https://metacpan.org/pod/distribution/Net-MQTT/lib/Net/MQTT.pod">Net::MQTT</a>.
<br><br>
<p>acts as a fhem-device that is mapped to <a href="http://mqtt.org/">mqtt</a>-topics.</p>
<p>requires a <a href="#MQTT">MQTT</a>-device as IODev<br/>
Note: this module is based on module <a href="https://metacpan.org/pod/distribution/Net-MQTT/lib/Net/MQTT.pod">Net::MQTT</a>.</p>
<a name="MQTT_DEVICEdefine"></a>
<b>Define</b><br>
<ul><br>
<code>define &lt;name&gt; MQTT_DEVICE</code> <br>
Specifies the MQTT device.<br>
<br>
<a name="MQTT_DEVICEset"></a>
<b>Set</b>
<ul>
<li>
<code>set &lt;name&gt; &lt;command&gt;</code><br>
sets reading 'state' and publishes the command to topic configured via attr publishSet
</li><br>
<li>
<code>set &lt;name&gt; &lth;reading&gt; &lt;value&gt;</code><br>
sets reading &lth;reading&gt; and publishes the command to topic configured via attr publishSet_&lth;reading&gt;
</li><br>
</ul>
<br><br>
<a name="MQTT_DEVICEattr"></a>
<b>Attributes</b><br>
<ul>
<li>
<code>attr &lt;name&gt; publishSet [&lt;commands&gt] &lt;topic&gt;</code><br>
configures set commands that may be used to both set reading 'state' and publish to configured topic<br>
</li>
<li>
<code>attr &lt;name&gt; publishSet_&lt;reading&gt; [&lt;values&gt] &lt;topic&gt;</code><br>
configures reading that may be used to both set 'reading' (to optionally configured values) and publish to configured topic<br>
</li>
<li>
<code>attr &lt;name&gt; autoSubscribeReadings &lt;topic&gt;</code><br>
specify a mqtt-topic pattern with wildcard (e.c. 'myhouse/kitchen/+') and MQTT_DEVICE automagically creates readings based on the wildcard-match<br>
e.g a message received with topic 'myhouse/kitchen/temperature' would create and update a reading 'temperature'
</li>
<li>
<code>attr &lt;name&gt; subscribeReading_&lt;reading&gt; &lt;topic&gt;</code><br>
mapps a reading to a specific topic. The reading is updated whenever a message to the configured topic arrives<br>
</li>
</ul>
<p><b>Define</b></p>
<ul>
<p><code>define &lt;name&gt; MQTT_DEVICE</code><br/>
Specifies the MQTT device.</p>
</ul>
<a name="MQTT_DEVICEset"></a>
<p><b>Set</b></p>
<ul>
<li>
<p><code>set &lt;name&gt; &lt;command&gt;</code><br/>
sets reading 'state' and publishes the command to topic configured via attr publishSet</p>
</li>
<li>
<p><code>set &lt;name&gt; &lt;h;reading&gt; &lt;value&gt;</code><br/>
sets reading &lt;h;reading&gt; and publishes the command to topic configured via attr publishSet_&lt;h;reading&gt;</p>
</li>
</ul>
<a name="MQTT_DEVICEattr"></a>
<p><b>Attributes</b></p>
<ul>
<li>
<p><code>attr &lt;name&gt; publishSet [&lt;commands&gt;] &lt;topic&gt;</code><br/>
configures set commands that may be used to both set reading 'state' and publish to configured topic</p>
</li>
<li>
<p><code>attr &lt;name&gt; publishSet_&lt;reading&gt; [&lt;values&gt;] &lt;topic&gt;</code><br/>
configures reading that may be used to both set 'reading' (to optionally configured values) and publish to configured topic</p>
</li>
<li>
<p><code>attr &lt;name&gt; autoSubscribeReadings &lt;topic&gt;</code><br/>
specify a mqtt-topic pattern with wildcard (e.c. 'myhouse/kitchen/+') and MQTT_DEVICE automagically creates readings based on the wildcard-match<br/>
e.g a message received with topic 'myhouse/kitchen/temperature' would create and update a reading 'temperature'</p>
</li>
<li>
<p><code>attr &lt;name&gt; subscribeReading_&lt;reading&gt; &lt;topic&gt;</code><br/>
mapps a reading to a specific topic. The reading is updated whenever a message to the configured topic arrives</p>
</li>
</ul>
</ul>
<br>
=end html
=cut