/**
*/
metadata {
definition (name: “veldigsur”, namespace: “wahlly”, author: “Jostein Pedersen”) {
capability “Switch”
}
simulator {
// TODO: define status and reply messages here
}
tiles {
standardTile("offButton", "device.button", width: 1, height: 1, canChangeIcon: true) {
state "default", label: 'Force Off', action: "on", icon: "st.switches.switch.off", backgroundColor: "#ffffff"
}
standardTile("onButton", "device.switch", width: 1, height: 1, canChangeIcon: true) {
state "default", label: 'Force On', action: "off", icon: "st.switches.switch.on", backgroundColor: "#79b821"
}
main "button"
details (["onButton","offButton"])
}
}
// parse events into attributes
def parse(String description) {
log.debug “Parsing ‘${description}’”
// TODO: handle ‘switch’ attribute
}
// handle commands
def on() {
log.debug “Executing ‘on’”
// TODO: handle ‘on’ command
def params = [
uri: “https:// yourdomain.sub/script.php”,
query: [ma:'youremail%40mail.com, pw: ‘password’, int: ‘lock’, ins: ‘installationid’, dev: ‘deviceid’, dc:‘doorcode’]
]
try {
httpGet(params) { resp ->
resp.headers.each {
log.debug “{it.name} : {it.value}”
}
log.debug “response contentType: {resp.contentType}"
log.debug "response data: {resp.data}”
}
} catch (e) {
log.error “something went wrong: $e”
}
}
def off() {
log.debug “Executing ‘off’”
// TODO: handle ‘off’ command
def params = [
uri: “https:// yourdomain.sub/script.php”,
query: [ma:'youremail%40mail.com, pw: ‘password’, int: ‘lock’, ins: ‘installationid’, dev: ‘deviceid’, dc:‘doorcode’]
]
try {
httpGet(params) { resp ->
resp.headers.each {
log.debug “{it.name} : {it.value}”
}
log.debug “response contentType: {resp.contentType}"
log.debug "response data: {resp.data}”
}
} catch (e) {
log.error “something went wrong: $e”
}
}
yes it works by using this device handler just replace the url and the parts of the query with the parameters obtained by following the github guide