Site updated at 2017-03-18 17:12:07 UTC
This commit is contained in:
parent
7573fcba68
commit
67179bf8fe
994 changed files with 1768 additions and 68252 deletions
|
@ -3,17 +3,14 @@
|
|||
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
|
||||
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html> <!--<![endif]-->
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<title>MQTT Birth and Last will - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Instructions how to setup MQTT birth and last will messages within Home Assistant.">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/docs/mqtt/birth_will/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="MQTT Birth and Last will">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
|
@ -21,39 +18,31 @@
|
|||
<meta property="og:type" content="article">
|
||||
<meta property="og:description" content="Instructions how to setup MQTT birth and last will messages within Home Assistant.">
|
||||
<meta property="og:image" content="https://home-assistant.io/images/default-social.png">
|
||||
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta name="twitter:site" content="@home_assistant">
|
||||
|
||||
<meta name="twitter:title" content="MQTT Birth and Last will">
|
||||
<meta name="twitter:description" content="Instructions how to setup MQTT birth and last will messages within Home Assistant.">
|
||||
<meta name="twitter:image" content="https://home-assistant.io/images/default-social.png">
|
||||
|
||||
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet">
|
||||
<link href="/atom.xml" rel="alternate" title="Home Assistant" type="application/atom+xml">
|
||||
<link rel='shortcut icon' href='/images/favicon.ico' />
|
||||
<link rel='icon' type='image/png' href='/images/favicon-192x192.png' sizes='192x192' />
|
||||
</head>
|
||||
|
||||
<body >
|
||||
|
||||
<header>
|
||||
<div class="grid-wrapper">
|
||||
<div class="grid">
|
||||
|
||||
<div class="grid__item three-tenths lap-two-sixths palm-one-whole ha-title">
|
||||
<a href="/" class="site-title">
|
||||
<img width='40' src='/demo/favicon-192x192.png'>
|
||||
<span>Home Assistant</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="grid__item seven-tenths lap-four-sixths palm-one-whole">
|
||||
<nav>
|
||||
<input type="checkbox" id="toggle">
|
||||
<label for="toggle" class="toggle" data-open="Main Menu" data-close="Close Menu"></label>
|
||||
<ul class="menu pull-right">
|
||||
|
||||
<li><a href="/getting-started/">Getting started</a></li>
|
||||
<li><a href="/components/">Components</a></li>
|
||||
<li><a href="/docs/">Docs</a></li>
|
||||
|
@ -64,38 +53,22 @@
|
|||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
|
||||
|
||||
<div class="grid-wrapper">
|
||||
<div class="grid grid-center">
|
||||
|
||||
<div class="grid__item two-thirds lap-one-whole palm-one-whole">
|
||||
|
||||
|
||||
<article class="page">
|
||||
|
||||
|
||||
<div class='edit-github'><a href='https://github.com/home-assistant/home-assistant.github.io/tree/current/source/_docs/mqtt/birth_will.markdown'>Edit this page on GitHub</a></div>
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
MQTT Birth and Last Will
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>MQTT supports so-called Birth and Last Will and Testament (LWT) messages. The former is used to send a message after the service has started, and the latter is used to notify other clients about an ungracefully disconnected client.</p>
|
||||
|
||||
<p>To integrate MQTT Birth and Last Will messages into Home Assistant, add the following section to your <code class="highlighter-rouge">configuration.yaml</code> file:</p>
|
||||
|
||||
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="c1"># Example configuration.yaml entry</span>
|
||||
<span class="s">mqtt</span><span class="pi">:</span>
|
||||
<span class="s">birth_message</span><span class="pi">:</span>
|
||||
|
@ -106,9 +79,7 @@
|
|||
<span class="s">payload</span><span class="pi">:</span> <span class="s1">'</span><span class="s">offline'</span>
|
||||
</code></pre>
|
||||
</div>
|
||||
|
||||
<p>Configuration variables:</p>
|
||||
|
||||
<ul>
|
||||
<li><strong>birth_message</strong> (<em>Optional</em>):
|
||||
<ul>
|
||||
|
@ -127,18 +98,10 @@
|
|||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</article>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<aside id="sidebar" class="grid__item one-third lap-one-whole palm-one-whole">
|
||||
<div class="grid">
|
||||
|
||||
|
||||
<section class="aside-module grid__item one-whole lap-one-half">
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Topics</h1>
|
||||
|
@ -325,13 +288,10 @@
|
|||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
<div class="grid-wrapper">
|
||||
<div class="grid">
|
||||
|
@ -341,7 +301,6 @@
|
|||
<a rel="me" href='https://facebook.com/homeassistantio'><i class="icon-facebook"></i></a>
|
||||
<a rel="me" href='https://plus.google.com/110560654828510104551'><i class="icon-google-plus"></i></a>
|
||||
<a rel="me" href='https://github.com/home-assistant/home-assistant'><i class="icon-github"></i></a>
|
||||
|
||||
<div class="credit">
|
||||
Contact us at <a href='mailto:hello@home-assistant.io'>hello@home-assistant.io</a>.<br>
|
||||
Website powered by <a href='http://jekyllrb.com/'>Jekyll</a> and the <a href='https://github.com/coogie/oscailte'>Oscalite theme</a>.<br />
|
||||
|
@ -353,7 +312,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script>
|
||||
var _gaq=[['_setAccount','UA-57927901-1'],['_trackPageview']];
|
||||
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
|
||||
|
@ -361,4 +319,4 @@
|
|||
s.parentNode.insertBefore(g,s)}(document,'script'));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
@ -3,17 +3,14 @@
|
|||
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
|
||||
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html> <!--<![endif]-->
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<title>MQTT Brokers - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Instructions how to setup MQTT brokers for Home Assistant.">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/docs/mqtt/broker/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="MQTT Brokers">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
|
@ -21,39 +18,31 @@
|
|||
<meta property="og:type" content="article">
|
||||
<meta property="og:description" content="Instructions how to setup MQTT brokers for Home Assistant.">
|
||||
<meta property="og:image" content="https://home-assistant.io/images/default-social.png">
|
||||
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta name="twitter:site" content="@home_assistant">
|
||||
|
||||
<meta name="twitter:title" content="MQTT Brokers">
|
||||
<meta name="twitter:description" content="Instructions how to setup MQTT brokers for Home Assistant.">
|
||||
<meta name="twitter:image" content="https://home-assistant.io/images/default-social.png">
|
||||
|
||||
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet">
|
||||
<link href="/atom.xml" rel="alternate" title="Home Assistant" type="application/atom+xml">
|
||||
<link rel='shortcut icon' href='/images/favicon.ico' />
|
||||
<link rel='icon' type='image/png' href='/images/favicon-192x192.png' sizes='192x192' />
|
||||
</head>
|
||||
|
||||
<body >
|
||||
|
||||
<header>
|
||||
<div class="grid-wrapper">
|
||||
<div class="grid">
|
||||
|
||||
<div class="grid__item three-tenths lap-two-sixths palm-one-whole ha-title">
|
||||
<a href="/" class="site-title">
|
||||
<img width='40' src='/demo/favicon-192x192.png'>
|
||||
<span>Home Assistant</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="grid__item seven-tenths lap-four-sixths palm-one-whole">
|
||||
<nav>
|
||||
<input type="checkbox" id="toggle">
|
||||
<label for="toggle" class="toggle" data-open="Main Menu" data-close="Close Menu"></label>
|
||||
<ul class="menu pull-right">
|
||||
|
||||
<li><a href="/getting-started/">Getting started</a></li>
|
||||
<li><a href="/components/">Components</a></li>
|
||||
<li><a href="/docs/">Docs</a></li>
|
||||
|
@ -64,40 +53,23 @@
|
|||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
|
||||
|
||||
<div class="grid-wrapper">
|
||||
<div class="grid grid-center">
|
||||
|
||||
<div class="grid__item two-thirds lap-one-whole palm-one-whole">
|
||||
|
||||
|
||||
<article class="page">
|
||||
|
||||
|
||||
<div class='edit-github'><a href='https://github.com/home-assistant/home-assistant.github.io/tree/current/source/_docs/mqtt/broker.markdown'>Edit this page on GitHub</a></div>
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
MQTT Brokers
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>The MQTT component needs you to run an MQTT broker for Home Assistant to connect to. There are four options, each with various degrees of ease of setup and privacy.</p>
|
||||
|
||||
<h3><a class="title-link" name="embedded-broker" href="#embedded-broker"></a> Embedded broker</h3>
|
||||
|
||||
<p>Home Assistant contains an embedded MQTT broker. If no broker configuration is given, the <a href="https://pypi.python.org/pypi/hbmqtt">HBMQTT broker</a> is started and Home Assistant connects to it. Embedded broker default configuration:</p>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -132,18 +104,14 @@
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="c1"># Example configuration.yaml entry</span>
|
||||
<span class="s">mqtt</span><span class="pi">:</span>
|
||||
</code></pre>
|
||||
</div>
|
||||
|
||||
<p class="note">
|
||||
This broker does not currently work with OwnTracks because of a protocol version issue.
|
||||
</p>
|
||||
|
||||
<p>If you want to customize the settings of the embedded broker, use <code class="highlighter-rouge">embedded:</code> and the values shown in the <a href="http://hbmqtt.readthedocs.org/en/latest/references/broker.html#broker-configuration">HBMQTT Broker configuration</a>. This will replace the default configuration.</p>
|
||||
|
||||
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="c1"># Example configuration.yaml entry</span>
|
||||
<span class="s">mqtt</span><span class="pi">:</span>
|
||||
<span class="s">embedded</span><span class="pi">:</span>
|
||||
|
@ -151,11 +119,8 @@ This broker does not currently work with OwnTracks because of a protocol version
|
|||
<span class="c1"># http://hbmqtt.readthedocs.org/en/latest/references/broker.html#broker-configuration</span>
|
||||
</code></pre>
|
||||
</div>
|
||||
|
||||
<h3><a class="title-link" name="run-your-own" href="#run-your-own"></a> Run your own</h3>
|
||||
|
||||
<p>This is the most private option but requires a bit more work. There are multiple free and open-source brokers to pick from: eg. <a href="http://mosquitto.org/">Mosquitto</a>, <a href="http://emqtt.io/">EMQ</a>, or <a href="http://www.mosca.io/">Mosca</a>.</p>
|
||||
|
||||
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="c1"># Example configuration.yaml entry</span>
|
||||
<span class="s">mqtt</span><span class="pi">:</span>
|
||||
<span class="s">broker</span><span class="pi">:</span> <span class="s">192.168.1.100</span>
|
||||
|
@ -167,9 +132,7 @@ This broker does not currently work with OwnTracks because of a protocol version
|
|||
<span class="s">protocol</span><span class="pi">:</span> <span class="s">3.1</span>
|
||||
</code></pre>
|
||||
</div>
|
||||
|
||||
<p>Configuration variables:</p>
|
||||
|
||||
<ul>
|
||||
<li><strong>broker</strong> (<em>Optional</em>): The IP address or hostname of your MQTT broker, e.g. 192.168.1.32.</li>
|
||||
<li><strong>port</strong> (<em>Optional</em>): The network port to connect to. Default is 1883.</li>
|
||||
|
@ -179,19 +142,14 @@ This broker does not currently work with OwnTracks because of a protocol version
|
|||
<li><strong>password</strong> (<em>Optional</em>): The corresponding password for the username to use with your MQTT broker.</li>
|
||||
<li><strong>protocol</strong> (<em>Optional</em>): Protocol to use: 3.1 or 3.1.1. By default it connects with 3.1.1 and falls back to 3.1 if server does not support 3.1.1.</li>
|
||||
</ul>
|
||||
|
||||
<p class="note warning">
|
||||
There is an issue with the Mosquitto package included in Ubuntu 14.04 LTS. Specify <code class="highlighter-rouge">protocol: 3.1</code> in your MQTT configuration to work around this issue.
|
||||
</p>
|
||||
|
||||
<p class="note">
|
||||
If you are running a mosquitto instance on a different server with proper SSL encryption using a service like letsencrypt you may have to set the certificate to the operating systems own <code class="highlighter-rouge">.crt</code> certificates file. In the instance of ubuntu this would be <code class="highlighter-rouge">certificate: /etc/ssl/certs/ca-certificates.crt</code>
|
||||
</p>
|
||||
|
||||
<h3><a class="title-link" name="public-broker" href="#public-broker"></a> Public broker</h3>
|
||||
|
||||
<p>The Mosquitto project runs a <a href="http://test.mosquitto.org">public broker</a>. This is the easiest to set up, but there is no privacy as all messages are public. Use this only for testing purposes and not for real tracking of your devices or controlling your home.</p>
|
||||
|
||||
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="s">mqtt</span><span class="pi">:</span>
|
||||
<span class="s">broker</span><span class="pi">:</span> <span class="s">test.mosquitto.org</span>
|
||||
<span class="s">port</span><span class="pi">:</span> <span class="s">1883 or 8883</span>
|
||||
|
@ -203,15 +161,11 @@ If you are running a mosquitto instance on a different server with proper SSL en
|
|||
<span class="s">certificate</span><span class="pi">:</span> <span class="s">/home/paulus/downloads/mosquitto.org.crt</span>
|
||||
</code></pre>
|
||||
</div>
|
||||
|
||||
<h3><a class="title-link" name="cloudmqtt" href="#cloudmqtt"></a> CloudMQTT</h3>
|
||||
|
||||
<p><a href="https://www.cloudmqtt.com">CloudMQTT</a> is a hosted private MQTT instance that is free for up to 10 connected devices. This is enough to get started with for example <a href="/components/device_tracker.owntracks/">OwnTracks</a> and give you a taste of what is possible.</p>
|
||||
|
||||
<p class="note">
|
||||
Home Assistant is not affiliated with CloudMQTT nor will receive any kickbacks.
|
||||
</p>
|
||||
|
||||
<ol>
|
||||
<li><a href="https://customer.cloudmqtt.com/login">Create an account</a> (no payment details needed)</li>
|
||||
<li><a href="https://customer.cloudmqtt.com/subscription/create">Create a new CloudMQTT instance</a>
|
||||
|
@ -225,7 +179,6 @@ Home Assistant is not affiliated with CloudMQTT nor will receive any kickbacks.
|
|||
</li>
|
||||
<li>Copy the instance info to your configuration.yaml:</li>
|
||||
</ol>
|
||||
|
||||
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="s">mqtt</span><span class="pi">:</span>
|
||||
<span class="s">broker</span><span class="pi">:</span> <span class="s">CLOUTMQTT_SERVER</span>
|
||||
<span class="s">port</span><span class="pi">:</span> <span class="s">CLOUDMQTT_PORT</span>
|
||||
|
@ -233,23 +186,13 @@ Home Assistant is not affiliated with CloudMQTT nor will receive any kickbacks.
|
|||
<span class="s">password</span><span class="pi">:</span> <span class="s">CLOUDMQTT_PASSWORD</span>
|
||||
</code></pre>
|
||||
</div>
|
||||
|
||||
<p class="note">
|
||||
Home Assistant will automatically load the correct certificate if you connect to an encrypted channel of CloudMQTT (port range 20000-30000).
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
</article>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<aside id="sidebar" class="grid__item one-third lap-one-whole palm-one-whole">
|
||||
<div class="grid">
|
||||
|
||||
|
||||
<section class="aside-module grid__item one-whole lap-one-half">
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Topics</h1>
|
||||
|
@ -436,13 +379,10 @@ Home Assistant will automatically load the correct certificate if you connect to
|
|||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
<div class="grid-wrapper">
|
||||
<div class="grid">
|
||||
|
@ -452,7 +392,6 @@ Home Assistant will automatically load the correct certificate if you connect to
|
|||
<a rel="me" href='https://facebook.com/homeassistantio'><i class="icon-facebook"></i></a>
|
||||
<a rel="me" href='https://plus.google.com/110560654828510104551'><i class="icon-google-plus"></i></a>
|
||||
<a rel="me" href='https://github.com/home-assistant/home-assistant'><i class="icon-github"></i></a>
|
||||
|
||||
<div class="credit">
|
||||
Contact us at <a href='mailto:hello@home-assistant.io'>hello@home-assistant.io</a>.<br>
|
||||
Website powered by <a href='http://jekyllrb.com/'>Jekyll</a> and the <a href='https://github.com/coogie/oscailte'>Oscalite theme</a>.<br />
|
||||
|
@ -464,7 +403,6 @@ Home Assistant will automatically load the correct certificate if you connect to
|
|||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script>
|
||||
var _gaq=[['_setAccount','UA-57927901-1'],['_trackPageview']];
|
||||
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
|
||||
|
@ -472,4 +410,4 @@ Home Assistant will automatically load the correct certificate if you connect to
|
|||
s.parentNode.insertBefore(g,s)}(document,'script'));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
@ -3,17 +3,14 @@
|
|||
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
|
||||
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html> <!--<![endif]-->
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<title>MQTT Certificate - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Instructions how to setup MQTT with a certificate in Home Assistant.">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/docs/mqtt/certificate/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="MQTT Certificate">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
|
@ -21,39 +18,31 @@
|
|||
<meta property="og:type" content="article">
|
||||
<meta property="og:description" content="Instructions how to setup MQTT with a certificate in Home Assistant.">
|
||||
<meta property="og:image" content="https://home-assistant.io/images/default-social.png">
|
||||
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta name="twitter:site" content="@home_assistant">
|
||||
|
||||
<meta name="twitter:title" content="MQTT Certificate">
|
||||
<meta name="twitter:description" content="Instructions how to setup MQTT with a certificate in Home Assistant.">
|
||||
<meta name="twitter:image" content="https://home-assistant.io/images/default-social.png">
|
||||
|
||||
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet">
|
||||
<link href="/atom.xml" rel="alternate" title="Home Assistant" type="application/atom+xml">
|
||||
<link rel='shortcut icon' href='/images/favicon.ico' />
|
||||
<link rel='icon' type='image/png' href='/images/favicon-192x192.png' sizes='192x192' />
|
||||
</head>
|
||||
|
||||
<body >
|
||||
|
||||
<header>
|
||||
<div class="grid-wrapper">
|
||||
<div class="grid">
|
||||
|
||||
<div class="grid__item three-tenths lap-two-sixths palm-one-whole ha-title">
|
||||
<a href="/" class="site-title">
|
||||
<img width='40' src='/demo/favicon-192x192.png'>
|
||||
<span>Home Assistant</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="grid__item seven-tenths lap-four-sixths palm-one-whole">
|
||||
<nav>
|
||||
<input type="checkbox" id="toggle">
|
||||
<label for="toggle" class="toggle" data-open="Main Menu" data-close="Close Menu"></label>
|
||||
<ul class="menu pull-right">
|
||||
|
||||
<li><a href="/getting-started/">Getting started</a></li>
|
||||
<li><a href="/components/">Components</a></li>
|
||||
<li><a href="/docs/">Docs</a></li>
|
||||
|
@ -64,64 +53,37 @@
|
|||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
|
||||
|
||||
<div class="grid-wrapper">
|
||||
<div class="grid grid-center">
|
||||
|
||||
<div class="grid__item two-thirds lap-one-whole palm-one-whole">
|
||||
|
||||
|
||||
<article class="page">
|
||||
|
||||
|
||||
<div class='edit-github'><a href='https://github.com/home-assistant/home-assistant.github.io/tree/current/source/_docs/mqtt/certificate.markdown'>Edit this page on GitHub</a></div>
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
MQTT Certificate
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>Using certificates will give you an additional layer of security for your MQTT communication.</p>
|
||||
|
||||
<p>To integrate MQTT with certificate into Home Assistant, add the following section to your <code class="highlighter-rouge">configuration.yaml</code> file:</p>
|
||||
|
||||
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="c1"># Example configuration.yaml entry</span>
|
||||
<span class="s">mqtt</span><span class="pi">:</span>
|
||||
<span class="s">certificate</span><span class="pi">:</span> <span class="s">/home/paulus/dev/addtrustexternalcaroot.crt</span>
|
||||
</code></pre>
|
||||
</div>
|
||||
|
||||
<p>Configuration variables:</p>
|
||||
|
||||
<ul>
|
||||
<li><strong>certificate</strong> (<em>Optional</em>): The certificate authority certificate file that is to be treated as trusted by this client. This file should contain the root certificate of the certificate authority that signed your broker’s certificate, but may contain multiple certificates. Example: <code class="highlighter-rouge">/home/user/identrust-root.pem</code></li>
|
||||
<li><strong>client_key</strong> (<em>Optional</em>): Client key, eg. <code class="highlighter-rouge">/home/user/owntracks/cookie.key</code>.</li>
|
||||
<li><strong>client_cert</strong> (<em>Optional</em>): Client certificate, eg. <code class="highlighter-rouge">/home/user/owntracks/cookie.crt</code>.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</article>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<aside id="sidebar" class="grid__item one-third lap-one-whole palm-one-whole">
|
||||
<div class="grid">
|
||||
|
||||
|
||||
<section class="aside-module grid__item one-whole lap-one-half">
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Topics</h1>
|
||||
|
@ -308,13 +270,10 @@
|
|||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
<div class="grid-wrapper">
|
||||
<div class="grid">
|
||||
|
@ -324,7 +283,6 @@
|
|||
<a rel="me" href='https://facebook.com/homeassistantio'><i class="icon-facebook"></i></a>
|
||||
<a rel="me" href='https://plus.google.com/110560654828510104551'><i class="icon-google-plus"></i></a>
|
||||
<a rel="me" href='https://github.com/home-assistant/home-assistant'><i class="icon-github"></i></a>
|
||||
|
||||
<div class="credit">
|
||||
Contact us at <a href='mailto:hello@home-assistant.io'>hello@home-assistant.io</a>.<br>
|
||||
Website powered by <a href='http://jekyllrb.com/'>Jekyll</a> and the <a href='https://github.com/coogie/oscailte'>Oscalite theme</a>.<br />
|
||||
|
@ -336,7 +294,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script>
|
||||
var _gaq=[['_setAccount','UA-57927901-1'],['_trackPageview']];
|
||||
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
|
||||
|
@ -344,4 +301,4 @@
|
|||
s.parentNode.insertBefore(g,s)}(document,'script'));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
@ -3,17 +3,14 @@
|
|||
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
|
||||
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html> <!--<![endif]-->
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<title>MQTT Discovery - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Instructions how to setup MQTT Discovery within Home Assistant.">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/docs/mqtt/discovery/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="MQTT Discovery">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
|
@ -21,39 +18,31 @@
|
|||
<meta property="og:type" content="article">
|
||||
<meta property="og:description" content="Instructions how to setup MQTT Discovery within Home Assistant.">
|
||||
<meta property="og:image" content="https://home-assistant.io/images/default-social.png">
|
||||
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta name="twitter:site" content="@home_assistant">
|
||||
|
||||
<meta name="twitter:title" content="MQTT Discovery">
|
||||
<meta name="twitter:description" content="Instructions how to setup MQTT Discovery within Home Assistant.">
|
||||
<meta name="twitter:image" content="https://home-assistant.io/images/default-social.png">
|
||||
|
||||
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet">
|
||||
<link href="/atom.xml" rel="alternate" title="Home Assistant" type="application/atom+xml">
|
||||
<link rel='shortcut icon' href='/images/favicon.ico' />
|
||||
<link rel='icon' type='image/png' href='/images/favicon-192x192.png' sizes='192x192' />
|
||||
</head>
|
||||
|
||||
<body >
|
||||
|
||||
<header>
|
||||
<div class="grid-wrapper">
|
||||
<div class="grid">
|
||||
|
||||
<div class="grid__item three-tenths lap-two-sixths palm-one-whole ha-title">
|
||||
<a href="/" class="site-title">
|
||||
<img width='40' src='/demo/favicon-192x192.png'>
|
||||
<span>Home Assistant</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="grid__item seven-tenths lap-four-sixths palm-one-whole">
|
||||
<nav>
|
||||
<input type="checkbox" id="toggle">
|
||||
<label for="toggle" class="toggle" data-open="Main Menu" data-close="Close Menu"></label>
|
||||
<ul class="menu pull-right">
|
||||
|
||||
<li><a href="/getting-started/">Getting started</a></li>
|
||||
<li><a href="/components/">Components</a></li>
|
||||
<li><a href="/docs/">Docs</a></li>
|
||||
|
@ -64,38 +53,22 @@
|
|||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
|
||||
|
||||
<div class="grid-wrapper">
|
||||
<div class="grid grid-center">
|
||||
|
||||
<div class="grid__item two-thirds lap-one-whole palm-one-whole">
|
||||
|
||||
|
||||
<article class="page">
|
||||
|
||||
|
||||
<div class='edit-github'><a href='https://github.com/home-assistant/home-assistant.github.io/tree/current/source/_docs/mqtt/discovery.markdown'>Edit this page on GitHub</a></div>
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
MQTT Discovery
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>The discovery of MQTT devices will enable one to use MQTT devices with only minimal configuration effort on the side of Home Assistant. The configuration is done on the device itself and the topic used by the device. Similar to the <a href="/components/binary_sensor.http/">HTTP binary sensor</a> and the <a href="/components/sensor.http/">HTTP sensor</a>. Currently, binary sensors, lights and sensors are supported. A discovery binary sensor or sensor will load the <code class="highlighter-rouge">mqtt</code> platform. For discovered light components the JSON payload can contain a <code class="highlighter-rouge">platform</code> attribute with one of <code class="highlighter-rouge">mqtt</code>, <code class="highlighter-rouge">mqtt_json</code> or <code class="highlighter-rouge">mqtt_template</code> defined. If no <code class="highlighter-rouge">platform</code> attribute is defined then <code class="highlighter-rouge">mqtt</code> is used.</p>
|
||||
|
||||
<p>To enable MQTT discovery, add the following to your <code class="highlighter-rouge">configuration.yaml</code> file:</p>
|
||||
|
||||
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="c1"># Example configuration.yaml entry</span>
|
||||
<span class="s">mqtt</span><span class="pi">:</span>
|
||||
<span class="s">discovery</span><span class="pi">:</span> <span class="s">true</span>
|
||||
|
@ -103,59 +76,39 @@
|
|||
</code></pre>
|
||||
</div>
|
||||
<p>Configuration variables:</p>
|
||||
|
||||
<ul>
|
||||
<li><strong>discovery</strong> (<em>Optional</em>): If the MQTT discovery should be enabled or not. Defaults to <code class="highlighter-rouge">False</code>.</li>
|
||||
<li><strong>discovery_prefix</strong> (<em>Optional</em>): The prefix for the discovery topic. Defaults to <code class="highlighter-rouge">homeassistant</code>.</li>
|
||||
</ul>
|
||||
|
||||
<p>The discovery topic need to follow a specific format:</p>
|
||||
|
||||
<div class="language-text highlighter-rouge"><pre class="highlight"><code><discovery_prefix>/<component>/<object_id>/<>
|
||||
</code></pre>
|
||||
</div>
|
||||
|
||||
<ul>
|
||||
<li><code class="highlighter-rouge"><component></code>: One of the supported components, eg. <code class="highlighter-rouge">binary_sensor</code>.</li>
|
||||
<li><code class="highlighter-rouge"><object_id></code>: The ID of the device. This will become the <code class="highlighter-rouge">entity_id</code> in Home Assistant.</li>
|
||||
<li><code class="highlighter-rouge"><config></code>: The topic <code class="highlighter-rouge">config</code> or <code class="highlighter-rouge">state</code> which defines the current action.</li>
|
||||
</ul>
|
||||
|
||||
<p>The payload will be checked like an entry in your <code class="highlighter-rouge">configuration.yaml</code> file if a new device is added. This means that missing variables will be filled with the platform’s default values.</p>
|
||||
|
||||
<h3><a class="title-link" name="example" href="#example"></a> Example</h3>
|
||||
|
||||
<p>A motion detection device which can be represented by a <a href="/components/binary_sensor.mqtt/">binary sensor</a> for your garden would sent its configuration as JSON payload to the Configuration topic. After the first message to <code class="highlighter-rouge">config</code>, then the MQTT messages sent to the State topic will update the state in Home Assistant.</p>
|
||||
|
||||
<ul>
|
||||
<li>Configuration topic: <code class="highlighter-rouge">homeassistant/binary_sensor/garden/config</code></li>
|
||||
<li>State topic: <code class="highlighter-rouge">homeassistant/binary_sensor/garden/state</code></li>
|
||||
<li>Payload: <code class="highlighter-rouge"><span class="p">{</span><span class="nt">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"garden"</span><span class="p">,</span><span class="w"> </span><span class="nt">"device_class"</span><span class="p">:</span><span class="w"> </span><span class="s2">"motion"</span><span class="p">}</span></code></li>
|
||||
</ul>
|
||||
|
||||
<p>To create a new sensor manually. For more details please refer to the <a href="/component/mqtt_testing">MQTT testing section</a>.</p>
|
||||
|
||||
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>mosquitto_pub -h 127.0.0.1 -p 1883 -t <span class="s2">"homeassistant/binary_sensor/garden/config"</span> -m <span class="s1">'{"name": "garden", "device_class": "motion"}'</span>
|
||||
</code></pre>
|
||||
</div>
|
||||
<p>Update the state.</p>
|
||||
|
||||
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>mosquitto_pub -h 127.0.0.1 -p 1883 -t <span class="s2">"homeassistant/binary_sensor/garden/state"</span> -m ON
|
||||
</code></pre>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</article>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<aside id="sidebar" class="grid__item one-third lap-one-whole palm-one-whole">
|
||||
<div class="grid">
|
||||
|
||||
|
||||
<section class="aside-module grid__item one-whole lap-one-half">
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Topics</h1>
|
||||
|
@ -342,13 +295,10 @@
|
|||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
<div class="grid-wrapper">
|
||||
<div class="grid">
|
||||
|
@ -358,7 +308,6 @@
|
|||
<a rel="me" href='https://facebook.com/homeassistantio'><i class="icon-facebook"></i></a>
|
||||
<a rel="me" href='https://plus.google.com/110560654828510104551'><i class="icon-google-plus"></i></a>
|
||||
<a rel="me" href='https://github.com/home-assistant/home-assistant'><i class="icon-github"></i></a>
|
||||
|
||||
<div class="credit">
|
||||
Contact us at <a href='mailto:hello@home-assistant.io'>hello@home-assistant.io</a>.<br>
|
||||
Website powered by <a href='http://jekyllrb.com/'>Jekyll</a> and the <a href='https://github.com/coogie/oscailte'>Oscalite theme</a>.<br />
|
||||
|
@ -370,7 +319,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script>
|
||||
var _gaq=[['_setAccount','UA-57927901-1'],['_trackPageview']];
|
||||
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
|
||||
|
@ -378,4 +326,4 @@
|
|||
s.parentNode.insertBefore(g,s)}(document,'script'));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
@ -3,17 +3,14 @@
|
|||
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
|
||||
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html> <!--<![endif]-->
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<title>MQTT - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Details about the MQTT support of Home Assistant.">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/docs/mqtt/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="MQTT">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
|
@ -21,39 +18,31 @@
|
|||
<meta property="og:type" content="article">
|
||||
<meta property="og:description" content="Details about the MQTT support of Home Assistant.">
|
||||
<meta property="og:image" content="https://home-assistant.io/images/default-social.png">
|
||||
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta name="twitter:site" content="@home_assistant">
|
||||
|
||||
<meta name="twitter:title" content="MQTT">
|
||||
<meta name="twitter:description" content="Details about the MQTT support of Home Assistant.">
|
||||
<meta name="twitter:image" content="https://home-assistant.io/images/default-social.png">
|
||||
|
||||
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet">
|
||||
<link href="/atom.xml" rel="alternate" title="Home Assistant" type="application/atom+xml">
|
||||
<link rel='shortcut icon' href='/images/favicon.ico' />
|
||||
<link rel='icon' type='image/png' href='/images/favicon-192x192.png' sizes='192x192' />
|
||||
</head>
|
||||
|
||||
<body >
|
||||
|
||||
<header>
|
||||
<div class="grid-wrapper">
|
||||
<div class="grid">
|
||||
|
||||
<div class="grid__item three-tenths lap-two-sixths palm-one-whole ha-title">
|
||||
<a href="/" class="site-title">
|
||||
<img width='40' src='/demo/favicon-192x192.png'>
|
||||
<span>Home Assistant</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="grid__item seven-tenths lap-four-sixths palm-one-whole">
|
||||
<nav>
|
||||
<input type="checkbox" id="toggle">
|
||||
<label for="toggle" class="toggle" data-open="Main Menu" data-close="Close Menu"></label>
|
||||
<ul class="menu pull-right">
|
||||
|
||||
<li><a href="/getting-started/">Getting started</a></li>
|
||||
<li><a href="/components/">Components</a></li>
|
||||
<li><a href="/docs/">Docs</a></li>
|
||||
|
@ -64,47 +53,28 @@
|
|||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
|
||||
|
||||
<div class="grid-wrapper">
|
||||
<div class="grid grid-center">
|
||||
|
||||
<div class="grid__item two-thirds lap-one-whole palm-one-whole">
|
||||
|
||||
|
||||
<article class="page">
|
||||
|
||||
|
||||
<div class='edit-github'><a href='https://github.com/home-assistant/home-assistant.github.io/tree/current/source/_docs/mqtt.markdown'>Edit this page on GitHub</a></div>
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
MQTT
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>MQTT (aka MQ Telemetry Transport) is a machine-to-machine or “Internet of Things” connectivity protocol on top of TCP/IP. It allows extremely lightweight publish/subscribe messaging transport.</p>
|
||||
|
||||
<p>To integrate MQTT into Home Assistant, add the following section to your <code class="highlighter-rouge">configuration.yaml</code> file. Keep in mind that the minimal setup will run with <a href="/docs/mqtt/broker#embedded-broker">an embedded MQTT broker</a>:</p>
|
||||
|
||||
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="c1"># Example configuration.yaml entry</span>
|
||||
<span class="s">mqtt</span><span class="pi">:</span>
|
||||
</code></pre>
|
||||
</div>
|
||||
|
||||
<p>For other setup methods, please refer to the <a href="/docs/mqtt/broker">MQTT broker</a> documentation.</p>
|
||||
|
||||
<h2><a class="title-link" name="additional-features" href="#additional-features"></a> Additional features</h2>
|
||||
|
||||
<ul>
|
||||
<li><a href="/docs/mqtt/certificate/">Certificate</a></li>
|
||||
<li><a href="/docs/mqtt/discovery/">Discovery</a></li>
|
||||
|
@ -114,20 +84,11 @@
|
|||
<li><a href="/docs/mqtt/logging/">Logging</a></li>
|
||||
<li><a href="/docs/mqtt/processing_json/">Processing JSON</a></li>
|
||||
</ul>
|
||||
|
||||
<p>See the <a href="/cookbook/python_component_mqtt_basic/">MQTT example component</a> how to integrate your own component.</p>
|
||||
|
||||
|
||||
</article>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<aside id="sidebar" class="grid__item one-third lap-one-whole palm-one-whole">
|
||||
<div class="grid">
|
||||
|
||||
|
||||
<section class="aside-module grid__item one-whole lap-one-half">
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Topics</h1>
|
||||
|
@ -314,13 +275,10 @@
|
|||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
<div class="grid-wrapper">
|
||||
<div class="grid">
|
||||
|
@ -330,7 +288,6 @@
|
|||
<a rel="me" href='https://facebook.com/homeassistantio'><i class="icon-facebook"></i></a>
|
||||
<a rel="me" href='https://plus.google.com/110560654828510104551'><i class="icon-google-plus"></i></a>
|
||||
<a rel="me" href='https://github.com/home-assistant/home-assistant'><i class="icon-github"></i></a>
|
||||
|
||||
<div class="credit">
|
||||
Contact us at <a href='mailto:hello@home-assistant.io'>hello@home-assistant.io</a>.<br>
|
||||
Website powered by <a href='http://jekyllrb.com/'>Jekyll</a> and the <a href='https://github.com/coogie/oscailte'>Oscalite theme</a>.<br />
|
||||
|
@ -342,7 +299,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script>
|
||||
var _gaq=[['_setAccount','UA-57927901-1'],['_trackPageview']];
|
||||
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
|
||||
|
@ -350,4 +306,4 @@
|
|||
s.parentNode.insertBefore(g,s)}(document,'script'));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
@ -3,17 +3,14 @@
|
|||
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
|
||||
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html> <!--<![endif]-->
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<title>MQTT Logging - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Instructions how to setup MQTT Logging within Home Assistant.">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/docs/mqtt/logging/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="MQTT Logging">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
|
@ -21,39 +18,31 @@
|
|||
<meta property="og:type" content="article">
|
||||
<meta property="og:description" content="Instructions how to setup MQTT Logging within Home Assistant.">
|
||||
<meta property="og:image" content="https://home-assistant.io/images/default-social.png">
|
||||
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta name="twitter:site" content="@home_assistant">
|
||||
|
||||
<meta name="twitter:title" content="MQTT Logging">
|
||||
<meta name="twitter:description" content="Instructions how to setup MQTT Logging within Home Assistant.">
|
||||
<meta name="twitter:image" content="https://home-assistant.io/images/default-social.png">
|
||||
|
||||
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet">
|
||||
<link href="/atom.xml" rel="alternate" title="Home Assistant" type="application/atom+xml">
|
||||
<link rel='shortcut icon' href='/images/favicon.ico' />
|
||||
<link rel='icon' type='image/png' href='/images/favicon-192x192.png' sizes='192x192' />
|
||||
</head>
|
||||
|
||||
<body >
|
||||
|
||||
<header>
|
||||
<div class="grid-wrapper">
|
||||
<div class="grid">
|
||||
|
||||
<div class="grid__item three-tenths lap-two-sixths palm-one-whole ha-title">
|
||||
<a href="/" class="site-title">
|
||||
<img width='40' src='/demo/favicon-192x192.png'>
|
||||
<span>Home Assistant</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="grid__item seven-tenths lap-four-sixths palm-one-whole">
|
||||
<nav>
|
||||
<input type="checkbox" id="toggle">
|
||||
<label for="toggle" class="toggle" data-open="Main Menu" data-close="Close Menu"></label>
|
||||
<ul class="menu pull-right">
|
||||
|
||||
<li><a href="/getting-started/">Getting started</a></li>
|
||||
<li><a href="/components/">Components</a></li>
|
||||
<li><a href="/docs/">Docs</a></li>
|
||||
|
@ -64,36 +53,21 @@
|
|||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
|
||||
|
||||
<div class="grid-wrapper">
|
||||
<div class="grid grid-center">
|
||||
|
||||
<div class="grid__item two-thirds lap-one-whole palm-one-whole">
|
||||
|
||||
|
||||
<article class="page">
|
||||
|
||||
|
||||
<div class='edit-github'><a href='https://github.com/home-assistant/home-assistant.github.io/tree/current/source/_docs/mqtt/logging.markdown'>Edit this page on GitHub</a></div>
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
MQTT Logging
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>The <a href="/components/logger/">logger</a> component allow the logging of received MQTT messages.</p>
|
||||
|
||||
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="c1"># Example configuration.yaml entry</span>
|
||||
<span class="s">logger</span><span class="pi">:</span>
|
||||
<span class="s">default</span><span class="pi">:</span> <span class="s">warning</span>
|
||||
|
@ -101,19 +75,10 @@
|
|||
<span class="s">homeassistant.components.device_tracker.mqtt</span><span class="pi">:</span> <span class="s">debug</span>
|
||||
</code></pre>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</article>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<aside id="sidebar" class="grid__item one-third lap-one-whole palm-one-whole">
|
||||
<div class="grid">
|
||||
|
||||
|
||||
<section class="aside-module grid__item one-whole lap-one-half">
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Topics</h1>
|
||||
|
@ -300,13 +265,10 @@
|
|||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
<div class="grid-wrapper">
|
||||
<div class="grid">
|
||||
|
@ -316,7 +278,6 @@
|
|||
<a rel="me" href='https://facebook.com/homeassistantio'><i class="icon-facebook"></i></a>
|
||||
<a rel="me" href='https://plus.google.com/110560654828510104551'><i class="icon-google-plus"></i></a>
|
||||
<a rel="me" href='https://github.com/home-assistant/home-assistant'><i class="icon-github"></i></a>
|
||||
|
||||
<div class="credit">
|
||||
Contact us at <a href='mailto:hello@home-assistant.io'>hello@home-assistant.io</a>.<br>
|
||||
Website powered by <a href='http://jekyllrb.com/'>Jekyll</a> and the <a href='https://github.com/coogie/oscailte'>Oscalite theme</a>.<br />
|
||||
|
@ -328,7 +289,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script>
|
||||
var _gaq=[['_setAccount','UA-57927901-1'],['_trackPageview']];
|
||||
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
|
||||
|
@ -336,4 +296,4 @@
|
|||
s.parentNode.insertBefore(g,s)}(document,'script'));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
@ -3,17 +3,14 @@
|
|||
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
|
||||
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html> <!--<![endif]-->
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<title>Processing JSON - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Instructions how to process the MQTT payload.">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/docs/mqtt/processing_json/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Processing JSON">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
|
@ -21,39 +18,31 @@
|
|||
<meta property="og:type" content="article">
|
||||
<meta property="og:description" content="Instructions how to process the MQTT payload.">
|
||||
<meta property="og:image" content="https://home-assistant.io/images/default-social.png">
|
||||
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta name="twitter:site" content="@home_assistant">
|
||||
|
||||
<meta name="twitter:title" content="Processing JSON">
|
||||
<meta name="twitter:description" content="Instructions how to process the MQTT payload.">
|
||||
<meta name="twitter:image" content="https://home-assistant.io/images/default-social.png">
|
||||
|
||||
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet">
|
||||
<link href="/atom.xml" rel="alternate" title="Home Assistant" type="application/atom+xml">
|
||||
<link rel='shortcut icon' href='/images/favicon.ico' />
|
||||
<link rel='icon' type='image/png' href='/images/favicon-192x192.png' sizes='192x192' />
|
||||
</head>
|
||||
|
||||
<body >
|
||||
|
||||
<header>
|
||||
<div class="grid-wrapper">
|
||||
<div class="grid">
|
||||
|
||||
<div class="grid__item three-tenths lap-two-sixths palm-one-whole ha-title">
|
||||
<a href="/" class="site-title">
|
||||
<img width='40' src='/demo/favicon-192x192.png'>
|
||||
<span>Home Assistant</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="grid__item seven-tenths lap-four-sixths palm-one-whole">
|
||||
<nav>
|
||||
<input type="checkbox" id="toggle">
|
||||
<label for="toggle" class="toggle" data-open="Main Menu" data-close="Close Menu"></label>
|
||||
<ul class="menu pull-right">
|
||||
|
||||
<li><a href="/getting-started/">Getting started</a></li>
|
||||
<li><a href="/components/">Components</a></li>
|
||||
<li><a href="/docs/">Docs</a></li>
|
||||
|
@ -64,36 +53,21 @@
|
|||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
|
||||
|
||||
<div class="grid-wrapper">
|
||||
<div class="grid grid-center">
|
||||
|
||||
<div class="grid__item two-thirds lap-one-whole palm-one-whole">
|
||||
|
||||
|
||||
<article class="page">
|
||||
|
||||
|
||||
<div class='edit-github'><a href='https://github.com/home-assistant/home-assistant.github.io/tree/current/source/_docs/mqtt/processing_json.markdown'>Edit this page on GitHub</a></div>
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
Processing JSON
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>The MQTT <a href="/components/switch.mqtt/">switch</a> and <a href="/components/sensor.mqtt/">sensor</a> platforms support processing JSON over MQTT messages and parsing them using JSONPath. JSONPath allows you to specify where in the JSON the value resides that you want to use. The following examples will always return the value <code class="highlighter-rouge">100</code>.</p>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -116,35 +90,23 @@
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p>To use this, add the following key to your <code class="highlighter-rouge">configuration.yaml</code>:</p>
|
||||
|
||||
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="s">switch</span><span class="pi">:</span>
|
||||
<span class="s">platform</span><span class="pi">:</span> <span class="s">mqtt</span>
|
||||
<span class="s">state_format</span><span class="pi">:</span> <span class="s1">'</span><span class="s">json:somekey[0].value'</span>
|
||||
</code></pre>
|
||||
</div>
|
||||
<p>It is also possible to extract JSON values by using a value template:</p>
|
||||
|
||||
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="s">switch</span><span class="pi">:</span>
|
||||
<span class="s">platform</span><span class="pi">:</span> <span class="s">mqtt</span>
|
||||
<span class="s">value_template</span><span class="pi">:</span> <span class="s1">'</span><span class="s">{{</span><span class="nv"> </span><span class="s">value_json.somekey[0].value</span><span class="nv"> </span><span class="s">}}'</span>
|
||||
</code></pre>
|
||||
</div>
|
||||
|
||||
<p>More information about the full JSONPath syntax can be found <a href="https://github.com/kennknowles/python-jsonpath-rw#jsonpath-syntax">in their documentation</a>.</p>
|
||||
|
||||
|
||||
</article>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<aside id="sidebar" class="grid__item one-third lap-one-whole palm-one-whole">
|
||||
<div class="grid">
|
||||
|
||||
|
||||
<section class="aside-module grid__item one-whole lap-one-half">
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Topics</h1>
|
||||
|
@ -331,13 +293,10 @@
|
|||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
<div class="grid-wrapper">
|
||||
<div class="grid">
|
||||
|
@ -347,7 +306,6 @@
|
|||
<a rel="me" href='https://facebook.com/homeassistantio'><i class="icon-facebook"></i></a>
|
||||
<a rel="me" href='https://plus.google.com/110560654828510104551'><i class="icon-google-plus"></i></a>
|
||||
<a rel="me" href='https://github.com/home-assistant/home-assistant'><i class="icon-github"></i></a>
|
||||
|
||||
<div class="credit">
|
||||
Contact us at <a href='mailto:hello@home-assistant.io'>hello@home-assistant.io</a>.<br>
|
||||
Website powered by <a href='http://jekyllrb.com/'>Jekyll</a> and the <a href='https://github.com/coogie/oscailte'>Oscalite theme</a>.<br />
|
||||
|
@ -359,7 +317,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script>
|
||||
var _gaq=[['_setAccount','UA-57927901-1'],['_trackPageview']];
|
||||
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
|
||||
|
@ -367,4 +324,4 @@
|
|||
s.parentNode.insertBefore(g,s)}(document,'script'));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
@ -3,17 +3,14 @@
|
|||
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
|
||||
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html> <!--<![endif]-->
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<title>MQTT Publish service - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Instructions how to setup the MQTT Publish service within Home Assistant.">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/docs/mqtt/service/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="MQTT Publish service">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
|
@ -21,39 +18,31 @@
|
|||
<meta property="og:type" content="article">
|
||||
<meta property="og:description" content="Instructions how to setup the MQTT Publish service within Home Assistant.">
|
||||
<meta property="og:image" content="https://home-assistant.io/images/default-social.png">
|
||||
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta name="twitter:site" content="@home_assistant">
|
||||
|
||||
<meta name="twitter:title" content="MQTT Publish service">
|
||||
<meta name="twitter:description" content="Instructions how to setup the MQTT Publish service within Home Assistant.">
|
||||
<meta name="twitter:image" content="https://home-assistant.io/images/default-social.png">
|
||||
|
||||
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet">
|
||||
<link href="/atom.xml" rel="alternate" title="Home Assistant" type="application/atom+xml">
|
||||
<link rel='shortcut icon' href='/images/favicon.ico' />
|
||||
<link rel='icon' type='image/png' href='/images/favicon-192x192.png' sizes='192x192' />
|
||||
</head>
|
||||
|
||||
<body >
|
||||
|
||||
<header>
|
||||
<div class="grid-wrapper">
|
||||
<div class="grid">
|
||||
|
||||
<div class="grid__item three-tenths lap-two-sixths palm-one-whole ha-title">
|
||||
<a href="/" class="site-title">
|
||||
<img width='40' src='/demo/favicon-192x192.png'>
|
||||
<span>Home Assistant</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="grid__item seven-tenths lap-four-sixths palm-one-whole">
|
||||
<nav>
|
||||
<input type="checkbox" id="toggle">
|
||||
<label for="toggle" class="toggle" data-open="Main Menu" data-close="Close Menu"></label>
|
||||
<ul class="menu pull-right">
|
||||
|
||||
<li><a href="/getting-started/">Getting started</a></li>
|
||||
<li><a href="/components/">Components</a></li>
|
||||
<li><a href="/docs/">Docs</a></li>
|
||||
|
@ -64,62 +53,37 @@
|
|||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
|
||||
|
||||
<div class="grid-wrapper">
|
||||
<div class="grid grid-center">
|
||||
|
||||
<div class="grid__item two-thirds lap-one-whole palm-one-whole">
|
||||
|
||||
|
||||
<article class="page">
|
||||
|
||||
|
||||
<div class='edit-github'><a href='https://github.com/home-assistant/home-assistant.github.io/tree/current/source/_docs/mqtt/service.markdown'>Edit this page on GitHub</a></div>
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
MQTT Publish Service
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>The MQTT component will register the service <code class="highlighter-rouge">publish</code> which allows publishing messages to MQTT topics. There are two ways of specifying your payload. You can either use <code class="highlighter-rouge">payload</code> to hard-code a payload or use <code class="highlighter-rouge">payload_template</code> to specify a <a href="/topics/templating/">template</a> that will be rendered to generate the payload.</p>
|
||||
|
||||
<div class="language-json highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="w">
|
||||
</span><span class="nt">"topic"</span><span class="p">:</span><span class="w"> </span><span class="s2">"home-assistant/light/1/command"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="nt">"payload"</span><span class="p">:</span><span class="w"> </span><span class="s2">"on"</span><span class="w">
|
||||
</span><span class="p">}</span><span class="w">
|
||||
</span></code></pre>
|
||||
</div>
|
||||
|
||||
<div class="language-json highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="w">
|
||||
</span><span class="nt">"topic"</span><span class="p">:</span><span class="w"> </span><span class="s2">"home-assistant/light/1/state"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="nt">"payload_template"</span><span class="p">:</span><span class="w"> </span><span class="s2">"{{ states('device_tracker.paulus') }}"</span><span class="w">
|
||||
</span><span class="p">}</span><span class="w">
|
||||
</span></code></pre>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</article>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<aside id="sidebar" class="grid__item one-third lap-one-whole palm-one-whole">
|
||||
<div class="grid">
|
||||
|
||||
|
||||
<section class="aside-module grid__item one-whole lap-one-half">
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Topics</h1>
|
||||
|
@ -306,13 +270,10 @@
|
|||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
<div class="grid-wrapper">
|
||||
<div class="grid">
|
||||
|
@ -322,7 +283,6 @@
|
|||
<a rel="me" href='https://facebook.com/homeassistantio'><i class="icon-facebook"></i></a>
|
||||
<a rel="me" href='https://plus.google.com/110560654828510104551'><i class="icon-google-plus"></i></a>
|
||||
<a rel="me" href='https://github.com/home-assistant/home-assistant'><i class="icon-github"></i></a>
|
||||
|
||||
<div class="credit">
|
||||
Contact us at <a href='mailto:hello@home-assistant.io'>hello@home-assistant.io</a>.<br>
|
||||
Website powered by <a href='http://jekyllrb.com/'>Jekyll</a> and the <a href='https://github.com/coogie/oscailte'>Oscalite theme</a>.<br />
|
||||
|
@ -334,7 +294,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script>
|
||||
var _gaq=[['_setAccount','UA-57927901-1'],['_trackPageview']];
|
||||
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
|
||||
|
@ -342,4 +301,4 @@
|
|||
s.parentNode.insertBefore(g,s)}(document,'script'));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
@ -3,17 +3,14 @@
|
|||
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
|
||||
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html> <!--<![endif]-->
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<title>MQTT Testing - Home Assistant</title>
|
||||
<meta name="author" content="Home Assistant">
|
||||
<meta name="description" content="Instructions how to test your MQTT setup.">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/docs/mqtt/testing/">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="MQTT Testing">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
|
@ -21,39 +18,31 @@
|
|||
<meta property="og:type" content="article">
|
||||
<meta property="og:description" content="Instructions how to test your MQTT setup.">
|
||||
<meta property="og:image" content="https://home-assistant.io/images/default-social.png">
|
||||
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta name="twitter:site" content="@home_assistant">
|
||||
|
||||
<meta name="twitter:title" content="MQTT Testing">
|
||||
<meta name="twitter:description" content="Instructions how to test your MQTT setup.">
|
||||
<meta name="twitter:image" content="https://home-assistant.io/images/default-social.png">
|
||||
|
||||
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet">
|
||||
<link href="/atom.xml" rel="alternate" title="Home Assistant" type="application/atom+xml">
|
||||
<link rel='shortcut icon' href='/images/favicon.ico' />
|
||||
<link rel='icon' type='image/png' href='/images/favicon-192x192.png' sizes='192x192' />
|
||||
</head>
|
||||
|
||||
<body >
|
||||
|
||||
<header>
|
||||
<div class="grid-wrapper">
|
||||
<div class="grid">
|
||||
|
||||
<div class="grid__item three-tenths lap-two-sixths palm-one-whole ha-title">
|
||||
<a href="/" class="site-title">
|
||||
<img width='40' src='/demo/favicon-192x192.png'>
|
||||
<span>Home Assistant</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="grid__item seven-tenths lap-four-sixths palm-one-whole">
|
||||
<nav>
|
||||
<input type="checkbox" id="toggle">
|
||||
<label for="toggle" class="toggle" data-open="Main Menu" data-close="Close Menu"></label>
|
||||
<ul class="menu pull-right">
|
||||
|
||||
<li><a href="/getting-started/">Getting started</a></li>
|
||||
<li><a href="/components/">Components</a></li>
|
||||
<li><a href="/docs/">Docs</a></li>
|
||||
|
@ -64,93 +53,56 @@
|
|||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
|
||||
|
||||
<div class="grid-wrapper">
|
||||
<div class="grid grid-center">
|
||||
|
||||
<div class="grid__item two-thirds lap-one-whole palm-one-whole">
|
||||
|
||||
|
||||
<article class="page">
|
||||
|
||||
|
||||
<div class='edit-github'><a href='https://github.com/home-assistant/home-assistant.github.io/tree/current/source/_docs/mqtt/testing.markdown'>Edit this page on GitHub</a></div>
|
||||
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
MQTT Testing
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<p>The <code class="highlighter-rouge">mosquitto</code> broker package ships commandline tools (often as <code class="highlighter-rouge">*-clients</code> package) to send and receive MQTT messages. As an alternative have a look at <a href="http://hbmqtt.readthedocs.org/en/latest/references/hbmqtt_pub.html">hbmqtt_pub</a> and <a href="http://hbmqtt.readthedocs.org/en/latest/references/hbmqtt_sub.html">hbmqtt_sub</a> which are provided by HBMQTT. For sending test messages to a broker running on localhost check the example below:</p>
|
||||
|
||||
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>mosquitto_pub -h 127.0.0.1 -t home-assistant/switch/1/on -m <span class="s2">"Switch is ON"</span>
|
||||
</code></pre>
|
||||
</div>
|
||||
|
||||
<p>If you are using the embedded MQTT broker, the command looks a little different because you need to add the MQTT protocol version.</p>
|
||||
|
||||
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>mosquitto_pub -V mqttv311 -t <span class="s2">"hello"</span> -m world
|
||||
</code></pre>
|
||||
</div>
|
||||
|
||||
<p>or if you are using a API password:</p>
|
||||
|
||||
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>mosquitto_pub -V mqttv311 -u homeassistant -P <your api password> -t <span class="s2">"hello"</span> -m world
|
||||
</code></pre>
|
||||
</div>
|
||||
|
||||
<p>Another way to send MQTT messages by hand is to use the “Developer Tools” in the Frontend. Choose “Call Service” and then <code class="highlighter-rouge">mqtt/mqtt_send</code> under “Available Services”. Enter something similar to the example below into the “Service Data” field.</p>
|
||||
|
||||
<div class="language-json highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="w">
|
||||
</span><span class="nt">"topic"</span><span class="p">:</span><span class="s2">"home-assistant/switch/1/on"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="nt">"payload"</span><span class="p">:</span><span class="s2">"Switch is ON"</span><span class="w">
|
||||
</span><span class="p">}</span><span class="w">
|
||||
</span></code></pre>
|
||||
</div>
|
||||
|
||||
<p>The message should appear on the bus:</p>
|
||||
|
||||
<div class="language-bash highlighter-rouge"><pre class="highlight"><code>... <span class="o">[</span>homeassistant] Bus:Handling <Event MQTT_MESSAGE_RECEIVED[L]: <span class="nv">topic</span><span class="o">=</span>home-assistant/switch/1/on, <span class="nv">qos</span><span class="o">=</span>0, <span class="nv">payload</span><span class="o">=</span>Switch is ON>
|
||||
</code></pre>
|
||||
</div>
|
||||
|
||||
<p>For reading all messages sent on the topic <code class="highlighter-rouge">home-assistant</code> to a broker running on localhost:</p>
|
||||
|
||||
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>mosquitto_sub -h 127.0.0.1 -v -t <span class="s2">"home-assistant/#"</span>
|
||||
</code></pre>
|
||||
</div>
|
||||
|
||||
<p>For the embedded MQTT broker the command looks like:</p>
|
||||
|
||||
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>mosquitto_sub -v -V mqttv311 -t <span class="s2">"#"</span>
|
||||
</code></pre>
|
||||
</div>
|
||||
|
||||
<p>Add the username <code class="highlighter-rouge">homeassistant</code> and your API password if needed.</p>
|
||||
|
||||
|
||||
|
||||
</article>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<aside id="sidebar" class="grid__item one-third lap-one-whole palm-one-whole">
|
||||
<div class="grid">
|
||||
|
||||
|
||||
<section class="aside-module grid__item one-whole lap-one-half">
|
||||
<div class='section'>
|
||||
<h1 class="title delta">Topics</h1>
|
||||
|
@ -337,13 +289,10 @@
|
|||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
<div class="grid-wrapper">
|
||||
<div class="grid">
|
||||
|
@ -353,7 +302,6 @@
|
|||
<a rel="me" href='https://facebook.com/homeassistantio'><i class="icon-facebook"></i></a>
|
||||
<a rel="me" href='https://plus.google.com/110560654828510104551'><i class="icon-google-plus"></i></a>
|
||||
<a rel="me" href='https://github.com/home-assistant/home-assistant'><i class="icon-github"></i></a>
|
||||
|
||||
<div class="credit">
|
||||
Contact us at <a href='mailto:hello@home-assistant.io'>hello@home-assistant.io</a>.<br>
|
||||
Website powered by <a href='http://jekyllrb.com/'>Jekyll</a> and the <a href='https://github.com/coogie/oscailte'>Oscalite theme</a>.<br />
|
||||
|
@ -365,7 +313,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script>
|
||||
var _gaq=[['_setAccount','UA-57927901-1'],['_trackPageview']];
|
||||
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
|
||||
|
@ -373,4 +320,4 @@
|
|||
s.parentNode.insertBefore(g,s)}(document,'script'));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue