Publish MQTT blog post

This commit is contained in:
Paulus Schoutsen 2015-09-11 09:26:27 -07:00
parent c4a017063e
commit 49d6c3e8a2
2 changed files with 10 additions and 11 deletions

@ -1 +1 @@
Subproject commit 5a20d28e54328a61b0719eccbffe13cebf59752c
Subproject commit c16793d62c8e54a260fae7cd6606c0ffbe376e40

View File

@ -10,6 +10,7 @@ categories: how-to
og_image: /images/blog/2015-09-mqtt/arduino.png
---
<img src='/images/supported_brands/mqtt.png' style='border:none; box-shadow: none; float: right;' height='80' />
The [MQTT](https://en.wikipedia.org/wiki/MQTT) support was added to Home Assistant recently. The [MQTT component](https://home-assistant.io/components/mqtt.html) 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.
A great example is shown in a [Laundry Automation](https://home-assistant.io/blog/2015/08/26/laundry-automation-with-moteino-mqtt-and-home-assistant/) post in this blog.
@ -17,7 +18,7 @@ A great example is shown in a [Laundry Automation](https://home-assistant.io/blo
This post will give you a small overview of some other possibilities on how to use MQTT with Home Assistant.
<!--more-->
## {% linkable_title Manual usage %}
### {% linkable_title Manual usage %}
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 `configuration.yaml` file consists of two parts: one for the broker and one for the sensor.
@ -45,7 +46,7 @@ mosquitto_pub -h 127.0.0.1 -t "home-assistant/fabian/mood" -m "bad"
The Mood sensor
</p>
## {% linkable_title Python MQTT bindings %}
### {% linkable_title Python MQTT bindings %}
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 :-).
@ -98,7 +99,7 @@ Every 5 seconds a message with a new number is sent to the broker and picked up
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.
## {% linkable_title Arduino %}
### {% linkable_title Arduino %}
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.
@ -197,5 +198,3 @@ After a restart of Home Assistant the values of your Arduino will be available.
</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.