mirror of
https://github.com/Fishwaldo/huginn.git
synced 2025-03-20 22:01:35 +00:00
Indent description
This commit is contained in:
parent
6a4779be9d
commit
b642fa38dc
1 changed files with 36 additions and 48 deletions
|
@ -5,56 +5,55 @@ require "json"
|
||||||
module Agents
|
module Agents
|
||||||
class MqttAgent < Agent
|
class MqttAgent < Agent
|
||||||
description <<-MD
|
description <<-MD
|
||||||
The MQTT agent allows both publication and subscription to an MQTT topic.
|
The MQTT agent allows both publication and subscription to an MQTT topic.
|
||||||
|
|
||||||
MQTT is a generic transport protocol for machine to machine communication.
|
MQTT is a generic transport protocol for machine to machine communication.
|
||||||
|
|
||||||
You can do things like:
|
You can do things like:
|
||||||
|
|
||||||
* Publish to [RabbitMQ](http://www.rabbitmq.com/mqtt.html)
|
* Publish to [RabbitMQ](http://www.rabbitmq.com/mqtt.html)
|
||||||
* Run [OwnTracks, a location tracking tool](http://owntracks.org/) for iOS and Android
|
* Run [OwnTracks, a location tracking tool](http://owntracks.org/) for iOS and Android
|
||||||
* Subscribe to your home automation setup like [Ninjablocks](http://forums.ninjablocks.com/index.php?p=/discussion/661/today-i-learned-about-mqtt/p1) or [TheThingSystem](http://thethingsystem.com/dev/supported-things.html)
|
* Subscribe to your home automation setup like [Ninjablocks](http://forums.ninjablocks.com/index.php?p=/discussion/661/today-i-learned-about-mqtt/p1) or [TheThingSystem](http://thethingsystem.com/dev/supported-things.html)
|
||||||
|
|
||||||
Simply choose a topic (think email subject line) to publish/listen to, and configure your service.
|
Simply choose a topic (think email subject line) to publish/listen to, and configure your service.
|
||||||
|
|
||||||
It's easy to setup your own [broker](http://jpmens.net/2013/09/01/installing-mosquitto-on-a-raspberry-pi/) or connect to a [cloud service](www.cloudmqtt.com)
|
It's easy to setup your own [broker](http://jpmens.net/2013/09/01/installing-mosquitto-on-a-raspberry-pi/) or connect to a [cloud service](www.cloudmqtt.com)
|
||||||
|
|
||||||
Hints:
|
Hints:
|
||||||
Many services run mqtts (mqtt over SSL) often with a custom certificate.
|
Many services run mqtts (mqtt over SSL) often with a custom certificate.
|
||||||
|
|
||||||
You'll want to download their cert and install it locally, specifying the ```certificate_path``` configuration.
|
You'll want to download their cert and install it locally, specifying the ```certificate_path``` configuration.
|
||||||
|
|
||||||
|
|
||||||
Example configuration:
|
Example configuration:
|
||||||
|
|
||||||
<pre><code>{
|
<pre><code>{
|
||||||
'uri' => 'mqtts://user:pass@locahost:8883'
|
'uri' => 'mqtts://user:pass@locahost:8883'
|
||||||
'ssl' => :TLSv1,
|
'ssl' => :TLSv1,
|
||||||
'ca_file' => './ca.pem',
|
'ca_file' => './ca.pem',
|
||||||
'cert_file' => './client.crt',
|
'cert_file' => './client.crt',
|
||||||
'key_file' => './client.key',
|
'key_file' => './client.key',
|
||||||
'topic' => 'huginn'
|
'topic' => 'huginn'
|
||||||
}
|
}
|
||||||
</code></pre>
|
</code></pre>
|
||||||
|
|
||||||
Subscribe to CloCkWeRX's TheThingSystem instance (thethingsystem.com), where
|
Subscribe to CloCkWeRX's TheThingSystem instance (thethingsystem.com), where
|
||||||
temperature and other events are being published.
|
temperature and other events are being published.
|
||||||
|
|
||||||
<pre><code>{
|
<pre><code>{
|
||||||
'uri' => 'mqtt://kcqlmkgx:sVNoccqwvXxE@m10.cloudmqtt.com:13858'
|
'uri' => 'mqtt://kcqlmkgx:sVNoccqwvXxE@m10.cloudmqtt.com:13858'
|
||||||
'topic' => 'the_thing_system/demo'
|
'topic' => 'the_thing_system/demo'
|
||||||
}
|
}
|
||||||
</code></pre>
|
</code></pre>
|
||||||
|
|
||||||
Subscribe to all topics
|
Subscribe to all topics
|
||||||
<pre><code>{
|
<pre><code>{
|
||||||
'uri' => 'mqtt://kcqlmkgx:sVNoccqwvXxE@m10.cloudmqtt.com:13858'
|
'uri' => 'mqtt://kcqlmkgx:sVNoccqwvXxE@m10.cloudmqtt.com:13858'
|
||||||
'topic' => '/#'
|
'topic' => '/#'
|
||||||
}
|
}
|
||||||
</code></pre>
|
</code></pre>
|
||||||
|
|
||||||
Find out more detail on [subscription wildcards](http://www.eclipse.org/paho/files/mqttdoc/Cclient/wildcard.html)
|
|
||||||
|
|
||||||
|
Find out more detail on [subscription wildcards](http://www.eclipse.org/paho/files/mqttdoc/Cclient/wildcard.html)
|
||||||
MD
|
MD
|
||||||
|
|
||||||
event_description <<-MD
|
event_description <<-MD
|
||||||
|
@ -62,18 +61,7 @@ module Agents
|
||||||
|
|
||||||
<pre><code>{
|
<pre><code>{
|
||||||
"topic": "owntracks/kcqlmkgx/Dan",
|
"topic": "owntracks/kcqlmkgx/Dan",
|
||||||
"message": {
|
"message": {"_type": "location", "lat": "-34.8493644", "lon": "138.5218119", "tst": "1401771049", "acc": "50.0", "batt": "31", "desc": "Home", "event": "enter"},
|
||||||
"topic": "owntracks/kcqlmkgx/Galaxy S3 Dan",
|
|
||||||
"message": {
|
|
||||||
"_type": "location",
|
|
||||||
"lat": "-34.849373",
|
|
||||||
"lon": "138.5218449",
|
|
||||||
"tst": "1401761484",
|
|
||||||
"acc": "10.0",
|
|
||||||
"batt": "71"
|
|
||||||
},
|
|
||||||
"time": 1401771825
|
|
||||||
},
|
|
||||||
"time": 1401771051
|
"time": 1401771051
|
||||||
}</code></pre>
|
}</code></pre>
|
||||||
MD
|
MD
|
||||||
|
|
Loading…
Add table
Reference in a new issue