[WITHDRAWN] MyQ LiftMaster/Chamberlain

I may have answered some of my question. I noticed by looking at the code this subscribes to a mode event which occurs whenever the mode changes. Looking at the logs I can see the mode changes and send the command to shut the door. Unfortunately this happens before the mode change triggers a refresh of the door :frowning:

7:33:23 PM: debug getChildDevices(true), children=1
7:33:23 PM: info Refreshing data…
7:33:22 PM: info Last refresh was 0.181 minutes ago
7:33:22 PM: info Event Home triggered refresh
7:33:22 PM: trace prefix(): Good Night.
7:33:22 PM: trace settings: [disabledAutomationApps:[Someone Arrives, Everyone Leaves, Things Start Happening], salutation:Good Night., garageDoors:[MyQ: Garage Door Opener], garageAction:Close, disabledModes:[Away], newMode:Night]
7:33:22 PM: debug HH execute(), newMode: Night

There is no lock feature in myq so am wondering how that would work

The repo needs to be setup to support github. copyninja is not as active as he used to be, but luckily this device rarely needs updating.

Hopefully we will be getting official integration soon (most likely promoting this up to official status)

Where did you find it. I can’t

Here is the Pull Request: https://github.com/copy-ninja/SmartThings_MyQ/pull/16

Thanks @wingrunr21. I’ve committed the pull request. Everyone should be able to use the GitHub Integration now. Also updated the instructions in the first post.

3 Likes

Jason will you look at the following. It appears to fix the issue closing the door using Amazon Echo, but I will appreciate you input on if you think it will break anything else.

/**

  • MyQ Garage Door Opener
  • Copyright 2015 Jason Mok
  • Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at:
  •  http://www.apache.org/licenses/LICENSE-2.0
    
  • Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
  • on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
  • for the specific language governing permissions and limitations under the License.
  • Last Updated : 4/4/2016
  • 20160404 - Modified by Gene Ussery - Perform refresh before running on or off functions. Added logic to push to only run open if the garage is closed
  •  								  and run closed if the garage is open or stopped.
    

*/
metadata {
definition (name: “MyQ Garage Door Opener”, namespace: “copy-ninja”, author: “Jason Mok”) {
capability "Garage Door Control"
capability "Door Control"
capability "Contact Sensor"
capability "Refresh"
capability “Polling”

	capability "Actuator"
	capability "Switch"
	capability "Momentary"
	capability "Sensor"
	
	attribute "lastActivity", "string"
	command "updateDeviceStatus", ["string"]
	command "updateDeviceLastActivity", ["number"]
}

simulator {	}

tiles {
	standardTile("door", "device.door", width: 2, height: 2) {
		state("unknown", label:'${name}', action:"door control.close",  icon:"st.doors.garage.garage-open",    backgroundColor:"#ffa81e", nextState: "closing")
		state("closed",  label:'${name}', action:"door control.open",   icon:"st.doors.garage.garage-closed",  backgroundColor:"#79b821", nextState: "opening")
		state("open",    label:'${name}', action:"door control.close",  icon:"st.doors.garage.garage-open",    backgroundColor:"#ffa81e", nextState: "closing")
		state("opening", label:'${name}', icon:"st.doors.garage.garage-opening", backgroundColor:"#ffe71e", nextState: "open")
		state("closing", label:'${name}', icon:"st.doors.garage.garage-closing", backgroundColor:"#ffe71e", nextState: "closed")
		state("stopped", label:'stopped', action:"door control.close",  icon:"st.doors.garage.garage-opening", backgroundColor:"#1ee3ff", nextState: "closing")
	}
	standardTile("refresh", "device.door", inactiveLabel: false, decoration: "flat") {
		state("default", label:'', action:"refresh.refresh", icon:"st.secondary.refresh")
	}
	standardTile("contact", "device.contact") {
		state("open", label:'${name}', icon:"st.contact.contact.open", backgroundColor:"#ffa81e")
		state("closed", label:'${name}', icon:"st.contact.contact.closed", backgroundColor:"#79b821")
	}
	standardTile("button", "device.switch") {
		state("on", label:'${name}', icon:"st.contact.contact.open", backgroundColor:"#ffa81e")
		state("off", label:'${name}', icon:"st.contact.contact.closed", backgroundColor:"#79b821")
	}
	valueTile("lastActivity", "device.lastActivity", inactiveLabel: false, decoration: "flat") {
		state "default", label:'Last activity: ${currentValue}', action:"refresh.refresh", backgroundColor:"#ffffff"
	}

	main "door"
	details(["door", "lastActivity", "refresh"])
}

}
def parse(String description) {}

def on() {
log.debug(“Running On”)
refresh()
push(“open”)
sendEvent(name: “button”, value: “on”, isStateChange: true, display: false, displayed: false)
}
def off() {
log.debug(“Running Off”)
refresh()
push(“closed”)
sendEvent(name: “button”, value: “off”, isStateChange: true, display: false, displayed: false)
}

def push(String desiredstate) {
log.debug(“Running Push”)
def doorState = device.currentState(“door”)?.value
if ((doorState == “open” || doorState == “stopped”) && desiredstate == “closed”) {
close()
} else if (doorState == “closed” && desiredstate == “open”) {
open()
}
sendEvent(name: “momentary”, value: “pushed”, display: false, displayed: false)
}

def open() {
log.debug(“Running Open”)
parent.sendCommand(this, “desireddoorstate”, 1)
updateDeviceStatus(4)
updateDeviceLastActivity(parent.getDeviceLastActivity(this))
}
def close() {
log.debug(“Running Close”)
parent.sendCommand(this, “desireddoorstate”, 0)
updateDeviceStatus(5)
updateDeviceLastActivity(parent.getDeviceLastActivity(this))
}

def refresh() {
log.debug(“Running Refresh”)
parent.refresh()
updateDeviceLastActivity(parent.getDeviceLastActivity(this))
}

def poll() { refresh() }

// update status
def updateDeviceStatus(status) {
log.debug(“Running UpdateStatus”)
def currentState = device.currentState(“door”)?.value
if (status == “1” || status == “9”) {
sendEvent(name: “door”, value: “open”, display: true, descriptionText: device.displayName + " is open")
sendEvent(name: “contact”, value: “open”, display: false, displayed: false)
}
if (status == “2”) {
sendEvent(name: “door”, value: “closed”, display: true, descriptionText: device.displayName + " is closed")
sendEvent(name: “contact”, value: “closed”, display: false, displayed: false)
}
if (status == “3”) {
sendEvent(name: “door”, value: “stopped”, display: true, descriptionText: device.displayName + " has stopped")
sendEvent(name: “contact”, value: “closed”, display: false, displayed: false)
}
if (status == “4” || (status==“8” && currentState==“closed”)) {
sendEvent(name: “door”, value: “opening”, display: false, displayed: false)
}
if (status == “5” || (status==“8” && currentState==“open”)) {
sendEvent(name: “door”, value: “closing”, display: false, displayed: false)
}
}

def updateDeviceLastActivity(long lastActivity) {
log.debug(“Running UpdateLastActivity”)
def lastActivityValue = ""
def diffTotal = now() - lastActivity
def diffDays = (diffTotal / 86400000) as long
def diffHours = (diffTotal % 86400000 / 3600000) as long
def diffMins = (diffTotal % 86400000 % 3600000 / 60000) as long

if      (diffDays == 1)  lastActivityValue += "${diffDays} Day "
else if (diffDays > 1)   lastActivityValue += "${diffDays} Days "

if      (diffHours == 1) lastActivityValue += "${diffHours} Hour "
else if (diffHours > 1)  lastActivityValue += "${diffHours} Hours "

if      (diffMins == 1 || diffMins == 0 )  lastActivityValue += "${diffMins} Min"
else if (diffMins > 1)   lastActivityValue += "${diffMins} Mins"    

sendEvent(name: "lastActivity", value: lastActivityValue, display: false , displayed: false)

}

can you do a pull request in GitHub so I can compare the codes?

Sorry for the delay. I didn’t have any of the github tools since I haven’t used it before. I apologize in advance if I didn’t do it right. Just let me know. Thanks

I am getting the following error in the livelog when trying to control my garage doors. This was working up until approximately 1 week ago. Any ideas?

1:25:52 PM: error groovyx.net.http.HttpResponseException: Internal Server Error @ line 278

deleted post

Day One SmartThings owner - I have the MyQ built in controllers with a double and single door garage door setup. I was able to get the manual files loaded and both doors configured in ST and with ECHO -

First both doors will open and close if selected if native chamberlain app is used or if selected in ST. I am able to get Echo to open both doors without issue but it will not closer either door. Echo does acknowledge command and response “OK” but no actions take place.

I am at a loss,

When using this SmartApp, would I be able to control 4 liftmaster garage openers with MyQ at once while using one gateway(at one location)? According to Liftmaster Support, I should be able to control all 4 garages using their app, if this helps you answer the question.
Thank you!

Yes, I have 3 they show up as separate devices i can control. Similar to how they show up in the myq app

1 Like

Thank you for the reply! I just wasn’t sure if the SmartApp was limited. I will try it tomorrow!

@FunkyTown if you use this version of the code it should fix the issue with it closing with Echo. Let me know if it works for multiple doors. I want to do the same thing, but haven’t ordered another tilt sensor yet.

It is a fork from @copyninja. I am hopeful he will incorporate the changes into his code when he has time.

Thanks.

Thanks to Jason and Gene for their efforts. And Gene, with you’re updated code I can now close both of my garage doors with Echo and no longer have to force a manual refresh of the door’s status which seems to be the key.

Great work guys.

I have installed and uninstalled the Device Handlers and Smart App in the IDE (both from code and from GitHub). I’ve published everything multiple times. Yet, when I go to the app and go to Marketplace -> SmartApps -> + My Apps, it doesn’t appear. I can see Rule Machine there, but no MyQ SmartApp. Ideas?

When you’re in IDE and you click on hub does it list one? Not sure why, but I was able to add code to device handler and app and it would never show up in ST. Turns out I had to log in a second time. Not sure why, but that’s the issue that I had.

Hi new to SmartThings since last week and trying to catch up. Just got the MyQ and ST to work together but was wondering if you’re able to control just the lights on the garage door without opening it?

I want to just control just the lights on the Garage door opener to come on when I open the door to the garage (attached open/closed sensor), is this possible?

I have the garage door and the light controller installed in the device handlers but only have the MyConnect App in the SmartApps. Didn’t see any controls for just the lights. Not sure if I have everything setup properly. Using the MyQ Gateway.

Thanks