Skip to content

Build Description for my Garage Door Sensor and Integration into Home Assistant

Notifications You must be signed in to change notification settings

JamesMcCarthy79/Garage-Door-Sensor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 

Repository files navigation

Garage-Door-Sensor

Build Description for my Garage Door Sensor and Integration into Home Assistant

Be sure to ⭐ my repo!


This repo is to help anyone that wishes to build a cheap distance sensor to determine if your garage door is open/closed and if your car is parked inside or not.


The scope of this project was to create a sensor that could tell me if I have left my door open or not from within my home automation software "Home Assistant". Once integrated into home assistant I could then set automations to close the door during my goodnight script if it was still open or close it if we are not home for more then 10mins.

Garage Sensor Topology

Garage Door Sensor Hardware

I used the Pycom WiPy as my micro controller and the Pycom expansion board for my pin breakouts.


Pycom WiPy 3.0 Pycom Expansion Board 3.0 HC-SR04 ABS Enclosure

Setup Guide

Step One - Update to Latest Firmware

You will firstly need to update your boards firmware to the latest version details of how to do this can be found here...

Step Two - Upload Code to Board

To access your board you will need to load up your favourite editor I use Atom it has a plugin called pymakr designed for programming your pycom boards. Copy all the contents from within the `Garage Sensor folder` and add them to the root of your module.

You will need to edit the `boot.py` file on line 19 with your preferred username/password this will set the access to the sensor once you connect to it from its IP Address.

Next you will need to go into the `Config` Folder and edit the `Wi-Fi_Details` file, in here you will set your wireless SSID and Password. You can also set a static IP details in here, the code uses dhcp by default if you wish to use staic IP Address please see section below.


**If you would like to use a Static IP Address read below otherwise skip this step**

To use a Static IP you will need to go to the `Wi-Fi` folder and edit the `Wi-Fi.py` file. Place a hashtag infront of line 33 and remove the hashtag from line 32, this will tell the code to take the details from the IP settings you set in the step above.

Lastly it's time to adjust the distances to suit your purpose open the `main.py` and scroll down to line 57. This line will print on the screen the actual distance to an object in "cm" you can use this to adjust the lines below to your own use case.

Line 58 - Is your distance when the door is open I use the distance measured when the door is closed plus 1cm.

Line 59 - This is the payload that is will be sent to your broker if the door is "open"

Line 61 - Is your distance if an object is between your sensor placement and the door, this could be your car or surfboard has fallen into the path. I set mine to be lower then the distance of the closed door measurement.

Line 62 - This is the payload that will be sent to your broker if the path to the door is obstructed

Line 64 - This is the payload that will be sent if the above conditions are not met for me I have set this as the door being "closed".

Connection Guide

HC-SR04 Connections Pycom Connections

For an example on how I integrated this sensor into Home Assistant please see my package here

About

Build Description for my Garage Door Sensor and Integration into Home Assistant

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages