Monitor Garage Door [Solved]

Forum for questions and support relating to the 1.34.x releases only.
pankaj13
Posts: 15
Joined: Fri Apr 24, 2020 12:57 am

Monitor Garage Door [Solved]

Post by pankaj13 »

Hi,

I am researching garage door openers and read few articles posted by few Home Assistant DIY enthusiasts, they have used few hardware such as opener, tilt sensor etc to achieve the functionality.

I am curious if there it is possible to use a camera with ZM to ascertain (without looking at the live feed) if a garage door is open or close?
Thanks,
Last edited by pankaj13 on Wed Dec 30, 2020 8:13 pm, edited 1 time in total.
Jayjay_seal
Posts: 12
Joined: Mon Dec 28, 2020 4:56 pm

Re: Monitor Garage Door

Post by Jayjay_seal »

This is very doable but i would not rely on zoneminder looking at the door. Zoneminder can't do this on it's own. Another thing to think about is.. what does trigger the door opening/closing and do you want this?

(it's a bit tricky to have one answer here as your garage door motor can be set up differently so a little tinkering is in order here)

- Zoneminder can look at pixels changing and if there is an alarm open the door. (not very secure, unless it's a public one)
- if you get fancy you can use object detection and open if a car is detected. (also not very secure as it would open the door as any car in in sight of the camera
- If you want to get even more fancy you can use licence plate detection. (you would think this would be the most secure way as nobody owns the same plate, but think of this... if someone would print out a license plate and hold it up to the camera the door will open).

There is just no way of knowing if the image is the actual real thing. you can use it however and the hardware requirements for it and setting it up are not hard to understand. But like i said before Zoneminder can't really do this "out-of-the-box".

if you still want to do this via camera, you can :)

First and most important: Most garage door openers (the box that contains the motor) have an extra connector with 2 leads that is used for opening the door from the inside with a button. This is just connecting the wire back into the device. You have to find this connector or find out another way how you can open the garage door by connecting 2 leads or....(this all depends on the door opener and how it operates normally.

This is what you need:

- A dedicated laptop, desktop, raspberry pi (or clone) or server. all need to be powered on 24/7.
- A homeassistant installation that runs on the device (or any other. i use homeassistant because it's easy to instal)
- A MQTT server (you can have homeassistant set that up for you)
- A Sonoff SV that you can set up to connect the 2 wires of the motor when a event happens that needs opening the door.
- A reed switch (magnetic door opener sensor) and a magnet (2 reed switches and possibly 2 magnets if you want to be real fancy).
- Set-up Zoneminder to use MQTT
- Jumper wires

There is some soldering involved depending on how you want to set this up.
Because this method can only send just 1 pulse to the motor the reed switches can sense if the door is open or closed. If a magnet is in proximity of the reed switch it will connect both leads and you can change the state of the door in homeassistant. Most garage doors probably will not send out it's state. But your mileage can vary. :)

https://www.youtube.com/watch?v=QMepwpyjMCY

If you want to be sure that the door opens with only a selected number of cars etc.... like for your own home... use a device in your car that sends out a BT signal or Wifi signal that connects to your homeassitant instance so it uses a bit of authentication before the door is opened. this works best if you power that device via your car and if the device powers off when you turn off your car.

This is a better solution (i guess). If you want to you can still use the camera detection but as a second layer.
https://www.youtube.com/watch?v=AU1KD_aJSMY
Last edited by Jayjay_seal on Wed Dec 30, 2020 10:42 am, edited 1 time in total.
pankaj13
Posts: 15
Joined: Fri Apr 24, 2020 12:57 am

Re: Monitor Garage Door

Post by pankaj13 »

@Jayjay_seal thanks for such detailed input and even more impressed with your writing style and attention to formatting :D

So I do have HA and ZM running on a dedicated Dell server machine with a decent hardware specs and also have few Sonoff switches that I bought over Thanksgiving sales :)

Also noticed that in your suggestions you assumed that camera is installed outside but I was thinking of installing it inside the garage and have it point towards the garage door to capture events as well as entry/exit events.

Let me work on the details outlined in the YT video and revert with updates & hopefully good news of a smart garage door 8)

Thanks a lot!!!
pankaj13
Posts: 15
Joined: Fri Apr 24, 2020 12:57 am

Re: Monitor Garage Door

Post by pankaj13 »

@Jayjay_seal

You also raised an excellent point, I mounted few cameras outside to get a feel for setting sensitivity and motion detection. All the cameras are set to 32-bit color, 1920x1080 resolution and the main street is literally (with cars passing) about 30 feet away but I cannot read the license plate of any car - not even the ones parked on my own driveway which are about 20 feet away from camera.

I'd love to be able to see car title plates using these cameras and not sure what I am doing wrong.
Thanks.
Jayjay_seal
Posts: 12
Joined: Mon Dec 28, 2020 4:56 pm

Re: Monitor Garage Door

Post by Jayjay_seal »

From the inside, this could work with some minor issues.

Just by setting op a small zone that scans a small portion of the door... then again... it's just looking at pixels and i'm wondering what happens when the door is open (this just depends on your personal use case). Also a trigger event will happen when you turn on your garage lights or... when there is no light your cameras will not see a change without IR.

What will it scan for. I thought about putting like a sticker on the door with something it can detect via the camera image... but if the door is open it would show the street and you could end of with false positives (like my outside cameras give an alarm when we have cloud coverage and all of a sudden the sun comes back and shines very bright.

Camera detection could be nice for this... but it's probably not the way to go this time :)
Jayjay_seal
Posts: 12
Joined: Mon Dec 28, 2020 4:56 pm

Re: Monitor Garage Door

Post by Jayjay_seal »

I have set-up licence-plate detection and it works just good... it even passes the string to home-assistant. Then again a very specific camera mounting point needs to be used.... (like a top down view from above the door and zones properly set-up). Though my camera is mounted at an angle and on the outside of a bend even. it still works because i had setup my zones in a way that it only starts scanning when i'm sure a licence plate can be read.. then again if someone is in a hurry it might not catch it :-)

Plate detection will work but the first few images it captures it has to see the license-plate or it will not work. You can check what frame it scanned by going into the event list and check the cause:

Motion
[x] detected:car:100% person:96% truck:89% Motion: Voordeur - Mat, Voordeur - Sensor

If you have set up object detecting you can click the bottom line where it shows what it has detected. You can play with your ZM settings. Sometimes you need to edit the zones or change what image is processed to get a better set-up or in extreme move the camera mount. If an object is detected it will draw a rectangle around it and give it a label this will also show the licenceplates lettering in the labeling..
Last edited by Jayjay_seal on Wed Dec 30, 2020 11:11 am, edited 1 time in total.
pankaj13
Posts: 15
Joined: Fri Apr 24, 2020 12:57 am

Re: Monitor Garage Door

Post by pankaj13 »

Alright now you are getting inside my head :D

1) First I thought of using my outside cameras to monitor and let my neighbors across the street know if their garage door is open. This ran into two issues namely - a) the front of their drive way looks different depending on time of the day and b) the vehicles parked on their driveway in front of garage door are variable that will create lot of false positives.
2) Inside the garage the good part is that illumination is uniform throughout the day (means its dark and get lonely :D ), so was thinking of following:
- light up garage ceiling lights every 10 min for 10 seconds (after sunset)
- take a picture of the garage door
- compare it to some base reference and then create an alarm

So few wish list items for ZM:
1) Is there a way to provide a base image and then use live feed to compare against it?
2) Can the above process (with reference images) be set for different times of the day (like day time or night time)?

My knowledge of ZM is very rudimentary so please excuse the wish list :)
pankaj13
Posts: 15
Joined: Fri Apr 24, 2020 12:57 am

Re: Monitor Garage Door

Post by pankaj13 »

That's great that you can read the license plate off camera feed, it only means that I am the moron who needs to RTFM :D

If you do not mind please post your camera/zone config (blanking out any sensitive details), I will see if I can mock the same set up.
Regards.
Jayjay_seal
Posts: 12
Joined: Mon Dec 28, 2020 4:56 pm

Re: Monitor Garage Door

Post by Jayjay_seal »

You will have to keep in mind the following: Once detection has ended and possibly the alarm. You are only left with what has been previously detected (correct me if i'm wrong) a new event will be blank and the image is processed another time.

So.... if your car is parked on your driveway and the mailman arrives it will detect your car another time (but it will pretend that it's a new event and a new car is detected).....and the mailman will also be detected this time.

If 2 cars are parked and one leaves you will have to use fancy magic programming in HA or Node-red to see which detected rectangle has moved or has gone....Also because it's a new event.... the car that has not been moved could have an entirely different rectangle (well maybe slightly off)

This also goes (almost without saying) that if you have a sudden sunburst (i live in Belgium, we have those frequently) it will do the entire detecting again...
Last edited by Jayjay_seal on Wed Dec 30, 2020 11:33 am, edited 1 time in total.
Jayjay_seal
Posts: 12
Joined: Mon Dec 28, 2020 4:56 pm

Re: Monitor Garage Door

Post by Jayjay_seal »

I mean if you're scanning products on a factory belt and products are in the same position every time you will get better results.... but a car moves more and is also affected by sunlight and other things like shadows...

I sometimes get detection's of an arrow plane parked in my driving at midnight :P i know i live close to an airport... but they never park in my driveway :P

And i know you can set the detection to only detect certain things.... but meh i don't really care about this one :P
pankaj13
Posts: 15
Joined: Fri Apr 24, 2020 12:57 am

Re: Monitor Garage Door

Post by pankaj13 »

So the Reed contact sensors mentioned in the YT video provides that "unambiguous" trigger about garage door being open or close?
Jayjay_seal
Posts: 12
Joined: Mon Dec 28, 2020 4:56 pm

Re: Monitor Garage Door

Post by Jayjay_seal »

Btw. do you have an account for alpr? because you need the API key for it to work. It's not that hard to set up. i used the manual for this and it almost instantly worked (after i tweaked my zones a bit) :)
Jayjay_seal
Posts: 12
Joined: Mon Dec 28, 2020 4:56 pm

Re: Monitor Garage Door

Post by Jayjay_seal »

pankaj13 wrote: Wed Dec 30, 2020 11:34 am So the Reed contact sensors mentioned in the YT video provides that "unambiguous" trigger about garage door being open or close?
Yes.. a reed switch is a lead that has a small "box" type of thing on it.... When a magnet passes it it bends the metal part inside so it makes contact and electricity can flow to the other side.... effectively making it a switch that is magnet operated :)

if you place the reed switch and the magnet in a way that if the door is closed the reed switch and the magnet are in proximity so the reed switch closes. You can effectively use this in HA to set the state to closed and you you want to get more fancy you can use another reed switch and a magnet to do this on the open state. Because the reed switch just makes a circuit you can use a sonoff or just a D1 mini to pull up and down pins and use this in HA :)

Using just one reed switch and 2 magnets will cause confusion as the reed switch can only be open or closed :P

as a side note: You can use only one reed switch that detects if it's open or not... You can say "Oh... i just want to see if it's open or not that is fine...." but i like to be more consequent (??) then rely on just one reed switch. Since a garage door is a "dumb" device... it's nice to know that the door has fully opened or not. This will also come in handy to determine if you need to send anther command to close the door. Since pushing the switch to open a garage door usually has 3 "modes"... 1st click will open... 2nd click when the door is moving will stop it and the 3rd one will close it... it makes programming more interesting :-) you know you will only have to send the command once if it's open or closed.... if it's halfway you have no way of knowing of the door is going to close or open on the next pulse.... but you can send it a pulse and wait for one of the 2 reed switches and pulse again if needed :)
Jayjay_seal
Posts: 12
Joined: Mon Dec 28, 2020 4:56 pm

Re: Monitor Garage Door

Post by Jayjay_seal »

But we are going off topic :P (mods: excuse me for that and doing double post :oops: )
alabamatoy
Posts: 349
Joined: Sun Jun 05, 2016 2:53 pm

Re: Monitor Garage Door

Post by alabamatoy »

Jayjay_seal wrote: Wed Dec 30, 2020 10:17 am
This is what you need:

- A dedicated laptop, desktop, raspberry pi (or clone) or server. all need to be powered on 24/7.
- A homeassistant installation that runs on the device (or any other. i use homeassistant because it's easy to instal)
- A MQTT server (you can have homeassistant set that up for you)
- A Sonoff SV that you can set up to connect the 2 wires of the motor when a event happens that needs opening the door.
- A reed switch (magnetic door opener sensor) and a magnet (2 reed switches and possibly 2 magnets if you want to be real fancy).
- Set-up Zoneminder to use MQTT
- Jumper wires
Wow, extreme complexity...I used one of these:
http://denkovi.com/relay-boards
Its USB, and one can easily write shell scripts to open and close the relays. It makes a really great lawn sprinkler controller, for example. The little relays can carry a surprising amount of current, so they could be used to actually power on/off the garage door opener, preventing or allowing remote use, and if its powered on, a second relay could be used to open or close the door as Jayjay_seal described but much simpler with just some bellwire from the opener contacts to the relay board.

If you need to read a switch setting, you can use one of these:
https://numato.com/product/8-channel-us ... og-inputs/
Also USB, they simply read the condition of a shunt, either open or closed.

Either of these can be scripted to be checked or set on some recurring basis, once per second or something, and then when your desired event occurs, do something, like curl the Zoneminder API to start recording as the garage door opens etc.

HTH
Post Reply