Skip to content

bigboxer23/PiGarage2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CodeQL

PiGarage 2.1

Updated from version one to use springboot to allow easy configuration of HTTPS and maven.

To add HTTPS support, create a file named application.properties and place into the src/resources directory. Example file contents would be something like:

server.port: 443
server.ssl.key-store: keystore.p12
server.ssl.key-store-password: mySecurePassword
server.ssl.keyStoreType: PKCS12

To generate a self signed certificate for development, the following command can be used: keytool -genkey -alias tomcat -storetype PKCS12 -keyalg RSA -keysize 2048 -keystore keystore.p12 -validity 3650

Good resource for setting this up: https://drissamri.be/blog/java/enable-https-in-spring-boot/

This project runs on a raspberry pi. It utilizes GPIO pins to track status of a magnetic sensor mounted to a garage door, and a relay used to open/close the door. It will trigger the garage door to close after a defined amount of time being left open. Additionally, it runs a small webserver which has REST service urls to trigger closing/opening the door and checking status. Additionally there's a dyp-me003 motion sensor wired up to reset the auto close timeout if motion detected. A temperature and humidity sensor can be attached to allow measurements to be fetched via REST url

Ties together these two projects:
Magnetic Sensor
Opener

Wiring devices to the pi

Sensor for garage door:

    <a href="http://www.smarthome.com/7455/Seco-Larm-SM-226L-Garage-Door-Contacts-for-Closed-Circuits/p.aspx">Seco-Larm SM-226L</a><br>

This is wired to Pin 9 (Ground) and Pin 13 (GPIO 27, WiringPi 2).

Sensor for garage house door:

Magnetic Door Sensor
The motion sensor wired up to pin 22 (GPIO 25, WiringPi 6), pin 20 (Ground)

Solid State Relay:

Solid State Relay
The solid state relay is wired to pin 6 (Ground), pin 2 (5v), and pin 7 (GPIO 4, WiringPi 7)

Motion Sensor:

PIR_Motion_Sensor_Module:DYP-ME003
The motion sensor wired up to pin 15 (GPIO 22, WiringPi 3), pin 2 (5v), pin 6 (Ground)

Temperature/Humidity Sensor (DHT22):

DHT22
The temperature/humidity sensor wired up to pin 19 (GPIO 10), pin 17 (3.3v), pin 25 (ground)
Note: This sensor requires the adafruit dht driver be installed in a path accessible location.
Example:

cd Adafruit-Raspberry-Pi-Python-Code/Adafruit_DHT_Driver<br>
sudo cp Adafruit_DHT /usr/bin

Configurable Properties

There are multiple configurable properties that can be set at runtime:
log.location: Path to the file to log information about opener status, actions, etc.
status.path: URL to get status from (default is "/Status2")
close.path: URL to close garage door (default is "/Close")
open.path: URL to open garage door (default is "/Open")
close.delay: Number of milliseconds before closing the door once it's detected open (default is 10 minutes)
triggerDelay: How long to leave the switch active before turning off (how long you press the physical button) (default is 400ms)
GPIO.status.pin: Pin to use for the magnetic sensor (default is WiringPi 2, pin 13)
GPIO.action.pin: Pin to use for the solid state relay (default is WiringPi 7, pin 7)
GPIO.motion.pin: Pin to use for the motion sensor (default is WiringPi 3, pin 15)
GPIO.temp.pin: Pin to use for the temperature sensor (default is GPIO 10, pin 19) GPIO.status.house.pin: Pin to use for the garage house door (default is WiringPi 6, pin 22)

Example application.properties

server.ssl.key-store: keystore.p12
server.ssl.key-store-password: mysupersecretpw
server.ssl.keyStoreType: PKCS12
GarageOpenUrl=https://myHub/S/OpenHAB/GarageOpen/100
GarageCloseUrl=ttps://myHub/S/OpenHAB/GarageClosed/100
GarageMotionUrl=https://myHub/S/OpenHAB/GarageLights/100
GarageHouseDoorUrl=https://myHub/S/OpenHAB/GarageLights/100
GarageNotificationUrl=https:/myHub/S/Notification
logbackserver=192.168.0.234:5671

Setup on pi:

Edit and run the scripts/install.sh. It will create a service definition which will launch the app automatically

About

SpringBoot webserver to remotely monitor and control a garage using a raspberry pi

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published