Site updated at 2015-10-11 20:16:19 UTC
This commit is contained in:
parent
0cadd801b9
commit
0f05893e2c
57 changed files with 3700 additions and 559 deletions
|
@ -4,7 +4,7 @@
|
|||
<title><![CDATA[Category: architecture | Home Assistant]]></title>
|
||||
<link href="https://home-assistant.io/blog/categories/architecture/atom.xml" rel="self"/>
|
||||
<link href="https://home-assistant.io/"/>
|
||||
<updated>2015-10-11T11:39:41-07:00</updated>
|
||||
<updated>2015-10-11T13:16:06-07:00</updated>
|
||||
<id>https://home-assistant.io/</id>
|
||||
<author>
|
||||
<name><![CDATA[Paulus Schoutsen]]></name>
|
||||
|
|
|
@ -209,6 +209,12 @@
|
|||
<ul class="divided">
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/10/11/measure-temperature-with-esp8266-and-report-to-mqtt/">Report the temperature with ESP8266 to MQTT</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/10/11/rfxtrx-blinkstick-and-snmp-support/">0.7.5: Blinkstick, SNMP, Telegram</a>
|
||||
</li>
|
||||
|
@ -232,12 +238,6 @@
|
|||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/09/13/home-assistant-meets-ifttt/">Home Assistant meets IFTTT</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<title><![CDATA[Category: branding | Home Assistant]]></title>
|
||||
<link href="https://home-assistant.io/blog/categories/branding/atom.xml" rel="self"/>
|
||||
<link href="https://home-assistant.io/"/>
|
||||
<updated>2015-10-11T11:39:41-07:00</updated>
|
||||
<updated>2015-10-11T13:16:06-07:00</updated>
|
||||
<id>https://home-assistant.io/</id>
|
||||
<author>
|
||||
<name><![CDATA[Paulus Schoutsen]]></name>
|
||||
|
|
|
@ -209,6 +209,12 @@
|
|||
<ul class="divided">
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/10/11/measure-temperature-with-esp8266-and-report-to-mqtt/">Report the temperature with ESP8266 to MQTT</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/10/11/rfxtrx-blinkstick-and-snmp-support/">0.7.5: Blinkstick, SNMP, Telegram</a>
|
||||
</li>
|
||||
|
@ -232,12 +238,6 @@
|
|||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/09/13/home-assistant-meets-ifttt/">Home Assistant meets IFTTT</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<title><![CDATA[Category: component | Home Assistant]]></title>
|
||||
<link href="https://home-assistant.io/blog/categories/component/atom.xml" rel="self"/>
|
||||
<link href="https://home-assistant.io/"/>
|
||||
<updated>2015-10-11T11:39:41-07:00</updated>
|
||||
<updated>2015-10-11T13:16:06-07:00</updated>
|
||||
<id>https://home-assistant.io/</id>
|
||||
<author>
|
||||
<name><![CDATA[Paulus Schoutsen]]></name>
|
||||
|
|
|
@ -322,6 +322,12 @@
|
|||
<ul class="divided">
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/10/11/measure-temperature-with-esp8266-and-report-to-mqtt/">Report the temperature with ESP8266 to MQTT</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/10/11/rfxtrx-blinkstick-and-snmp-support/">0.7.5: Blinkstick, SNMP, Telegram</a>
|
||||
</li>
|
||||
|
@ -345,12 +351,6 @@
|
|||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/09/13/home-assistant-meets-ifttt/">Home Assistant meets IFTTT</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<title><![CDATA[Category: core | Home Assistant]]></title>
|
||||
<link href="https://home-assistant.io/blog/categories/core/atom.xml" rel="self"/>
|
||||
<link href="https://home-assistant.io/"/>
|
||||
<updated>2015-10-11T11:39:41-07:00</updated>
|
||||
<updated>2015-10-11T13:16:06-07:00</updated>
|
||||
<id>https://home-assistant.io/</id>
|
||||
<author>
|
||||
<name><![CDATA[Paulus Schoutsen]]></name>
|
||||
|
|
|
@ -246,6 +246,12 @@
|
|||
<ul class="divided">
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/10/11/measure-temperature-with-esp8266-and-report-to-mqtt/">Report the temperature with ESP8266 to MQTT</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/10/11/rfxtrx-blinkstick-and-snmp-support/">0.7.5: Blinkstick, SNMP, Telegram</a>
|
||||
</li>
|
||||
|
@ -269,12 +275,6 @@
|
|||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/09/13/home-assistant-meets-ifttt/">Home Assistant meets IFTTT</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
|
|
256
blog/categories/esp8266/atom.xml
Normal file
256
blog/categories/esp8266/atom.xml
Normal file
|
@ -0,0 +1,256 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||
|
||||
<title><![CDATA[Category: esp8266 | Home Assistant]]></title>
|
||||
<link href="https://home-assistant.io/blog/categories/esp8266/atom.xml" rel="self"/>
|
||||
<link href="https://home-assistant.io/"/>
|
||||
<updated>2015-10-11T13:16:06-07:00</updated>
|
||||
<id>https://home-assistant.io/</id>
|
||||
<author>
|
||||
<name><![CDATA[Paulus Schoutsen]]></name>
|
||||
|
||||
</author>
|
||||
<generator uri="http://octopress.org/">Octopress</generator>
|
||||
|
||||
|
||||
<entry>
|
||||
<title type="html"><![CDATA[Report the temperature with ESP8266 to MQTT]]></title>
|
||||
<link href="https://home-assistant.io/blog/2015/10/11/measure-temperature-with-esp8266-and-report-to-mqtt/"/>
|
||||
<updated>2015-10-11T12:10:00-07:00</updated>
|
||||
<id>https://home-assistant.io/blog/2015/10/11/measure-temperature-with-esp8266-and-report-to-mqtt</id>
|
||||
<content type="html"><![CDATA[<p>I recently learned about the ESP8266, a $5 chip that includes WiFi and is Arduino compatible. This means
|
||||
that all your DIY projects can now be done for a fraction of the price.</p>
|
||||
|
||||
<p>For this tutorial, I’ll walk through how to get going with ESP8266, get the temperature and humidity and
|
||||
report it to MQTT where Home Asssistant can pick it up.</p>
|
||||
|
||||
<p class='img'>
|
||||
<img src='https://home-assistant.io/images/blog/2015-10-esp8266-temp/ha-sensor.png' />
|
||||
Home Assistant will keep track of historical values and allow you to integrate it into automation.
|
||||
</p>
|
||||
|
||||
|
||||
<h3>Components</h3>
|
||||
|
||||
<p>I’ve been using Adafruit for my shopping:</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="http://www.adafruit.com/product/2471">Adafruit HUZZAH ESP8266 Breakout</a> (<a href="https://learn.adafruit.com/adafruit-huzzah-esp8266-breakout/assembly">assembly instructions</a>)</li>
|
||||
<li><a href="http://www.adafruit.com/product/2635">Adafruit HDC1008 Temperature & Humidity Sensor Breakout Board</a> (<a href="https://learn.adafruit.com/adafruit-hdc1008-temperature-and-humidity-sensor-breakout/assembly">assembly instructions</a>)</li>
|
||||
<li><a href="/components/mqtt.html#picking-a-broker">MQTT server</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<p><em>Besides this, you will need the usual hardware prototype equipment: a breadboard, some wires,
|
||||
soldering iron + wire, Serial USB cable.</em></p>
|
||||
|
||||
<h3>Connections</h3>
|
||||
|
||||
<p>On your breadboard, make the following connections from your ESP8266 to the HDC1008:</p>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th> ESP8266 </th>
|
||||
<th> HDC1008 </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td> GND </td>
|
||||
<td> GND</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> 3V </td>
|
||||
<td> Vin</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> 14 </td>
|
||||
<td> SCL</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> #2 </td>
|
||||
<td> SDA</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<p><em>I picked <code>#2</code> and <code>14</code> myself, you can configure them in the sketch.</em></p>
|
||||
|
||||
<h3>Preparing your IDE</h3>
|
||||
|
||||
<p>Follow <a href="https://github.com/esp8266/Arduino#installing-with-boards-manager">these instructions</a> on how
|
||||
to install and prepare the Arduino IDE for ESP8266 development.</p>
|
||||
|
||||
<p>After you’re done installing, open the Arduino IDE, in the menu click on <code>sketch</code> -> <code>include library</code> ->
|
||||
<code>manage libraries</code> and install the following libraries:</p>
|
||||
|
||||
<ul>
|
||||
<li>PubSubClient by Nick ‘O Leary</li>
|
||||
<li>Adafruit HDC1000</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h3>Sketch</h3>
|
||||
|
||||
<p>If you have followed the previous steps, you’re all set.</p>
|
||||
|
||||
<ul>
|
||||
<li>Open Arduino IDE and create a new sketch (<code>File</code> -> <code>New</code>)</li>
|
||||
<li>Copy and paste the below sketch to the Arduino IDE</li>
|
||||
<li>Adjust the values line 6 - 14 to match your setup</li>
|
||||
<li>Optional: If you want to connect to an MQTT server without a username or password, adjust line 63.</li>
|
||||
<li>To have the ESP8266 accept our new sketch, we have to put it in upload mode. On the ESP8266 device
|
||||
keep the GPIO0 button pressed while pressing the reset button. The red led will glow half bright to
|
||||
indicate it is in upload mode.</li>
|
||||
<li>Press the upload button in Arduino IDE</li>
|
||||
<li>Open the serial monitor (<code>Tools</code> -> <code>Serial Monitor</code>) to see the output from your device</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<p>This sketch will connect to your WiFi network and MQTT broker. It will read the temperature and humidity
|
||||
from the sensor every second. It will report it to the MQTT server if the difference is > 1 since last
|
||||
reported value. Reports to the MQTT broker are sent with retain set to <code>True</code>. This means that anyone
|
||||
connecting to the MQTT topic will automatically be notified of the last reported value.</p>
|
||||
|
||||
<pre><code class="cpp">
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <Wire.h>
|
||||
#include <PubSubClient.h>
|
||||
#include <Adafruit_HDC1000.h>
|
||||
|
||||
#define wifi_ssid "YOUR WIFI SSID"
|
||||
#define wifi_password "WIFI PASSWORD"
|
||||
|
||||
#define mqtt_server "YOUR_MQTT_SERVER_HOST"
|
||||
#define mqtt_user "your_username"
|
||||
#define mqtt_password "your_password"
|
||||
|
||||
#define humidity_topic "sensor/humidity"
|
||||
#define temperature_topic "sensor/temperature"
|
||||
|
||||
WiFiClient espClient;
|
||||
PubSubClient client(espClient);
|
||||
Adafruit_HDC1000 hdc = Adafruit_HDC1000();
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
setup_wifi();
|
||||
client.setServer(mqtt_server, 1883);
|
||||
|
||||
// Set SDA and SDL ports
|
||||
Wire.begin(2, 14);
|
||||
|
||||
// Start sensor
|
||||
if (!hdc.begin()) {
|
||||
Serial.println("Couldn't find sensor!");
|
||||
while (1);
|
||||
}}
|
||||
|
||||
void setup_wifi() {
|
||||
delay(10);
|
||||
// We start by connecting to a WiFi network
|
||||
Serial.println();
|
||||
Serial.print("Connecting to ");
|
||||
Serial.println(wifi_ssid);
|
||||
|
||||
WiFi.begin(wifi_ssid, wifi_password);
|
||||
|
||||
while (WiFi.status() != WL_CONNECTED) {
|
||||
delay(500);
|
||||
Serial.print(".");
|
||||
}
|
||||
|
||||
Serial.println("");
|
||||
Serial.println("WiFi connected");
|
||||
Serial.println("IP address: ");
|
||||
Serial.println(WiFi.localIP());
|
||||
}
|
||||
|
||||
void reconnect() {
|
||||
// Loop until we're reconnected
|
||||
while (!client.connected()) {
|
||||
Serial.print("Attempting MQTT connection...");
|
||||
// Attempt to connect
|
||||
// If you do not want to use a username and password, change next line to
|
||||
// if (client.connect("ESP8266Client")) {
|
||||
if (client.connect("ESP8266Client", mqtt_user, mqtt_password)) {
|
||||
Serial.println("connected");
|
||||
} else {
|
||||
Serial.print("failed, rc=");
|
||||
Serial.print(client.state());
|
||||
Serial.println(" try again in 5 seconds");
|
||||
// Wait 5 seconds before retrying
|
||||
delay(5000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool checkBound(float newValue, float prevValue, float maxDiff) {
|
||||
return newValue < prevValue - maxDiff || newValue > prevValue + maxDiff;
|
||||
}
|
||||
|
||||
long lastMsg = 0;
|
||||
float temp = 0.0;
|
||||
float hum = 0.0;
|
||||
float diff = 1.0;
|
||||
|
||||
void loop() {
|
||||
if (!client.connected()) {
|
||||
reconnect();
|
||||
}
|
||||
client.loop();
|
||||
|
||||
long now = millis();
|
||||
if (now - lastMsg > 1000) {
|
||||
lastMsg = now;
|
||||
|
||||
float newTemp = hdc.readTemperature();
|
||||
float newHum = hdc.readHumidity();
|
||||
|
||||
if (checkBound(newTemp, temp, diff)) {
|
||||
temp = newTemp;
|
||||
Serial.print("New temperature:");
|
||||
Serial.println(String(temp).c_str());
|
||||
client.publish(temperature_topic, String(temp).c_str(), true);
|
||||
}
|
||||
|
||||
if (checkBound(newHum, hum, diff)) {
|
||||
hum = newHum;
|
||||
Serial.print("New humidity:");
|
||||
Serial.println(String(hum).c_str());
|
||||
client.publish(humidity_topic, String(hum).c_str(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
<h3>Configuring Home Assistant</h3>
|
||||
|
||||
<p>The last step is to integrate the sensor values into Home Assistant. This can be done by setting up
|
||||
Home Assistant to connect to the MQTT broker and subscribe to the sensor topics.</p>
|
||||
|
||||
<pre><code class="yaml">mqtt:
|
||||
broker: YOUR_MQTT_SERVER_HOST
|
||||
username: your_username
|
||||
password: your_password
|
||||
|
||||
sensor:
|
||||
platform: mqtt
|
||||
name: "Temperature"
|
||||
state_topic: "sensor/temperature"
|
||||
qos: 0
|
||||
unit_of_measurement: "ºC"
|
||||
|
||||
sensor 2:
|
||||
platform: mqtt
|
||||
name: "Humidity"
|
||||
state_topic: "sensor/humidity"
|
||||
qos: 0
|
||||
unit_of_measurement: "%"
|
||||
</code></pre>
|
||||
]]></content>
|
||||
</entry>
|
||||
|
||||
</feed>
|
309
blog/categories/esp8266/index.html
Normal file
309
blog/categories/esp8266/index.html
Normal file
|
@ -0,0 +1,309 @@
|
|||
<!doctype html>
|
||||
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
|
||||
<!--[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>Category: esp8266 - Home Assistant</title>
|
||||
<meta name="author" content="Paulus Schoutsen">
|
||||
|
||||
<meta name="description" content="Category: esp8266">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/blog/categories/esp8266">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Category: esp8266">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/blog/categories/esp8266/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="Category: esp8266">
|
||||
<meta property="og:image" content="https://home-assistant.io/images/home-assistant-logo-2164x2164.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='/images/favicon-192x192.png'> Home Assistant
|
||||
</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>
|
||||
<ul>
|
||||
<li><a href='/getting-started/'>Installing Home Assistant</a></li>
|
||||
<li><a href='/getting-started/configuration.html'>Configuration basics</a></li>
|
||||
<li><a href='/getting-started/devices.html'>Adding devices</a></li>
|
||||
<li><a href='/getting-started/presence-detection.html'>Presence detection</a></li>
|
||||
<li><a href='/getting-started/automation.html'>Automation</a></li>
|
||||
<li><a href='/cookbook'>Configuration cookbook</a></li>
|
||||
<li><a href='/components/'>Component overview</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/developers/">Developers</a>
|
||||
<ul>
|
||||
<li><a href="/developers/architecture.html">Architecture</a></li>
|
||||
<li><a href="/developers/frontend.html">Frontend development</a></li>
|
||||
<li><a href="/developers/creating_components.html">
|
||||
Creating components
|
||||
</a></li>
|
||||
<li><a href="/developers/add_new_platform.html">
|
||||
Adding platform support
|
||||
</a></li>
|
||||
<li><a href="/developers/api.html">API</a></li>
|
||||
<li><a href="/developers/credits.html">Credits</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="/blog/">Blog</a></li>
|
||||
<li><a href="/help/">Need help?</a></li>
|
||||
</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">
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
Category: Esp8266
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<div id="archive-list">
|
||||
|
||||
|
||||
|
||||
|
||||
<h2>2015</h2>
|
||||
|
||||
<article>
|
||||
|
||||
|
||||
<div class="grid">
|
||||
|
||||
<div class="grid__item one-fifth palm-one-whole">
|
||||
<time datetime="2015-10-11T12:10:00-07:00" pubdate>
|
||||
<span class='month'>Oct</span> <span class='day'>11</span>
|
||||
</time>
|
||||
</div>
|
||||
<div class="grid__item four-fifths palm-one-whole">
|
||||
<h1 class="gamma"><a href="/blog/2015/10/11/measure-temperature-with-esp8266-and-report-to-mqtt/">Report the temperature with ESP8266 to MQTT</a></h1>
|
||||
|
||||
<footer class="meta">
|
||||
|
||||
|
||||
<span>
|
||||
<i class="icon-tags"></i>
|
||||
<ul class="tags unstyled">
|
||||
|
||||
|
||||
<li><a class='category' href='/blog/categories/esp8266/'>esp8266</a></li>
|
||||
|
||||
<li><a class='category' href='/blog/categories/how-to/'>how-to</a></li>
|
||||
|
||||
<li><a class='category' href='/blog/categories/mqtt/'>mqtt</a></li>
|
||||
|
||||
|
||||
</ul>
|
||||
</span>
|
||||
|
||||
</footer>
|
||||
|
||||
<hr class="divider">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</article>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</article>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<aside id="sidebar" class="grid__item one-third lap-one-whole palm-one-whole">
|
||||
<div class="grid">
|
||||
|
||||
|
||||
|
||||
|
||||
<section class="sharing aside-module grid__item one-whole lap-one-half">
|
||||
<h1 class="title delta">Share this post</h1>
|
||||
|
||||
<a href="//twitter.com/share"
|
||||
class="twitter-share-button"
|
||||
data-url="https://home-assistant.io/blog/categories/esp8266/index.html"
|
||||
data-counturl="https://home-assistant.io/blog/categories/esp8266/index.html" >Tweet</a>
|
||||
|
||||
|
||||
<div class="g-plusone" data-size="standard"></div>
|
||||
|
||||
|
||||
<div class="fb-share-button" style='top: -6px;'
|
||||
data-href="https://home-assistant.io/blog/categories/esp8266/index.html"
|
||||
data-layout="button_count">
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
|
||||
|
||||
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
||||
|
||||
<script>
|
||||
window.fbAsyncInit = function() {
|
||||
FB.init({
|
||||
appId : '338291289691179',
|
||||
xfbml : true,
|
||||
version : 'v2.2'
|
||||
});
|
||||
};
|
||||
|
||||
(function(d, s, id){
|
||||
var js, fjs = d.getElementsByTagName(s)[0];
|
||||
if (d.getElementById(id)) {return;}
|
||||
js = d.createElement(s); js.id = id;
|
||||
js.src = "//connect.facebook.net/en_US/sdk.js";
|
||||
fjs.parentNode.insertBefore(js, fjs);
|
||||
}(document, 'script', 'facebook-jssdk'));
|
||||
</script>
|
||||
<section id="recent-posts" class="aside-module grid__item one-whole lap-one-half">
|
||||
<h1 class="title delta">Other Posts</h1>
|
||||
<ul class="divided">
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/10/11/measure-temperature-with-esp8266-and-report-to-mqtt/">Report the temperature with ESP8266 to MQTT</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/10/11/rfxtrx-blinkstick-and-snmp-support/">0.7.5: Blinkstick, SNMP, Telegram</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/10/05/home-assistant-goes-geo-with-owntracks/">Home Assistant goes geo with OwnTracks</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/09/19/alarm-sonos-and-itunes-support/">Alarms, Sonos and iTunes now supported</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/09/18/monitoring-with-glances-and-home-assistant/">Remote Monitoring with Glances</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</aside>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
<div class="grid-wrapper">
|
||||
<div class="grid">
|
||||
<div class="grid__item">
|
||||
<p class="copyright">
|
||||
<span class="credit">Powered by <a href="http://octopress.org">Octopress</a>, <a href='http://jekyllrb.com/'>Jekyll</a> and the <a href='https://github.com/coogie/oscailte'>Oscalite theme</a>. Hosted by <a href='https://pages.github.com/'>GitHub</a> and served by <a href='https://cloudflare.com'>CloudFlare</a>.</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</footer>
|
||||
|
||||
<!--[if lt IE 7]>
|
||||
<p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
|
||||
<![endif]-->
|
||||
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
var _gaq=[['_setAccount','UA-57927901-1'],['_trackPageview']];
|
||||
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
|
||||
g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
|
||||
s.parentNode.insertBefore(g,s)}(document,'script'));
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
var disqus_shortname = 'home-assistant';
|
||||
|
||||
|
||||
var disqus_script = 'count.js';
|
||||
|
||||
(function () {
|
||||
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
|
||||
dsq.src = '//' + disqus_shortname + '.disqus.com/' + disqus_script;
|
||||
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
||||
}());
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -4,7 +4,7 @@
|
|||
<title><![CDATA[Category: frontend | Home Assistant]]></title>
|
||||
<link href="https://home-assistant.io/blog/categories/frontend/atom.xml" rel="self"/>
|
||||
<link href="https://home-assistant.io/"/>
|
||||
<updated>2015-10-11T11:39:41-07:00</updated>
|
||||
<updated>2015-10-11T13:16:06-07:00</updated>
|
||||
<id>https://home-assistant.io/</id>
|
||||
<author>
|
||||
<name><![CDATA[Paulus Schoutsen]]></name>
|
||||
|
|
|
@ -248,6 +248,12 @@
|
|||
<ul class="divided">
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/10/11/measure-temperature-with-esp8266-and-report-to-mqtt/">Report the temperature with ESP8266 to MQTT</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/10/11/rfxtrx-blinkstick-and-snmp-support/">0.7.5: Blinkstick, SNMP, Telegram</a>
|
||||
</li>
|
||||
|
@ -271,12 +277,6 @@
|
|||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/09/13/home-assistant-meets-ifttt/">Home Assistant meets IFTTT</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<title><![CDATA[Category: how-to | Home Assistant]]></title>
|
||||
<link href="https://home-assistant.io/blog/categories/how-to/atom.xml" rel="self"/>
|
||||
<link href="https://home-assistant.io/"/>
|
||||
<updated>2015-10-11T11:39:41-07:00</updated>
|
||||
<updated>2015-10-11T13:16:06-07:00</updated>
|
||||
<id>https://home-assistant.io/</id>
|
||||
<author>
|
||||
<name><![CDATA[Paulus Schoutsen]]></name>
|
||||
|
@ -13,6 +13,246 @@
|
|||
<generator uri="http://octopress.org/">Octopress</generator>
|
||||
|
||||
|
||||
<entry>
|
||||
<title type="html"><![CDATA[Report the temperature with ESP8266 to MQTT]]></title>
|
||||
<link href="https://home-assistant.io/blog/2015/10/11/measure-temperature-with-esp8266-and-report-to-mqtt/"/>
|
||||
<updated>2015-10-11T12:10:00-07:00</updated>
|
||||
<id>https://home-assistant.io/blog/2015/10/11/measure-temperature-with-esp8266-and-report-to-mqtt</id>
|
||||
<content type="html"><![CDATA[<p>I recently learned about the ESP8266, a $5 chip that includes WiFi and is Arduino compatible. This means
|
||||
that all your DIY projects can now be done for a fraction of the price.</p>
|
||||
|
||||
<p>For this tutorial, I’ll walk through how to get going with ESP8266, get the temperature and humidity and
|
||||
report it to MQTT where Home Asssistant can pick it up.</p>
|
||||
|
||||
<p class='img'>
|
||||
<img src='https://home-assistant.io/images/blog/2015-10-esp8266-temp/ha-sensor.png' />
|
||||
Home Assistant will keep track of historical values and allow you to integrate it into automation.
|
||||
</p>
|
||||
|
||||
|
||||
<h3>Components</h3>
|
||||
|
||||
<p>I’ve been using Adafruit for my shopping:</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="http://www.adafruit.com/product/2471">Adafruit HUZZAH ESP8266 Breakout</a> (<a href="https://learn.adafruit.com/adafruit-huzzah-esp8266-breakout/assembly">assembly instructions</a>)</li>
|
||||
<li><a href="http://www.adafruit.com/product/2635">Adafruit HDC1008 Temperature & Humidity Sensor Breakout Board</a> (<a href="https://learn.adafruit.com/adafruit-hdc1008-temperature-and-humidity-sensor-breakout/assembly">assembly instructions</a>)</li>
|
||||
<li><a href="/components/mqtt.html#picking-a-broker">MQTT server</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<p><em>Besides this, you will need the usual hardware prototype equipment: a breadboard, some wires,
|
||||
soldering iron + wire, Serial USB cable.</em></p>
|
||||
|
||||
<h3>Connections</h3>
|
||||
|
||||
<p>On your breadboard, make the following connections from your ESP8266 to the HDC1008:</p>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th> ESP8266 </th>
|
||||
<th> HDC1008 </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td> GND </td>
|
||||
<td> GND</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> 3V </td>
|
||||
<td> Vin</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> 14 </td>
|
||||
<td> SCL</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> #2 </td>
|
||||
<td> SDA</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<p><em>I picked <code>#2</code> and <code>14</code> myself, you can configure them in the sketch.</em></p>
|
||||
|
||||
<h3>Preparing your IDE</h3>
|
||||
|
||||
<p>Follow <a href="https://github.com/esp8266/Arduino#installing-with-boards-manager">these instructions</a> on how
|
||||
to install and prepare the Arduino IDE for ESP8266 development.</p>
|
||||
|
||||
<p>After you’re done installing, open the Arduino IDE, in the menu click on <code>sketch</code> -> <code>include library</code> ->
|
||||
<code>manage libraries</code> and install the following libraries:</p>
|
||||
|
||||
<ul>
|
||||
<li>PubSubClient by Nick ‘O Leary</li>
|
||||
<li>Adafruit HDC1000</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h3>Sketch</h3>
|
||||
|
||||
<p>If you have followed the previous steps, you’re all set.</p>
|
||||
|
||||
<ul>
|
||||
<li>Open Arduino IDE and create a new sketch (<code>File</code> -> <code>New</code>)</li>
|
||||
<li>Copy and paste the below sketch to the Arduino IDE</li>
|
||||
<li>Adjust the values line 6 - 14 to match your setup</li>
|
||||
<li>Optional: If you want to connect to an MQTT server without a username or password, adjust line 63.</li>
|
||||
<li>To have the ESP8266 accept our new sketch, we have to put it in upload mode. On the ESP8266 device
|
||||
keep the GPIO0 button pressed while pressing the reset button. The red led will glow half bright to
|
||||
indicate it is in upload mode.</li>
|
||||
<li>Press the upload button in Arduino IDE</li>
|
||||
<li>Open the serial monitor (<code>Tools</code> -> <code>Serial Monitor</code>) to see the output from your device</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<p>This sketch will connect to your WiFi network and MQTT broker. It will read the temperature and humidity
|
||||
from the sensor every second. It will report it to the MQTT server if the difference is > 1 since last
|
||||
reported value. Reports to the MQTT broker are sent with retain set to <code>True</code>. This means that anyone
|
||||
connecting to the MQTT topic will automatically be notified of the last reported value.</p>
|
||||
|
||||
<pre><code class="cpp">
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <Wire.h>
|
||||
#include <PubSubClient.h>
|
||||
#include <Adafruit_HDC1000.h>
|
||||
|
||||
#define wifi_ssid "YOUR WIFI SSID"
|
||||
#define wifi_password "WIFI PASSWORD"
|
||||
|
||||
#define mqtt_server "YOUR_MQTT_SERVER_HOST"
|
||||
#define mqtt_user "your_username"
|
||||
#define mqtt_password "your_password"
|
||||
|
||||
#define humidity_topic "sensor/humidity"
|
||||
#define temperature_topic "sensor/temperature"
|
||||
|
||||
WiFiClient espClient;
|
||||
PubSubClient client(espClient);
|
||||
Adafruit_HDC1000 hdc = Adafruit_HDC1000();
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
setup_wifi();
|
||||
client.setServer(mqtt_server, 1883);
|
||||
|
||||
// Set SDA and SDL ports
|
||||
Wire.begin(2, 14);
|
||||
|
||||
// Start sensor
|
||||
if (!hdc.begin()) {
|
||||
Serial.println("Couldn't find sensor!");
|
||||
while (1);
|
||||
}}
|
||||
|
||||
void setup_wifi() {
|
||||
delay(10);
|
||||
// We start by connecting to a WiFi network
|
||||
Serial.println();
|
||||
Serial.print("Connecting to ");
|
||||
Serial.println(wifi_ssid);
|
||||
|
||||
WiFi.begin(wifi_ssid, wifi_password);
|
||||
|
||||
while (WiFi.status() != WL_CONNECTED) {
|
||||
delay(500);
|
||||
Serial.print(".");
|
||||
}
|
||||
|
||||
Serial.println("");
|
||||
Serial.println("WiFi connected");
|
||||
Serial.println("IP address: ");
|
||||
Serial.println(WiFi.localIP());
|
||||
}
|
||||
|
||||
void reconnect() {
|
||||
// Loop until we're reconnected
|
||||
while (!client.connected()) {
|
||||
Serial.print("Attempting MQTT connection...");
|
||||
// Attempt to connect
|
||||
// If you do not want to use a username and password, change next line to
|
||||
// if (client.connect("ESP8266Client")) {
|
||||
if (client.connect("ESP8266Client", mqtt_user, mqtt_password)) {
|
||||
Serial.println("connected");
|
||||
} else {
|
||||
Serial.print("failed, rc=");
|
||||
Serial.print(client.state());
|
||||
Serial.println(" try again in 5 seconds");
|
||||
// Wait 5 seconds before retrying
|
||||
delay(5000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool checkBound(float newValue, float prevValue, float maxDiff) {
|
||||
return newValue < prevValue - maxDiff || newValue > prevValue + maxDiff;
|
||||
}
|
||||
|
||||
long lastMsg = 0;
|
||||
float temp = 0.0;
|
||||
float hum = 0.0;
|
||||
float diff = 1.0;
|
||||
|
||||
void loop() {
|
||||
if (!client.connected()) {
|
||||
reconnect();
|
||||
}
|
||||
client.loop();
|
||||
|
||||
long now = millis();
|
||||
if (now - lastMsg > 1000) {
|
||||
lastMsg = now;
|
||||
|
||||
float newTemp = hdc.readTemperature();
|
||||
float newHum = hdc.readHumidity();
|
||||
|
||||
if (checkBound(newTemp, temp, diff)) {
|
||||
temp = newTemp;
|
||||
Serial.print("New temperature:");
|
||||
Serial.println(String(temp).c_str());
|
||||
client.publish(temperature_topic, String(temp).c_str(), true);
|
||||
}
|
||||
|
||||
if (checkBound(newHum, hum, diff)) {
|
||||
hum = newHum;
|
||||
Serial.print("New humidity:");
|
||||
Serial.println(String(hum).c_str());
|
||||
client.publish(humidity_topic, String(hum).c_str(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
<h3>Configuring Home Assistant</h3>
|
||||
|
||||
<p>The last step is to integrate the sensor values into Home Assistant. This can be done by setting up
|
||||
Home Assistant to connect to the MQTT broker and subscribe to the sensor topics.</p>
|
||||
|
||||
<pre><code class="yaml">mqtt:
|
||||
broker: YOUR_MQTT_SERVER_HOST
|
||||
username: your_username
|
||||
password: your_password
|
||||
|
||||
sensor:
|
||||
platform: mqtt
|
||||
name: "Temperature"
|
||||
state_topic: "sensor/temperature"
|
||||
qos: 0
|
||||
unit_of_measurement: "ºC"
|
||||
|
||||
sensor 2:
|
||||
platform: mqtt
|
||||
name: "Humidity"
|
||||
state_topic: "sensor/humidity"
|
||||
qos: 0
|
||||
unit_of_measurement: "%"
|
||||
</code></pre>
|
||||
]]></content>
|
||||
</entry>
|
||||
|
||||
<entry>
|
||||
<title type="html"><![CDATA[Remote Monitoring with Glances]]></title>
|
||||
<link href="https://home-assistant.io/blog/2015/09/18/monitoring-with-glances-and-home-assistant/"/>
|
||||
|
|
|
@ -117,6 +117,47 @@
|
|||
<article>
|
||||
|
||||
|
||||
<div class="grid">
|
||||
|
||||
<div class="grid__item one-fifth palm-one-whole">
|
||||
<time datetime="2015-10-11T12:10:00-07:00" pubdate>
|
||||
<span class='month'>Oct</span> <span class='day'>11</span>
|
||||
</time>
|
||||
</div>
|
||||
<div class="grid__item four-fifths palm-one-whole">
|
||||
<h1 class="gamma"><a href="/blog/2015/10/11/measure-temperature-with-esp8266-and-report-to-mqtt/">Report the temperature with ESP8266 to MQTT</a></h1>
|
||||
|
||||
<footer class="meta">
|
||||
|
||||
|
||||
<span>
|
||||
<i class="icon-tags"></i>
|
||||
<ul class="tags unstyled">
|
||||
|
||||
|
||||
<li><a class='category' href='/blog/categories/esp8266/'>esp8266</a></li>
|
||||
|
||||
<li><a class='category' href='/blog/categories/how-to/'>how-to</a></li>
|
||||
|
||||
<li><a class='category' href='/blog/categories/mqtt/'>mqtt</a></li>
|
||||
|
||||
|
||||
</ul>
|
||||
</span>
|
||||
|
||||
</footer>
|
||||
|
||||
<hr class="divider">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</article>
|
||||
|
||||
|
||||
|
||||
<article>
|
||||
|
||||
|
||||
<div class="grid">
|
||||
|
||||
<div class="grid__item one-fifth palm-one-whole">
|
||||
|
@ -213,6 +254,8 @@
|
|||
|
||||
<li><a class='category' href='/blog/categories/how-to/'>how-to</a></li>
|
||||
|
||||
<li><a class='category' href='/blog/categories/mqtt/'>mqtt</a></li>
|
||||
|
||||
|
||||
</ul>
|
||||
</span>
|
||||
|
@ -285,6 +328,12 @@
|
|||
<ul class="divided">
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/10/11/measure-temperature-with-esp8266-and-report-to-mqtt/">Report the temperature with ESP8266 to MQTT</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/10/11/rfxtrx-blinkstick-and-snmp-support/">0.7.5: Blinkstick, SNMP, Telegram</a>
|
||||
</li>
|
||||
|
@ -308,12 +357,6 @@
|
|||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/09/13/home-assistant-meets-ifttt/">Home Assistant meets IFTTT</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
|
|
453
blog/categories/mqtt/atom.xml
Normal file
453
blog/categories/mqtt/atom.xml
Normal file
|
@ -0,0 +1,453 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||
|
||||
<title><![CDATA[Category: mqtt | Home Assistant]]></title>
|
||||
<link href="https://home-assistant.io/blog/categories/mqtt/atom.xml" rel="self"/>
|
||||
<link href="https://home-assistant.io/"/>
|
||||
<updated>2015-10-11T13:16:06-07:00</updated>
|
||||
<id>https://home-assistant.io/</id>
|
||||
<author>
|
||||
<name><![CDATA[Paulus Schoutsen]]></name>
|
||||
|
||||
</author>
|
||||
<generator uri="http://octopress.org/">Octopress</generator>
|
||||
|
||||
|
||||
<entry>
|
||||
<title type="html"><![CDATA[Report the temperature with ESP8266 to MQTT]]></title>
|
||||
<link href="https://home-assistant.io/blog/2015/10/11/measure-temperature-with-esp8266-and-report-to-mqtt/"/>
|
||||
<updated>2015-10-11T12:10:00-07:00</updated>
|
||||
<id>https://home-assistant.io/blog/2015/10/11/measure-temperature-with-esp8266-and-report-to-mqtt</id>
|
||||
<content type="html"><![CDATA[<p>I recently learned about the ESP8266, a $5 chip that includes WiFi and is Arduino compatible. This means
|
||||
that all your DIY projects can now be done for a fraction of the price.</p>
|
||||
|
||||
<p>For this tutorial, I’ll walk through how to get going with ESP8266, get the temperature and humidity and
|
||||
report it to MQTT where Home Asssistant can pick it up.</p>
|
||||
|
||||
<p class='img'>
|
||||
<img src='https://home-assistant.io/images/blog/2015-10-esp8266-temp/ha-sensor.png' />
|
||||
Home Assistant will keep track of historical values and allow you to integrate it into automation.
|
||||
</p>
|
||||
|
||||
|
||||
<h3>Components</h3>
|
||||
|
||||
<p>I’ve been using Adafruit for my shopping:</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="http://www.adafruit.com/product/2471">Adafruit HUZZAH ESP8266 Breakout</a> (<a href="https://learn.adafruit.com/adafruit-huzzah-esp8266-breakout/assembly">assembly instructions</a>)</li>
|
||||
<li><a href="http://www.adafruit.com/product/2635">Adafruit HDC1008 Temperature & Humidity Sensor Breakout Board</a> (<a href="https://learn.adafruit.com/adafruit-hdc1008-temperature-and-humidity-sensor-breakout/assembly">assembly instructions</a>)</li>
|
||||
<li><a href="/components/mqtt.html#picking-a-broker">MQTT server</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<p><em>Besides this, you will need the usual hardware prototype equipment: a breadboard, some wires,
|
||||
soldering iron + wire, Serial USB cable.</em></p>
|
||||
|
||||
<h3>Connections</h3>
|
||||
|
||||
<p>On your breadboard, make the following connections from your ESP8266 to the HDC1008:</p>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th> ESP8266 </th>
|
||||
<th> HDC1008 </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td> GND </td>
|
||||
<td> GND</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> 3V </td>
|
||||
<td> Vin</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> 14 </td>
|
||||
<td> SCL</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> #2 </td>
|
||||
<td> SDA</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<p><em>I picked <code>#2</code> and <code>14</code> myself, you can configure them in the sketch.</em></p>
|
||||
|
||||
<h3>Preparing your IDE</h3>
|
||||
|
||||
<p>Follow <a href="https://github.com/esp8266/Arduino#installing-with-boards-manager">these instructions</a> on how
|
||||
to install and prepare the Arduino IDE for ESP8266 development.</p>
|
||||
|
||||
<p>After you’re done installing, open the Arduino IDE, in the menu click on <code>sketch</code> -> <code>include library</code> ->
|
||||
<code>manage libraries</code> and install the following libraries:</p>
|
||||
|
||||
<ul>
|
||||
<li>PubSubClient by Nick ‘O Leary</li>
|
||||
<li>Adafruit HDC1000</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h3>Sketch</h3>
|
||||
|
||||
<p>If you have followed the previous steps, you’re all set.</p>
|
||||
|
||||
<ul>
|
||||
<li>Open Arduino IDE and create a new sketch (<code>File</code> -> <code>New</code>)</li>
|
||||
<li>Copy and paste the below sketch to the Arduino IDE</li>
|
||||
<li>Adjust the values line 6 - 14 to match your setup</li>
|
||||
<li>Optional: If you want to connect to an MQTT server without a username or password, adjust line 63.</li>
|
||||
<li>To have the ESP8266 accept our new sketch, we have to put it in upload mode. On the ESP8266 device
|
||||
keep the GPIO0 button pressed while pressing the reset button. The red led will glow half bright to
|
||||
indicate it is in upload mode.</li>
|
||||
<li>Press the upload button in Arduino IDE</li>
|
||||
<li>Open the serial monitor (<code>Tools</code> -> <code>Serial Monitor</code>) to see the output from your device</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<p>This sketch will connect to your WiFi network and MQTT broker. It will read the temperature and humidity
|
||||
from the sensor every second. It will report it to the MQTT server if the difference is > 1 since last
|
||||
reported value. Reports to the MQTT broker are sent with retain set to <code>True</code>. This means that anyone
|
||||
connecting to the MQTT topic will automatically be notified of the last reported value.</p>
|
||||
|
||||
<pre><code class="cpp">
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <Wire.h>
|
||||
#include <PubSubClient.h>
|
||||
#include <Adafruit_HDC1000.h>
|
||||
|
||||
#define wifi_ssid "YOUR WIFI SSID"
|
||||
#define wifi_password "WIFI PASSWORD"
|
||||
|
||||
#define mqtt_server "YOUR_MQTT_SERVER_HOST"
|
||||
#define mqtt_user "your_username"
|
||||
#define mqtt_password "your_password"
|
||||
|
||||
#define humidity_topic "sensor/humidity"
|
||||
#define temperature_topic "sensor/temperature"
|
||||
|
||||
WiFiClient espClient;
|
||||
PubSubClient client(espClient);
|
||||
Adafruit_HDC1000 hdc = Adafruit_HDC1000();
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
setup_wifi();
|
||||
client.setServer(mqtt_server, 1883);
|
||||
|
||||
// Set SDA and SDL ports
|
||||
Wire.begin(2, 14);
|
||||
|
||||
// Start sensor
|
||||
if (!hdc.begin()) {
|
||||
Serial.println("Couldn't find sensor!");
|
||||
while (1);
|
||||
}}
|
||||
|
||||
void setup_wifi() {
|
||||
delay(10);
|
||||
// We start by connecting to a WiFi network
|
||||
Serial.println();
|
||||
Serial.print("Connecting to ");
|
||||
Serial.println(wifi_ssid);
|
||||
|
||||
WiFi.begin(wifi_ssid, wifi_password);
|
||||
|
||||
while (WiFi.status() != WL_CONNECTED) {
|
||||
delay(500);
|
||||
Serial.print(".");
|
||||
}
|
||||
|
||||
Serial.println("");
|
||||
Serial.println("WiFi connected");
|
||||
Serial.println("IP address: ");
|
||||
Serial.println(WiFi.localIP());
|
||||
}
|
||||
|
||||
void reconnect() {
|
||||
// Loop until we're reconnected
|
||||
while (!client.connected()) {
|
||||
Serial.print("Attempting MQTT connection...");
|
||||
// Attempt to connect
|
||||
// If you do not want to use a username and password, change next line to
|
||||
// if (client.connect("ESP8266Client")) {
|
||||
if (client.connect("ESP8266Client", mqtt_user, mqtt_password)) {
|
||||
Serial.println("connected");
|
||||
} else {
|
||||
Serial.print("failed, rc=");
|
||||
Serial.print(client.state());
|
||||
Serial.println(" try again in 5 seconds");
|
||||
// Wait 5 seconds before retrying
|
||||
delay(5000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool checkBound(float newValue, float prevValue, float maxDiff) {
|
||||
return newValue < prevValue - maxDiff || newValue > prevValue + maxDiff;
|
||||
}
|
||||
|
||||
long lastMsg = 0;
|
||||
float temp = 0.0;
|
||||
float hum = 0.0;
|
||||
float diff = 1.0;
|
||||
|
||||
void loop() {
|
||||
if (!client.connected()) {
|
||||
reconnect();
|
||||
}
|
||||
client.loop();
|
||||
|
||||
long now = millis();
|
||||
if (now - lastMsg > 1000) {
|
||||
lastMsg = now;
|
||||
|
||||
float newTemp = hdc.readTemperature();
|
||||
float newHum = hdc.readHumidity();
|
||||
|
||||
if (checkBound(newTemp, temp, diff)) {
|
||||
temp = newTemp;
|
||||
Serial.print("New temperature:");
|
||||
Serial.println(String(temp).c_str());
|
||||
client.publish(temperature_topic, String(temp).c_str(), true);
|
||||
}
|
||||
|
||||
if (checkBound(newHum, hum, diff)) {
|
||||
hum = newHum;
|
||||
Serial.print("New humidity:");
|
||||
Serial.println(String(hum).c_str());
|
||||
client.publish(humidity_topic, String(hum).c_str(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
<h3>Configuring Home Assistant</h3>
|
||||
|
||||
<p>The last step is to integrate the sensor values into Home Assistant. This can be done by setting up
|
||||
Home Assistant to connect to the MQTT broker and subscribe to the sensor topics.</p>
|
||||
|
||||
<pre><code class="yaml">mqtt:
|
||||
broker: YOUR_MQTT_SERVER_HOST
|
||||
username: your_username
|
||||
password: your_password
|
||||
|
||||
sensor:
|
||||
platform: mqtt
|
||||
name: "Temperature"
|
||||
state_topic: "sensor/temperature"
|
||||
qos: 0
|
||||
unit_of_measurement: "ºC"
|
||||
|
||||
sensor 2:
|
||||
platform: mqtt
|
||||
name: "Humidity"
|
||||
state_topic: "sensor/humidity"
|
||||
qos: 0
|
||||
unit_of_measurement: "%"
|
||||
</code></pre>
|
||||
]]></content>
|
||||
</entry>
|
||||
|
||||
<entry>
|
||||
<title type="html"><![CDATA[Using MQTT with Home Assistant]]></title>
|
||||
<link href="https://home-assistant.io/blog/2015/09/11/different-ways-to-use-mqtt-with-home-assistant/"/>
|
||||
<updated>2015-09-11T02:19:38-07:00</updated>
|
||||
<id>https://home-assistant.io/blog/2015/09/11/different-ways-to-use-mqtt-with-home-assistant</id>
|
||||
<content type="html"><![CDATA[<p><img src='https://home-assistant.io/images/supported_brands/mqtt.png' style='border:none; box-shadow: none; float: right;' height='80' />
|
||||
The <a href="https://en.wikipedia.org/wiki/MQTT">MQTT</a> support was added to Home Assistant recently. The <a href="https://home-assistant.io/components/mqtt.html">MQTT component</a> will enable you to do all sort of things. Most likely you will use it to communicate with your devices. But Home Assistant doesn’t care where the data is coming from or is limited to real hardware as long as there is MQTT support. This means that it doesn’t matter if the data is coming from a human, a web service, or a device.</p>
|
||||
|
||||
<p>A great example is shown in a <a href="https://home-assistant.io/blog/2015/08/26/laundry-automation-with-moteino-mqtt-and-home-assistant/">Laundry Automation</a> post in this blog.</p>
|
||||
|
||||
<p>This post will give you a small overview of some other possibilities on how to use MQTT with Home Assistant.</p>
|
||||
|
||||
<!--more-->
|
||||
|
||||
|
||||
<h3><a class='title-link' name='manual-usage' href='#manual-usage'></a> Manual usage </h3>
|
||||
|
||||
<p>The simplest but not the coolest way as a human to interact with a Home Assistant sensor is launching a command manually. Let’s create a “Mood” sensor. For simplicity Home Assistant and the MQTT broker are both running on the same host. The needed configuration snipplets to add to the <code>configuration.yaml</code> file consists of two parts: one for the broker and one for the sensor.</p>
|
||||
|
||||
<pre><code class="yaml">mqtt:
|
||||
broker: 127.0.0.1
|
||||
|
||||
sensor:
|
||||
- platform: mqtt
|
||||
name: "Fabian's Mood"
|
||||
state_topic: "home-assistant/fabian/mood"
|
||||
</code></pre>
|
||||
|
||||
<p>After a restart of Home Assistant the “Mood” sensor will show up in the frontend. For more details about the configuration of MQTT itself and the sensor, please refer to the <a href="https://home-assistant.io/components/mqtt.html">MQTT component</a> or the <a href="https://home-assistant.io/components/sensor.mqtt.html">MQTT sensor</a> documentation.</p>
|
||||
|
||||
<p>Now we can set the mood. The commandline tool (<code>mosquitto_pub</code>) which is shipped with <code>mosquitto</code> is used to send an MQTT message.</p>
|
||||
|
||||
<pre><code class="bash">mosquitto_pub -h 127.0.0.1 -t "home-assistant/fabian/mood" -m "bad"
|
||||
</code></pre>
|
||||
|
||||
<p class='img'>
|
||||
<img src='https://home-assistant.io/images/blog/2015-09-mqtt/mood.png' />
|
||||
The Mood sensor
|
||||
</p>
|
||||
|
||||
|
||||
<p>This is a really bad example. Don’t do this in the real world because you won’t be able to create diagrams of historical data. Better use a numerical value.</p>
|
||||
|
||||
<h3><a class='title-link' name='python-mqtt-bindings' href='#python-mqtt-bindings'></a> Python MQTT bindings </h3>
|
||||
|
||||
<p>The last section was pretty boring, I know. Nobody wants to send MQTT messages by hand if there is a computer on the desk. If you are playing the lottery this section is for you. If not, read it anyway because the lottery is just an example :-).</p>
|
||||
|
||||
<p>This example is using the <a href="https://eclipse.org/paho/clients/python/">Paho MQTT Python binding</a> because those binding should be available on the host where Home Assistant is running. If you want to use this example on another machine, please make sure that the bindings are installed (<code>pip3 install paho-mqtt</code>).</p>
|
||||
|
||||
<p>The first step is to add an additional MQTT sensor to the <code>configuration.yaml</code> file. The sensor will be called “Lottery” and the unit of measurement will be “No.”.</p>
|
||||
|
||||
<pre><code class="yaml"> - platform: mqtt
|
||||
name: "Lottery"
|
||||
state_topic: "home-assistant/lottery/number"
|
||||
unit_of_measurement: "No."
|
||||
</code></pre>
|
||||
|
||||
<p>Don’t forget to restart Home Assistant to make the configuration active.</p>
|
||||
|
||||
<p>To play, we need numbers from 1 to 49 which can be marked on the ticket. Those numbers should be random and displayed in the Home Assistant frontend. The Python script below is another simple example on how to send MQTT messages from the commandline; this time in a loop. For further information and examples please check the <a href="https://eclipse.org/paho/clients/python/docs/">Paho MQTT</a> documentation.</p>
|
||||
|
||||
<pre><code class="python">#!/usr/bin/python3
|
||||
#
|
||||
import time
|
||||
import random
|
||||
import paho.mqtt.client as mqtt
|
||||
import paho.mqtt.publish as publish
|
||||
|
||||
broker = '127.0.0.1'
|
||||
state_topic = 'home-assistant/lottery/number'
|
||||
delay = 5
|
||||
|
||||
# Send a single message to set the mood
|
||||
publish.single('home-assistant/fabian/mood', 'good', hostname=broker)
|
||||
|
||||
# Send messages in a loop
|
||||
client = mqtt.Client("ha-client")
|
||||
client.connect(broker)
|
||||
client.loop_start()
|
||||
|
||||
while True:
|
||||
client.publish(state_topic, random.randrange(0, 50, 1))
|
||||
time.sleep(delay)
|
||||
</code></pre>
|
||||
|
||||
<p>Every 5 seconds a message with a new number is sent to the broker and picked up by Home Assistant. By the way, my mood is much better now.</p>
|
||||
|
||||
<p class='img'>
|
||||
<img src='https://home-assistant.io/images/blog/2015-09-mqtt/lottery.png' />
|
||||
The Lottery sensor
|
||||
</p>
|
||||
|
||||
|
||||
<p>With only a few lines of Python and an MQTT broker you can create your own “smartdevice” or send information to Home Assistant which you haven’t think of. Of course this is not limited to Python. If there is an MQTT library available, the device can be used with Home Assistant now.</p>
|
||||
|
||||
<h3><a class='title-link' name='arduino' href='#arduino'></a> Arduino </h3>
|
||||
|
||||
<p>To get started with real hardware that is capable to send MQTT messages, the Arduino platform is an inexpensive way to do it. In this section an Arduino UNO with an Ethernet shield and a photo resistor is used. The photo resistor is connected to analog pin 0 (A0) and has an output from 0 to 1024.</p>
|
||||
|
||||
<p class='img'>
|
||||
<img src='https://home-assistant.io/images/blog/2015-09-mqtt/arduino-shield.png' />
|
||||
The Arduino UNO with Ethernet shield and photo resistor
|
||||
</p>
|
||||
|
||||
|
||||
<p>The <a href="http://knolleary.github.io/pubsubclient/">MQTT client</a> for the Arduino needs to be available in your Arduino IDE. Below you will find a sketch which could act as a starting point. Please modify the IP addresses, the MAC address, and the pin as needed and upload the sketch to your Arduino.</p>
|
||||
|
||||
<pre><code class="c">/*
|
||||
This sketch is based on the basic MQTT example by
|
||||
http://knolleary.github.io/pubsubclient/
|
||||
*/
|
||||
|
||||
#include <SPI.h>
|
||||
#include <Ethernet.h>
|
||||
#include <PubSubClient.h>
|
||||
|
||||
#define DEBUG 1 // Debug output to serial console
|
||||
|
||||
// Device settings
|
||||
IPAddress deviceIp(192, 168, 0, 43);
|
||||
byte deviceMac[] = { 0xAB, 0xCD, 0xFE, 0xFE, 0xFE, 0xFE };
|
||||
char* deviceId = "sensor01"; // Name of the sensor
|
||||
char* stateTopic = "home-assistant/sensor01/brightness"; // MQTT topic where values are published
|
||||
int sensorPin = A0; // Pin to which the sensor is connected to
|
||||
char buf[4]; // Buffer to store the sensor value
|
||||
int updateInterval = 1000; // Interval in miliseconds
|
||||
|
||||
// MQTT server settings
|
||||
IPAddress mqttServer(192, 168, 0, 12);
|
||||
int mqttPort = 1883;
|
||||
|
||||
EthernetClient ethClient;
|
||||
PubSubClient client(ethClient);
|
||||
|
||||
void reconnect() {
|
||||
while (!client.connected()) {
|
||||
#if DEBUG
|
||||
Serial.print("Attempting MQTT connection...");
|
||||
#endif
|
||||
if (client.connect(deviceId)) {
|
||||
#if DEBUG
|
||||
Serial.println("connected");
|
||||
#endif
|
||||
} else {
|
||||
#if DEBUG
|
||||
Serial.print("failed, rc=");
|
||||
Serial.print(client.state());
|
||||
Serial.println(" try again in 5 seconds");
|
||||
#endif
|
||||
delay(5000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void setup() {
|
||||
Serial.begin(57600);
|
||||
client.setServer(mqttServer, mqttPort);
|
||||
Ethernet.begin(deviceMac, deviceIp);
|
||||
delay(1500);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
if (!client.connected()) {
|
||||
reconnect();
|
||||
}
|
||||
client.loop();
|
||||
|
||||
int sensorValue = analogRead(sensorPin);
|
||||
#if DEBUG
|
||||
Serial.print("Sensor value: ");
|
||||
Serial.println(sensorValue);
|
||||
#endif
|
||||
client.publish(stateTopic, itoa(sensorValue, buf, 10));
|
||||
delay(updateInterval);
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
<p>The Arduino will send the value of the sensor every second. To use the data in Home Assistant, add an additional MQTT sensor to the <code>configuration.yaml</code> file.</p>
|
||||
|
||||
<pre><code class="yaml"> - platform: mqtt
|
||||
name: "Brightness"
|
||||
state_topic: "home-assistant/sensor01/brightness"
|
||||
unit_of_measurement: "cd"
|
||||
</code></pre>
|
||||
|
||||
<p>After a restart of Home Assistant the values of your Arduino will be available.</p>
|
||||
|
||||
<p class='img'>
|
||||
<img src='https://home-assistant.io/images/blog/2015-09-mqtt/arduino.png' />
|
||||
The Brightness sensor
|
||||
</p>
|
||||
|
||||
|
||||
<p>I hope that this post could give you some ideas about the usage Home Assistant and MQTT. If you are working on a cool project that includes Home Assistant, please let us now.</p>
|
||||
]]></content>
|
||||
</entry>
|
||||
|
||||
</feed>
|
348
blog/categories/mqtt/index.html
Normal file
348
blog/categories/mqtt/index.html
Normal file
|
@ -0,0 +1,348 @@
|
|||
<!doctype html>
|
||||
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
|
||||
<!--[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>Category: mqtt - Home Assistant</title>
|
||||
<meta name="author" content="Paulus Schoutsen">
|
||||
|
||||
<meta name="description" content="Category: mqtt">
|
||||
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="canonical" href="https://home-assistant.io/blog/categories/mqtt">
|
||||
|
||||
<meta property="fb:app_id" content="338291289691179">
|
||||
<meta property="og:title" content="Category: mqtt">
|
||||
<meta property="og:site_name" content="Home Assistant">
|
||||
<meta property="og:url" content="https://home-assistant.io/blog/categories/mqtt/">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="Category: mqtt">
|
||||
<meta property="og:image" content="https://home-assistant.io/images/home-assistant-logo-2164x2164.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='/images/favicon-192x192.png'> Home Assistant
|
||||
</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>
|
||||
<ul>
|
||||
<li><a href='/getting-started/'>Installing Home Assistant</a></li>
|
||||
<li><a href='/getting-started/configuration.html'>Configuration basics</a></li>
|
||||
<li><a href='/getting-started/devices.html'>Adding devices</a></li>
|
||||
<li><a href='/getting-started/presence-detection.html'>Presence detection</a></li>
|
||||
<li><a href='/getting-started/automation.html'>Automation</a></li>
|
||||
<li><a href='/cookbook'>Configuration cookbook</a></li>
|
||||
<li><a href='/components/'>Component overview</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/developers/">Developers</a>
|
||||
<ul>
|
||||
<li><a href="/developers/architecture.html">Architecture</a></li>
|
||||
<li><a href="/developers/frontend.html">Frontend development</a></li>
|
||||
<li><a href="/developers/creating_components.html">
|
||||
Creating components
|
||||
</a></li>
|
||||
<li><a href="/developers/add_new_platform.html">
|
||||
Adding platform support
|
||||
</a></li>
|
||||
<li><a href="/developers/api.html">API</a></li>
|
||||
<li><a href="/developers/credits.html">Credits</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="/blog/">Blog</a></li>
|
||||
<li><a href="/help/">Need help?</a></li>
|
||||
</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">
|
||||
|
||||
|
||||
<header>
|
||||
<h1 class="title indent">
|
||||
Category: Mqtt
|
||||
</h1>
|
||||
</header>
|
||||
<hr class="divider">
|
||||
|
||||
|
||||
<div id="archive-list">
|
||||
|
||||
|
||||
|
||||
|
||||
<h2>2015</h2>
|
||||
|
||||
<article>
|
||||
|
||||
|
||||
<div class="grid">
|
||||
|
||||
<div class="grid__item one-fifth palm-one-whole">
|
||||
<time datetime="2015-10-11T12:10:00-07:00" pubdate>
|
||||
<span class='month'>Oct</span> <span class='day'>11</span>
|
||||
</time>
|
||||
</div>
|
||||
<div class="grid__item four-fifths palm-one-whole">
|
||||
<h1 class="gamma"><a href="/blog/2015/10/11/measure-temperature-with-esp8266-and-report-to-mqtt/">Report the temperature with ESP8266 to MQTT</a></h1>
|
||||
|
||||
<footer class="meta">
|
||||
|
||||
|
||||
<span>
|
||||
<i class="icon-tags"></i>
|
||||
<ul class="tags unstyled">
|
||||
|
||||
|
||||
<li><a class='category' href='/blog/categories/esp8266/'>esp8266</a></li>
|
||||
|
||||
<li><a class='category' href='/blog/categories/how-to/'>how-to</a></li>
|
||||
|
||||
<li><a class='category' href='/blog/categories/mqtt/'>mqtt</a></li>
|
||||
|
||||
|
||||
</ul>
|
||||
</span>
|
||||
|
||||
</footer>
|
||||
|
||||
<hr class="divider">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</article>
|
||||
|
||||
|
||||
|
||||
<article>
|
||||
|
||||
|
||||
<div class="grid">
|
||||
|
||||
<div class="grid__item one-fifth palm-one-whole">
|
||||
<time datetime="2015-09-11T02:19:38-07:00" pubdate>
|
||||
<span class='month'>Sep</span> <span class='day'>11</span>
|
||||
</time>
|
||||
</div>
|
||||
<div class="grid__item four-fifths palm-one-whole">
|
||||
<h1 class="gamma"><a href="/blog/2015/09/11/different-ways-to-use-mqtt-with-home-assistant/">Using MQTT with Home Assistant</a></h1>
|
||||
|
||||
<footer class="meta">
|
||||
|
||||
|
||||
<span>
|
||||
<i class="icon-tags"></i>
|
||||
<ul class="tags unstyled">
|
||||
|
||||
|
||||
<li><a class='category' href='/blog/categories/how-to/'>how-to</a></li>
|
||||
|
||||
<li><a class='category' href='/blog/categories/mqtt/'>mqtt</a></li>
|
||||
|
||||
|
||||
</ul>
|
||||
</span>
|
||||
|
||||
</footer>
|
||||
|
||||
<hr class="divider">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</article>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</article>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<aside id="sidebar" class="grid__item one-third lap-one-whole palm-one-whole">
|
||||
<div class="grid">
|
||||
|
||||
|
||||
|
||||
|
||||
<section class="sharing aside-module grid__item one-whole lap-one-half">
|
||||
<h1 class="title delta">Share this post</h1>
|
||||
|
||||
<a href="//twitter.com/share"
|
||||
class="twitter-share-button"
|
||||
data-url="https://home-assistant.io/blog/categories/mqtt/index.html"
|
||||
data-counturl="https://home-assistant.io/blog/categories/mqtt/index.html" >Tweet</a>
|
||||
|
||||
|
||||
<div class="g-plusone" data-size="standard"></div>
|
||||
|
||||
|
||||
<div class="fb-share-button" style='top: -6px;'
|
||||
data-href="https://home-assistant.io/blog/categories/mqtt/index.html"
|
||||
data-layout="button_count">
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
|
||||
|
||||
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
||||
|
||||
<script>
|
||||
window.fbAsyncInit = function() {
|
||||
FB.init({
|
||||
appId : '338291289691179',
|
||||
xfbml : true,
|
||||
version : 'v2.2'
|
||||
});
|
||||
};
|
||||
|
||||
(function(d, s, id){
|
||||
var js, fjs = d.getElementsByTagName(s)[0];
|
||||
if (d.getElementById(id)) {return;}
|
||||
js = d.createElement(s); js.id = id;
|
||||
js.src = "//connect.facebook.net/en_US/sdk.js";
|
||||
fjs.parentNode.insertBefore(js, fjs);
|
||||
}(document, 'script', 'facebook-jssdk'));
|
||||
</script>
|
||||
<section id="recent-posts" class="aside-module grid__item one-whole lap-one-half">
|
||||
<h1 class="title delta">Other Posts</h1>
|
||||
<ul class="divided">
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/10/11/measure-temperature-with-esp8266-and-report-to-mqtt/">Report the temperature with ESP8266 to MQTT</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/10/11/rfxtrx-blinkstick-and-snmp-support/">0.7.5: Blinkstick, SNMP, Telegram</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/10/05/home-assistant-goes-geo-with-owntracks/">Home Assistant goes geo with OwnTracks</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/09/19/alarm-sonos-and-itunes-support/">Alarms, Sonos and iTunes now supported</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/09/18/monitoring-with-glances-and-home-assistant/">Remote Monitoring with Glances</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</aside>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
<div class="grid-wrapper">
|
||||
<div class="grid">
|
||||
<div class="grid__item">
|
||||
<p class="copyright">
|
||||
<span class="credit">Powered by <a href="http://octopress.org">Octopress</a>, <a href='http://jekyllrb.com/'>Jekyll</a> and the <a href='https://github.com/coogie/oscailte'>Oscalite theme</a>. Hosted by <a href='https://pages.github.com/'>GitHub</a> and served by <a href='https://cloudflare.com'>CloudFlare</a>.</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</footer>
|
||||
|
||||
<!--[if lt IE 7]>
|
||||
<p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
|
||||
<![endif]-->
|
||||
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
var _gaq=[['_setAccount','UA-57927901-1'],['_trackPageview']];
|
||||
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
|
||||
g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
|
||||
s.parentNode.insertBefore(g,s)}(document,'script'));
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
var disqus_shortname = 'home-assistant';
|
||||
|
||||
|
||||
var disqus_script = 'count.js';
|
||||
|
||||
(function () {
|
||||
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
|
||||
dsq.src = '//' + disqus_shortname + '.disqus.com/' + disqus_script;
|
||||
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
||||
}());
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -4,7 +4,7 @@
|
|||
<title><![CDATA[Category: release-notes | Home Assistant]]></title>
|
||||
<link href="https://home-assistant.io/blog/categories/release-notes/atom.xml" rel="self"/>
|
||||
<link href="https://home-assistant.io/"/>
|
||||
<updated>2015-10-11T11:39:41-07:00</updated>
|
||||
<updated>2015-10-11T13:16:06-07:00</updated>
|
||||
<id>https://home-assistant.io/</id>
|
||||
<author>
|
||||
<name><![CDATA[Paulus Schoutsen]]></name>
|
||||
|
|
|
@ -655,6 +655,12 @@
|
|||
<ul class="divided">
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/10/11/measure-temperature-with-esp8266-and-report-to-mqtt/">Report the temperature with ESP8266 to MQTT</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/10/11/rfxtrx-blinkstick-and-snmp-support/">0.7.5: Blinkstick, SNMP, Telegram</a>
|
||||
</li>
|
||||
|
@ -678,12 +684,6 @@
|
|||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/09/13/home-assistant-meets-ifttt/">Home Assistant meets IFTTT</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<title><![CDATA[Category: user-stories | Home Assistant]]></title>
|
||||
<link href="https://home-assistant.io/blog/categories/user-stories/atom.xml" rel="self"/>
|
||||
<link href="https://home-assistant.io/"/>
|
||||
<updated>2015-10-11T11:39:41-07:00</updated>
|
||||
<updated>2015-10-11T13:16:06-07:00</updated>
|
||||
<id>https://home-assistant.io/</id>
|
||||
<author>
|
||||
<name><![CDATA[Paulus Schoutsen]]></name>
|
||||
|
|
|
@ -246,6 +246,12 @@
|
|||
<ul class="divided">
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/10/11/measure-temperature-with-esp8266-and-report-to-mqtt/">Report the temperature with ESP8266 to MQTT</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/10/11/rfxtrx-blinkstick-and-snmp-support/">0.7.5: Blinkstick, SNMP, Telegram</a>
|
||||
</li>
|
||||
|
@ -269,12 +275,6 @@
|
|||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/09/13/home-assistant-meets-ifttt/">Home Assistant meets IFTTT</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<title><![CDATA[Category: website | Home Assistant]]></title>
|
||||
<link href="https://home-assistant.io/blog/categories/website/atom.xml" rel="self"/>
|
||||
<link href="https://home-assistant.io/"/>
|
||||
<updated>2015-10-11T11:39:41-07:00</updated>
|
||||
<updated>2015-10-11T13:16:06-07:00</updated>
|
||||
<id>https://home-assistant.io/</id>
|
||||
<author>
|
||||
<name><![CDATA[Paulus Schoutsen]]></name>
|
||||
|
|
|
@ -209,6 +209,12 @@
|
|||
<ul class="divided">
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/10/11/measure-temperature-with-esp8266-and-report-to-mqtt/">Report the temperature with ESP8266 to MQTT</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/10/11/rfxtrx-blinkstick-and-snmp-support/">0.7.5: Blinkstick, SNMP, Telegram</a>
|
||||
</li>
|
||||
|
@ -232,12 +238,6 @@
|
|||
</li>
|
||||
|
||||
|
||||
|
||||
<li class="post">
|
||||
<a href="/blog/2015/09/13/home-assistant-meets-ifttt/">Home Assistant meets IFTTT</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue