/Open-Home-Automation

Open Home Automation with Home Assistant and MQTT

Primary LanguageArduinoMIT LicenseMIT

Open Home Automation with Home Assistant

Home Assitant

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-Assitant

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
Switch A simple example to control a switch
Switch An alternative firmware for the Sonoff switches
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

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.

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