Site updated at 2016-08-12 06:33:52 UTC

This commit is contained in:
Travis CI 2016-08-12 06:33:52 +00:00
parent 653e701e14
commit edf8a668bc
26 changed files with 188 additions and 155 deletions

View file

@ -144,6 +144,37 @@
</div>
</div>
<h3><a class="title-link" name="get-temperature-and-humidity" href="#get-temperature-and-humidity"></a> Get temperature and humidity</h3>
<p>If you are using a DHT sensor and a NodeMCU board (esp8266), you can retrieve temperature and humidity with a MQTT sensor. A code example can be found <a href="https://github.com/mertenats/open-home-automation/tree/master/ha_mqtt_sensor_dht22">here</a>. A regular MQTT message from this example looks like this:</p>
<pre><code>office/sensor1
{
"temperature": 23.20,
"humidity": 43.70
}
</code></pre>
<p>Then use this configuration example to extract the data from the payload:</p>
<div class="highlighter-coderay"><div class="CodeRay">
<div class="code"><pre><span class="comment"># Example configuration.yml entry</span>
<span class="key">sensor 1</span>:
<span class="key">platform</span>: <span class="string"><span class="content">mqtt</span></span>
<span class="key">state_topic</span>: <span class="string"><span class="content">'office/sensor1'</span></span>
<span class="key">name</span>: <span class="string"><span class="content">'Temperature'</span></span>
<span class="key">unit_of_measurement</span>: <span class="string"><span class="content">'°C'</span></span>
<span class="key">value_template</span>: <span class="string"><span class="content">''</span></span>
<span class="key">sensor 2</span>:
<span class="key">platform</span>: <span class="string"><span class="content">mqtt</span></span>
<span class="key">state_topic</span>: <span class="string"><span class="content">'office/sensor1'</span></span>
<span class="key">name</span>: <span class="string"><span class="content">'Humidity'</span></span>
<span class="key">unit_of_measurement</span>: <span class="string"><span class="content">'%'</span></span>
<span class="key">value_template</span>: <span class="string"><span class="content">''</span></span>
</pre></div>
</div>
</div>
</article>