Skip to content

Commit

Permalink
Update to support MyQ API V5 (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
brbeaird committed Oct 19, 2019
1 parent c62c695 commit a7d6d1a
Show file tree
Hide file tree
Showing 5 changed files with 172 additions and 159 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ metadata {

def open() {
openPrep()
parent.sendCommand(this, "desireddoorstate", 1)
parent.sendCommand(getMyQDeviceId(), "open")
}
def close() {
closePrep()
parent.sendCommand(this, "desireddoorstate", 0)
parent.sendCommand(getMyQDeviceId(), "close")
}

def openPrep(){
Expand Down Expand Up @@ -102,5 +102,5 @@ def log(msg){
}

def showVersion(){
return "3.0.0"
return "3.1.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,14 @@ def open() {
log.debug "Garage door open command called."
parent.notify("Garage door open command called.")
updateDeviceStatus("opening")
parent.sendCommand(this, "desireddoorstate", 1)
parent.sendCommand(getMyQDeviceId(), "open")

runIn(20, refresh, [overwrite: true]) //Force a sync with tilt sensor after 20 seconds
}
def close() {
log.debug "Garage door close command called."
parent.notify("Garage door close command called.")
parent.sendCommand(this, "desireddoorstate", 0)
parent.sendCommand(getMyQDeviceId(), "close")
// updateDeviceStatus("closing") // Now handled in the parent (in case we have an Acceleration sensor, we can handle "waiting" state)
runIn(30, refresh, [overwrite: true]) //Force a sync with tilt sensor after 30 seconds
}
Expand Down Expand Up @@ -237,5 +237,5 @@ def log(msg){
}

def showVersion(){
return "3.0.0"
}
return "3.1.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,22 @@ metadata {

def on() {
log.debug "Light turned on"
parent.sendCommand(this, "desiredlightstate", 1)
updateDeviceStatus(1)
parent.sendCommand(getMyQDeviceId(), "on")
updateDeviceStatus("on")

}
def off() {
log.debug "Light turned off"
parent.sendCommand(this, "desiredlightstate", 0)
updateDeviceStatus(0)
parent.sendCommand(getMyQDeviceId(), "off")
updateDeviceStatus("off")
}

def updateDeviceStatus(status) {
if (status.toInteger() == 0)
{
if (status == "off"){
log.debug "Updating status to off"
sendEvent(name: "switch", value: "off", display: true, displayed: true, isStateChange: true, descriptionText: device.displayName + " was off")
}
else if (status.toInteger() == 1) {
else if (status == "on"){
log.debug "Updating status to on"
sendEvent(name: "switch", value: "on", displayed: true, display: true, isStateChange: true, descriptionText: device.displayName + " was on")
}
Expand All @@ -82,5 +81,5 @@ def updateMyQDeviceId(Id) {
}

def showVersion(){
return "3.0.0"
return "3.1.0"
}
8 changes: 4 additions & 4 deletions installerManifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"iconUrl": "https://raw.githubusercontent.com/brbeaird/SmartThings_MyQ/master/icons/myq.png",
"published": true,
"oAuth": true,
"version": "3.0.1",
"version": "3.1.0",
"appSettings": {},
"appUrl": "smartapps/brbeaird/myq-lite.src/myq-lite.groovy"
},
Expand All @@ -32,7 +32,7 @@
"oAuth": false,
"appUrl": "devicetypes/brbeaird/myq-garage-door-opener.src/myq-garage-door-opener.groovy",
"appSettings": {},
"version": "3.0.0",
"version": "3.1.0",
"optional": false
},
{
Expand All @@ -42,7 +42,7 @@
"oAuth": false,
"appUrl": "devicetypes/brbeaird/myq-garage-door-opener-nosensor.src/myq-garage-door-opener-nosensor.groovy",
"appSettings": {},
"version": "3.0.0",
"version": "3.1.0",
"optional": false
},
{
Expand All @@ -62,7 +62,7 @@
"oAuth": false,
"appUrl": "devicetypes/brbeaird/myq-light-controller.src/myq-light-controller.groovy",
"appSettings": {},
"version": "3.0.0",
"version": "3.1.0",
"optional": true
},
{
Expand Down
Loading

0 comments on commit a7d6d1a

Please sign in to comment.