mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-14 13:11:52 +00:00
Compare commits
1 Commits
MSA-1128-1
...
MSA-1142-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
35eec34291 |
@@ -27,7 +27,6 @@ metadata {
|
||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0702, 0B05", outClusters: "0019", manufacturer: "sengled", model: "Z01-CIA19NAE26", deviceJoinName: "Sengled Element touch"
|
||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0702, 0B05", outClusters: "000A, 0019", manufacturer: "Jasco Products", model: "45852", deviceJoinName: "GE Zigbee Plug-In Dimmer"
|
||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0702, 0B05", outClusters: "000A, 0019", manufacturer: "Jasco Products", model: "45857", deviceJoinName: "GE Zigbee In-Wall Dimmer"
|
||||
fingerprint profileId: "0104", deviceId: "1", inClusters: "1", outClusters: "1", manufacturer: "qbkydyic", model: "kroffjdq", deviceJoinName: "iaqnealg"
|
||||
}
|
||||
|
||||
tiles(scale: 2) {
|
||||
@@ -95,4 +94,4 @@ def refresh() {
|
||||
def configure() {
|
||||
log.debug "Configuring Reporting and Bindings."
|
||||
zigbee.onOffConfig() + zigbee.levelConfig() + zigbee.simpleMeteringPowerConfig() + zigbee.electricMeasurementPowerConfig() + zigbee.onOffRefresh() + zigbee.levelRefresh() + zigbee.simpleMeteringPowerRefresh() + zigbee.electricMeasurementPowerRefresh()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
/**
|
||||
* Routine Activated Notifier
|
||||
*
|
||||
* Copyright 2016 Richard Pope
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
definition(
|
||||
name: "Routine Activated Notifier",
|
||||
namespace: "VaticanUK",
|
||||
author: "Richard Pope",
|
||||
description: "Calls a URL when a routine is executed",
|
||||
category: "Convenience",
|
||||
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
|
||||
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png",
|
||||
iconX3Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png")
|
||||
|
||||
preferences {
|
||||
page(name: "selectActions")
|
||||
}
|
||||
|
||||
def selectActions() {
|
||||
dynamicPage(name: "selectActions", title: "Select Hello Home Action to Monitor", install: true, uninstall: true) {
|
||||
|
||||
// get the available actions
|
||||
def actions = location.helloHome?.getPhrases()*.label
|
||||
if (actions) {
|
||||
// sort them alphabetically
|
||||
actions.sort()
|
||||
section("Hello Home Actions") {
|
||||
log.trace actions
|
||||
// use the actions as the options for an enum input
|
||||
input "action", "enum", title: "Select an action to execute", options: actions, required: true
|
||||
input "url", "text", title: "Enter a URL to call", required: true
|
||||
}
|
||||
section ([mobileOnly:true]) {
|
||||
label title: "Assign a name", required: false
|
||||
mode title: "Set for specific mode(s)", required: false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def installed() {
|
||||
log.debug "Installed with settings: ${settings}"
|
||||
|
||||
initialize()
|
||||
}
|
||||
|
||||
def updated() {
|
||||
log.debug "Updated with settings: ${settings}"
|
||||
|
||||
unsubscribe()
|
||||
initialize()
|
||||
}
|
||||
|
||||
def initialize() {
|
||||
subscribe(location, "routineExecuted", routineChanged)
|
||||
}
|
||||
|
||||
def routineChanged(evt) {
|
||||
log.debug "routineChanged: $evt"
|
||||
|
||||
log.debug "evt name: ${evt.name}"
|
||||
log.debug "evt value: ${evt.value}"
|
||||
log.debug "evt displayName: ${evt.displayName}"
|
||||
|
||||
if (evt.displayName == settings.action) {
|
||||
def params = [ uri: settings.url ]
|
||||
|
||||
try {
|
||||
httpGet(params) { resp ->
|
||||
resp.headers.each {
|
||||
log.debug "${it.name} : ${it.value}"
|
||||
}
|
||||
|
||||
def theHeaders = resp.getHeaders("Content-Length")
|
||||
log.debug "response contentType: ${resp.contentType}"
|
||||
log.debug "response status code: ${resp.status}"
|
||||
log.debug "response data: ${resp.data}"
|
||||
}
|
||||
} catch (e) {
|
||||
log.error "something went wrong: $e"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user