Help syncing Fake garage switch for alexa and 2 garage doors (zooz and samsung)

Hi there,

i am trying to open my garage doors with a fake switch to alexa so that i dont have to use a passcode. so far i have bungled it and created loops and out of sync doors. so i deleted those rules and came here for help.

i have a virtual switch (both garage doors). this switch alexa and google home will knwo about.

on alexa and google home ill have two routines.

  1. alexa, open garage doors (turns on both garage switch)
  2. alexa, close both garage doors (turns off both garage switch)

the actual garage doors are made of the following components.

  1. zooz zen16 (using the zooz app and driver)
  2. a Samsung tilt switch at both doors

there is

  1. right garage door (zen relay)
  2. right garage tilt (Samsung tilt)
  3. left garage door (zen relay)
  4. left gagage tilt (samsung tilt)

the samsung multipurpose sensors are what actually know if its open or closed.

multiple problems i dont know how to address in the rule. like if the garage gets opened from alexa but then closed via the physical contact button in the garage. alexa will see the light as still on. now i can't open the garage. If i auto turn off the light that closes the garages.

someoen only closes one garage, now when i tell alexa to close both garages one closes while the other opens.

you can see how i cna get into several loops of logic and out of sync doors.

how can i approach this?

I'm at work, so I can't pull things up to really dig in, but here are my initial thoughts. Your switches should be momentary, so that the turn back of after a second. Create your rules separately. One for each door. I, personally, would use a contact sensor on the doors to give another way to know if the door is opened or closed.
I think that someone is going to pipe in with a variable to check the status of the doors, and I'm terrible at them in rule machine, so I'll wait for them to weigh in on this. If it were me, I'd do a separate rule with restrictions for each command, but I know that there are better ways to handle this.

1 Like

Thanks. Hopefully we get a few more replies

@aaiyar and @ogiewon helped me set mine up. Maybe they'll find time to help today?

:point_up: This

@jrobertson50 I use a tilt sensor near the top of the garage door instead of a contact sensor. I used to have a contact sensor but on really windy/stormy days it would trip constantly.

1 Like

Agreed. I actually use a tilt sensor as well.

Also, if you have Ecolink or GoControl contact sensors, they are really easy to convert into a tilt sensor - just attach a tilt switch to the external contacts, like this:

1 Like

Indeed. I had the we issue. I have two tilt sensors one on each garage

At my old house I used a relay and a zwave outlet to trigger. I went with a z-wave Linear Garage Door Controller because of the exact issue you are describing and have had 0 issues since. You can usually find them on sale if you shop around and save you a bunch of headaches.

I ended up going a different route with mine and instead wrote a small app to sync a virtual switch to my (one) garage door. I have that app listen to events so it can sync the state. No promises this will work for you but it's been ok for me for a year or so. Since you aren't using an actual opener you may need to tweak the garage door definition and subscriptions but shouldn't be too hard to update to work for you.

    name: "Garage Door Binding",
    namespace: "rvrolyk",
    author: "Russ Vrolyk",
    description: "Links a physical garage door device to an app controlled virtual switch.",
    category: "Convenience",
	iconUrl: "",
    iconX2Url: "",
    iconX3Url: "")

def garageDoor = [
    name: "garageDoor",
    type: "capability.garageDoorControl",
    title: "Garage Door",
    description: "Select the garage door to bind.",
    required: true,
    multiple: false

def virtualSwitch = [
    name: "virtualSwitch",
    type: "capability.switch",
    title: "Virtual Switch",
    description: "Select the virtual switch that binds to the door.",
    required: true,
    multiple: false

def enableLogging = [
    name:			"enableLogging",
    type:				"bool",
    title:				"Enable debug Logging?",
    defaultValue:		false,
    required:			true

preferences {
	page(name: "mainPage", title: "<b>Garage Door to Bind:</b>", install: true, uninstall: true) {
		section("") {
			input garageDoor
			input virtualSwitch
			label title: "Assign an app name", required: false
		section ("<b>Advanced Settings</b>") {
			input enableLogging

def installed() { "Installed with settings: ${settings}"

def updated() { "Updated with settings: ${settings}"

def initialize() {
    log "Real door status: ${garageDoor.displayName} " + garageDoorStatus()
    subscribe(garageDoor, "", doorOpenHandler)
    subscribe(garageDoor, "door.closed", doorClosedHandler)
    subscribe(virtualSwitch, "switch.on", switchOnHandler)
    subscribe(virtualSwitch, "", switchOffHandler)

def virtualSwitchStatus() {
	return virtualSwitch.currentValue("switch")

def garageDoorStatus() {
	return garageDoor.currentValue("door")

def doorOpenHandler(evt) {
	// The door was opened so turn on the switch if it's not already set
	// the same.
	if (virtualSwitchStatus() != "on") { 
		log "Door open, turning on switch"
	} else {
		log "Door open but switch already on"

def doorClosedHandler(evt) {
	// The door was closed so turn off the switch if it's not
	// already set the same.
	if (virtualSwitchStatus() != "off") {
		log "Door closed, turning off switch"
	} else {
		log "Door closed but switch already off"

def switchOnHandler(evt) {
	// The switch was turned on so open door if it's not already
	// opening or open.
	if (garageDoorStatus() != "opening"
		&& garageDoorStatus() != "open") {
		log "Switch turned on, opening door"
	} else {
		log "Switch turned on but door already open"

def switchOffHandler(evt) {
	// The switch was turned off so close door if it's not already
	// closing or closed.
	if (garageDoorStatus() != "closing"
		&& garageDoorStatus() != "closed") {
		log "Switch turned off, closing door"
	} else {
		log "Switch turned off but door already closed"

def log(msg) {
    if (enableLogging) {
        log.debug msg
1 Like

I have a garage door that i'm controlling a smart plug to trigger a relay to control my door, and i'm using it as a toggle. you can definitely try my setup to see if it works for you.

  1. Create a virtual switch for each door.
  2. Create a rule to link that virtual switch to the tilt sensor
  3. Create a rule for open
  4. Create a rule for close

The way they all work together is if I use my existing remote/panel to open/close the garage door, it'll change the status of the Alexa switch (step 2). Since the tilt sensor triggered first, it won't run the rules in step 3 or step 4. If I instead toggle the Alexa switch (by voice or any other means), it'll trigger only if the tilt sensor is in the opposite state (if i turn the switch on and door is closed OR if i turn the switch off and door is open).

These rules have been working great for me and have been very reliable. I think when I first set it up I had one or two hiccups, but after adjusting the tilt sensor enough, I didn't have any further issues.

To make it more "human" when speaking to Alexa, I created a routing "Alexa, open garage" or "Alexa, close garage" which will just turn the virtual switch on/off depending on the command. If I tell it to close, if the door is already closed then nothing happens due to the state check in the rules.

1 Like

This looks good. How would you handle the Alexa switch with two garages. My hang up is having two doors

I have a single door, but the trio of rules work together to manage the one door. If you want to manage two doors, create a second virtual switch and the three rules again for the second door. In alexa you could create 6 voice commands then. Two to open/close left door, two for right door, and two for both.

The individual doors are straight forward, and the command for both would just trigger both virtual switches

While physically the doors are close and both enter the same location, they are separate controlled devices. Look at them as such and it might help you to visualize it easier

This is starting to seem like more effort than it may be worth. I'll tinker with your rules a bit. See what I can get

i can understand the frustration with it, it took me a few days to wrap my head around and plan out the rules to work how i wanted it to.

if you literally copy my setup for each door (3 rules for left door and 3 rules for right door), then you should be good

Someone posted a genius idea here early whey they used a contact sensor and the magnet on a door hinge that would swing away when the garage up and swing back down when closed.. no wires or switches needed!

while that can help with the status of the door, it doesn't allow you to control the door through your smart network

that is an interesting setup though

I was replying to @aaiyar comment about making a orientation switch. But yes, you would need something to activate the motor. Personally I would go with a Zooz relay.

That's what I have