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

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.

definition(
    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() {
	log.info "Installed with settings: ${settings}"
	initialize()
}

def updated() {
	log.info "Updated with settings: ${settings}"
	unsubscribe()
	initialize()
}

def initialize() {
    log "Real door status: ${garageDoor.displayName} " + garageDoorStatus()
    subscribe(garageDoor, "door.open", doorOpenHandler)
    subscribe(garageDoor, "door.closed", doorClosedHandler)
    subscribe(virtualSwitch, "switch.on", switchOnHandler)
    subscribe(virtualSwitch, "switch.off", 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"
		virtualSwitch.on()
	} 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"
		virtualSwitch.off()
	} 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"
		garageDoor.open()
	} 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"
		garageDoor.close()
	} 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
    image
  3. Create a rule for open
    image
  4. Create a rule for close
    image

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

I only skimmed this topic, but is there a reason why you're not using the Zooz Garage Door Opener app that Zooz had written specifically for the ZEN16?

It has a built-in feature that ignores duplicate commands so if you have Alexa turn off a virtual switch and a rule execute the close command of both doors, that command should be ignored for the doors that are already closed.

2 Likes

I have the app installed maybe I don't understand how to use it.

Did I completely miss (using the zooz app and driver) in your original post or did you just add that?

Either way, I probably shouldn't have replied at 4am so after re-reading your post I now see that the issue is basically that you can't sync the virtual switch back to the device without re-triggering the door...

The easiest and most reliable solution is to add the switch capability to the Zooz Garage Door driver so that Alexa sees the garage door as a switch instead of having to use a separate virtual switch.

These are the 3 changes you'll need to make, but I don't see any downsides to them so I might make them to the original code at some point...

Driver: Zooz Garage Door

Add below line 42:

capability "Switch"

Add below line 87:

void on() { open() }
void off() { close() }

App: Zooz Garage Door Opener App

Add below line 399:

doorOpener?.parse([name: "switch", value: (value == "open" ? "on" : "off"), displayed: false])

I will give that a shot. Does having two garage doors complicate this at all

It shouldn't.

Alexa will see both as switches so you should be able to get the on(open)/off(closed) status of each and turn them on/off independently, but also group them and control them together.

If the doors aren't in the same state and you control them together, only the one that's not already in the new state will execute the command.

I didn't test those changes so feel free to PM me if you run into any issues...

well my wife just chopped her finger off. and im waiting to hear from teh ER. so im watching the baby. will report back as soon as i can try it.

So the change that @krlaframboise suggested seems to have solved what I need. I can now have routines with Alexa that don't require a passcode. And the switch is in sync with the garage door. Thank you @katsrevenge for all the help. Anyway to get the switch to show up on Google home?