Garage Door Rule

Like many others, I'm going to set up a relay to control my garage door. I've been testing and playing with some virtual switches/sensors until my physical components arrive, and that works.

I started thinking now what will happen when I use the physical buttons (e.g. wife drives home and uses her remote to open the garage) or to integrate it into Alexa/Google Home (AGH).

Right now I have one rule that uses a global variable. I'm using that variable to determine the state of the "door", and to open/close it accordingly. What I started thinking about after was if I use AGH and tell it to "close the garage door", if the garage is actually closed, it will open.

My plan is to first split my current single rule into two rules. This way I can trigger each separately.

Instead of using the global variable though, would it be better to use a virtual switch and present that to AGH?

If I tell AGH to close the garage door, it would then check the status of the switch and only close it if it's actually opened, and vice versa. That would solve the AGH issue, but I would still have the physical issue.

If the wife uses the remote to open the garage, I'm guessing it would be best to add a contact sensor to help track the physical position and change my variable/virtual switch accordingly?

Just wanted to bounce ideas off the community to help me wrap my head around it since I'm currently working on like 3 different projects and my mind is all over the place.

I would only use a contact or tilt sensor. Any other way is going to never quite be correct. You can then use that sensor in a rule, or to activate a virtual switch. Alexa can see sensors, at least she can with my contact sensors. Not sure about Google.

I can't answer the other parts, I have never used global variables.

1 Like

Seconding @neonturbo's recommendation here - get a tilt or contact sensor.

I have a contact sensor I can move over there and try it with.

So instead of the global variable/virtual switch, I would just use the contact sensor as my trigger to do/not do things?

So for example:
"Alexa close garage door"
-> If garage contact sensor is open, trigger relay to close door

"Alexa open garage door"
-> If garage contact sensor is closed, trigger relay to open door

I guess in terms of the dashboard, I will have a button to trigger the relay and a status of the garage door to help me out.

Thanks for helping me clear this up. I've been tinkering with it all virtually, then was posing myself more questions and over complicating it.

I didn't see, or you didn't mention what device was actually controlling the door.

Like many others, I'm going to set up a relay to control my garage door

I got a smart plug to power a relay for a moment, then the relay will trigger the garage door.

This was the video that I found that inspired me to do it this way

I guess I can use a virtual switch to help control it from the AGH aspect. If the switch is on then the door is open, and vice versa. This would give me something to present to AGH, and I can set it's value based on the contact sensor.

This way when I tell AGH to open/close the door, it would trigger that virtual switch. Then depending on the status of the door, I can trigger the smart plug to actually open/close the door.

I'm not sure this is still relevant, but worth a try.

Lots of good info here too:

And here:

In fact, stalk @aaiyar 's account, he has lots of great info in those threads.

Thanks for these links. I believe I came across them before I posted mine as they didn't really address the concern I'm trying to achieve.

If I only used the phone/remote, then it would be fine since if I'm driving up I can see if I need to open/close the door, and if I use the phone I can see the status of the contact sensor.

I guess this thread was more so how to seamlessly integrate AGH into this so if I tell it to close/open the garage. I guess a virtual switch linked to my contact sensor will suffice.

So if the existing remote is used, the contact sensor knows the status of the door.

In say Alexa routines, I would make a routine that if I say "close garage door", I don't want it to trigger the smart plug if the door is already closed. I can use a virtual switch that will be on/off. If off, the door is closed. If I say "close garage door" and it's already closed/off, then it'll do nothing. If it's open though, it'll trigger a rule in hubitat to trigger the smart plug to close the door.

I am pretty sure that first link I posted will do exactly what you want. It takes into account the door state when controlling it. It uses virtual devices, and I believe it changes the virtual device from open to closed via the app. So that should just work once you get it installed and configured.

:joy:I just looked at the code in it and it accomplishes what I did in rules. I think I was just confusing myself with the extra rule of toggling the virtual contact sensor and overthinking it.

Thanks again for your help.

1 Like

One thing the code does have that I won't have is an accelerator. Since I'm just going to use a standard contact sensor, I think I'll stick with my rules. Definitely fun to play with the code and learn more though

Time to plug it up and test it out

Stupid MyQ 2.0+ doesn't work. Looks like I need to get another 2.0+ security device and tap this into that to control it

Can you solder?

Some people have tied into the physical button on the wall, and "pressed" that button with the relay. Basically same as what you did, but at the wall button microswitch.

I have a second button coming tomorrow. I'm going to put that in parallel with the existing setup and mount it by the opener. I don't want to tap into the existing panel as it's in my line of sight when I go into the garage. I'd prefer to not see it with the wires around it. If I connect it on the motor, it's above everything and will be out of the way. I plan on doing exactly this, soldering into that button and using it to trigger everything.

You can run another set of wires wherever you want, you could still mount your relay to the opener, and run the tiny wire over to the button on the wall.

Or are you saying your existing wires run behind the drywall or are hidden somehow?

yea, existing wires are in the wall. the only way i would get extra wire to the switch would be to use the existing wire as a snake, and have it pull new wire through

Worst case if I can't put the two control panels in parallel, I'll just get another remote to program and have to manage the battery over time. I'm trying to use a second control panel so I won't have to manage batteries though :crossed_fingers:

Switches work in parallel. Looks like I'm all good with this now