Skip to content

Commit a7d6d1a

Browse files
committed
Update to support MyQ API V5 (#70)
1 parent c62c695 commit a7d6d1a

File tree

5 files changed

+172
-159
lines changed

5 files changed

+172
-159
lines changed

devicetypes/brbeaird/myq-garage-door-opener-nosensor.src/myq-garage-door-opener-nosensor.groovy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ metadata {
5555

5656
def open() {
5757
openPrep()
58-
parent.sendCommand(this, "desireddoorstate", 1)
58+
parent.sendCommand(getMyQDeviceId(), "open")
5959
}
6060
def close() {
6161
closePrep()
62-
parent.sendCommand(this, "desireddoorstate", 0)
62+
parent.sendCommand(getMyQDeviceId(), "close")
6363
}
6464

6565
def openPrep(){
@@ -102,5 +102,5 @@ def log(msg){
102102
}
103103

104104
def showVersion(){
105-
return "3.0.0"
105+
return "3.1.0"
106106
}

devicetypes/brbeaird/myq-garage-door-opener.src/myq-garage-door-opener.groovy

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,14 @@ def open() {
119119
log.debug "Garage door open command called."
120120
parent.notify("Garage door open command called.")
121121
updateDeviceStatus("opening")
122-
parent.sendCommand(this, "desireddoorstate", 1)
122+
parent.sendCommand(getMyQDeviceId(), "open")
123123

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

239239
def showVersion(){
240-
return "3.0.0"
241-
}
240+
return "3.1.0"
241+
}

devicetypes/brbeaird/myq-light-controller.src/myq-light-controller.groovy

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,22 @@ metadata {
4141

4242
def on() {
4343
log.debug "Light turned on"
44-
parent.sendCommand(this, "desiredlightstate", 1)
45-
updateDeviceStatus(1)
44+
parent.sendCommand(getMyQDeviceId(), "on")
45+
updateDeviceStatus("on")
4646

4747
}
4848
def off() {
4949
log.debug "Light turned off"
50-
parent.sendCommand(this, "desiredlightstate", 0)
51-
updateDeviceStatus(0)
50+
parent.sendCommand(getMyQDeviceId(), "off")
51+
updateDeviceStatus("off")
5252
}
5353

5454
def updateDeviceStatus(status) {
55-
if (status.toInteger() == 0)
56-
{
55+
if (status == "off"){
5756
log.debug "Updating status to off"
5857
sendEvent(name: "switch", value: "off", display: true, displayed: true, isStateChange: true, descriptionText: device.displayName + " was off")
5958
}
60-
else if (status.toInteger() == 1) {
59+
else if (status == "on"){
6160
log.debug "Updating status to on"
6261
sendEvent(name: "switch", value: "on", displayed: true, display: true, isStateChange: true, descriptionText: device.displayName + " was on")
6362
}
@@ -82,5 +81,5 @@ def updateMyQDeviceId(Id) {
8281
}
8382

8483
def showVersion(){
85-
return "3.0.0"
84+
return "3.1.0"
8685
}

installerManifest.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"iconUrl": "https://raw.githubusercontent.com/brbeaird/SmartThings_MyQ/master/icons/myq.png",
2020
"published": true,
2121
"oAuth": true,
22-
"version": "3.0.1",
22+
"version": "3.1.0",
2323
"appSettings": {},
2424
"appUrl": "smartapps/brbeaird/myq-lite.src/myq-lite.groovy"
2525
},
@@ -32,7 +32,7 @@
3232
"oAuth": false,
3333
"appUrl": "devicetypes/brbeaird/myq-garage-door-opener.src/myq-garage-door-opener.groovy",
3434
"appSettings": {},
35-
"version": "3.0.0",
35+
"version": "3.1.0",
3636
"optional": false
3737
},
3838
{
@@ -42,7 +42,7 @@
4242
"oAuth": false,
4343
"appUrl": "devicetypes/brbeaird/myq-garage-door-opener-nosensor.src/myq-garage-door-opener-nosensor.groovy",
4444
"appSettings": {},
45-
"version": "3.0.0",
45+
"version": "3.1.0",
4646
"optional": false
4747
},
4848
{
@@ -62,7 +62,7 @@
6262
"oAuth": false,
6363
"appUrl": "devicetypes/brbeaird/myq-light-controller.src/myq-light-controller.groovy",
6464
"appSettings": {},
65-
"version": "3.0.0",
65+
"version": "3.1.0",
6666
"optional": true
6767
},
6868
{

0 commit comments

Comments
 (0)