/Open-Home-Automation

Open Home Automation with Home Assistant and MQTT

Primary LanguageArduinoMIT LicenseMIT

Open Home Automation with Home Assistant

Home Assistant

Home Assistant is a home automation platform running on Python 3. The goal of Home Assistant is to be able to track and control all devices at home and offer a platform for automating control [Home-Assistant].

Home-Assistant

MQTT

MQTT is a machine-to-machine (M2M)/"Internet of Things" connectivity protocol. It was designed as an extremely lightweight publish/subscribe messaging transport. It is useful for connections with remote locations where a small code footprint is required and/or network bandwidth is at a premium [mqtt.org].

Configuration

To integrate MQTT into Home Assistant, a MQTT broker is mandatory. More information can be found at the MQTT component's page.

configuration.yaml :

mqtt:
  broker: 127.0.0.1
  port: 1883
  client_id: '[Redacted]'
  username: '[Redacted]'
  password: '[Redacted]'

Examples

Lights, sensors, switches and more can be built on top of MQTT. This section contains a few examples based on MQTT and on a NodeMCU board (ESP8266).

Title / link Description
Light A simple example to control a led
Light A simple example to control a led and its brightness
Light A simple example to control a RGB led
Light An alternative firmware for the Arilux AL-LC0X LED controller
Light A simple example to control a RGBW led, based on the MQTT JSON Light component (brightness, rgb, white, color temperature and effects) and including the MQTT Discovery
Light An alternative firmware for AI-Thinker RGBW bulbs, based on the MQTT JSON Light component and including the MQTT Discovery functionality
Switch A simple example to control a switch
Switch An alternative firmware for the Sonoff Basic switches
Switch An alternative firmware for the Sonoff TH switches, including the MQTT Discovery functionality
Sensor A simple example to measure the temperature and the humidity (DHT22 sensor)
Sensor A simple example to measure the brightness (photocell)
Binary Sensor A simple example to detect motions (PIR motion sensor)
Binary Sensor A simple example to monitor the state of a window/door
Binary Sensor A full example describing how to monitor your environment

An advanced example, using WiFiManager, mDNS and OTA, is available here.

A school project based on Home Assistant, MQTT and NodeMCU modules is available here and the demo, here.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

If you like the content of this repo, please add a star! Thank you!