/ESP-MQTT-GarageDoorSensor

Monitor up to 3 garage doors, Temp and Humidity. Check if the garage door is open or closed and if there is a car occupying the spot. All sent via MQTT and integrated with home Assistant

Primary LanguageC++Apache License 2.0Apache-2.0

ESP8266 MQTT GarageDoorSensor and Temperture HomeAssistant

===================== This project allows for up to three "dumb" garage door openers to be controlled (open/close) and report garage door status (open/closed/occupied) via MQTT. In addition if you can also monitor the Temperture and Humidity within your garage to over MQTT as well.

The code covered in this repository utilizes Home Assistant's MQTT Cover Component and uses an ESP8266 microcontroller. There is a sample configuration in the repository

Inspiration for this comes from GarHAge and OpenGarage. I orginally forked this from https://github.com/DotNetDann/ESP-MQTT-GarageDoorSensor, and added the Temp and Humidity code for a DHT22 from GarHage, and now it morphed to change to NewPing for the ultrasonic HC-SR04 due to the inconsitant reading using the Ultrasonic library with the HC-SCR04 I aquired from china.

NOTE: I am currrently only using this with one garage door, to enable for 2 or 3, just enable the use to true in the auth.h file you create

Supported Features Include

  • Report status on up to 3 garage doors
  • Report information on Temp and Humidity
  • Ability to Select Celius or Fahrenheit for Temp
  • Web page for status of Garage Doors and Temperature
  • Events and status sent via MQTT
  • MQTT commands to toggle relays to open/close the garage doors
  • Over-the-Air (OTA) Upload from the ArduinoIDE!

OTA Uploading

This code also supports remote uploading to the ESP8266 using Arduino's OTA library. To utilize this, you'll need to first upload the sketch using the traditional USB method. However, if you need to update your code after that, your WIFI-connected ESP chip should show up as an option under Tools -> Port -> 'HostName'at your.ip.address.xxx.

More information on OTA uploading can be found here.

Parts List

Wiring Diagram

alt text

Web page

alt text alt text

Sample MQTT commands

Listen to MQTT commands

mosquitto_sub -h 172.17.0.1 -t '#'

Open the second garage door

mosquitto_pub -h 172.17.0.1 -t GarDoor/2/action -m "OPEN"