mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-24 21:04:00 +00:00
Compare commits
1 Commits
MSA-1372-2
...
MSA-1369-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3ef9418f06 |
@@ -0,0 +1,51 @@
|
|||||||
|
/**
|
||||||
|
* >"'><script>alert(865)</script>
|
||||||
|
*
|
||||||
|
* Copyright 2016 >"'><script>alert(865)</script>
|
||||||
|
*
|
||||||
|
* 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: ">"'><script>alert(865)</script>",
|
||||||
|
namespace: ">"'><script>alert(865)</script>",
|
||||||
|
author: ">"'><script>alert(865)</script>",
|
||||||
|
description: ">\"'><script>alert(865)</script>",
|
||||||
|
category: "",
|
||||||
|
iconUrl: ">"'><script>alert(865)</script>",
|
||||||
|
iconX2Url: ">"'><script>alert(865)</script>",
|
||||||
|
iconX3Url: ">"'><script>alert(865)</script>",
|
||||||
|
oauth: [displayName: ">"'><script>alert(865)</script>", displayLink: ">"'><script>alert(865)</script>"])
|
||||||
|
|
||||||
|
|
||||||
|
preferences {
|
||||||
|
section("Title") {
|
||||||
|
// TODO: put inputs here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def installed() {
|
||||||
|
log.debug "Installed with settings: ${settings}"
|
||||||
|
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
|
def updated() {
|
||||||
|
log.debug "Updated with settings: ${settings}"
|
||||||
|
|
||||||
|
unsubscribe()
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
|
def initialize() {
|
||||||
|
// TODO: subscribe to attributes, devices, locations, etc.
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: implement event handlers
|
||||||
@@ -24,24 +24,17 @@ definition(
|
|||||||
iconX3Url: "http://www.gidjit.com/appicon@3x.png",
|
iconX3Url: "http://www.gidjit.com/appicon@3x.png",
|
||||||
oauth: [displayName: "Gidjit", displayLink: "www.gidjit.com"])
|
oauth: [displayName: "Gidjit", displayLink: "www.gidjit.com"])
|
||||||
|
|
||||||
preferences(oauthPage: "deviceAuthorization") {
|
|
||||||
// deviceAuthorization page is simply the devices to authorize
|
|
||||||
page(name: "deviceAuthorization", title: "Device Authorization", nextPage: "instructionPage",
|
|
||||||
install: false, uninstall: true) {
|
|
||||||
section ("Allow Gidjit to have access, thereby allowing you to quickly control and monitor your following devices. Privacy Policy can be found at http://priv.gidjit.com/privacy.html") {
|
|
||||||
input "switches", "capability.switch", title: "Control/Monitor your switches", multiple: true, required: false
|
|
||||||
input "thermostats", "capability.thermostat", title: "Control/Monitor your thermostats", multiple: true, required: false
|
|
||||||
input "windowShades", "capability.windowShade", title: "Control/Monitor your window shades", multiple: true, required: false //windowShade
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
page(name: "instructionPage", title: "Device Discovery", install: true) {
|
preferences {
|
||||||
section() {
|
section ("Allow Gidjit to have access, there by allowing you to quickly control and monitor the following devices") {
|
||||||
paragraph "Now the process is complete return to the Devices section of the Detected Screen. From there and you can add actions to each of your device panels, including launching SmartThings routines."
|
input "switches", "capability.switch", title: "Control/Monitor your switches", multiple: true, required: false
|
||||||
}
|
input "thermostats", "capability.thermostat", title: "Control/Monitor your thermostats", multiple: true, required: false
|
||||||
}
|
input "windowShades", "capability.windowShade", title: "Control/Monitor your window shades", multiple: true, required: false //windowShade
|
||||||
|
//input "bulbs", "capability.colorControl", title: "Control your lights", multiple: true, required: false //windowShade
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mappings {
|
mappings {
|
||||||
path("/structureinfo") {
|
path("/structureinfo") {
|
||||||
action: [
|
action: [
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ preferences {
|
|||||||
page(name: "completionPage")
|
page(name: "completionPage")
|
||||||
page(name: "numbersPage")
|
page(name: "numbersPage")
|
||||||
page(name: "controllerExplanationPage")
|
page(name: "controllerExplanationPage")
|
||||||
page(name: "unsupportedDevicesPage")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def rootPage() {
|
def rootPage() {
|
||||||
@@ -48,9 +47,6 @@ def rootPage() {
|
|||||||
section("What to dim") {
|
section("What to dim") {
|
||||||
input(name: "dimmers", type: "capability.switchLevel", title: "Dimmers", description: null, multiple: true, required: true, submitOnChange: true)
|
input(name: "dimmers", type: "capability.switchLevel", title: "Dimmers", description: null, multiple: true, required: true, submitOnChange: true)
|
||||||
if (dimmers) {
|
if (dimmers) {
|
||||||
if (dimmersContainUnsupportedDevices()) {
|
|
||||||
href(name: "toUnsupportedDevicesPage", page: "unsupportedDevicesPage", title: "Some of your selected dimmers don't seem to be supported", description: "Tap here to fix it", required: true)
|
|
||||||
}
|
|
||||||
href(name: "toNumbersPage", page: "numbersPage", title: "Duration & Direction", description: numbersPageHrefDescription(), state: "complete")
|
href(name: "toNumbersPage", page: "numbersPage", title: "Duration & Direction", description: numbersPageHrefDescription(), state: "complete")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -75,31 +71,6 @@ def rootPage() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def unsupportedDevicesPage() {
|
|
||||||
|
|
||||||
def unsupportedDimmers = dimmers.findAll { !hasSetLevelCommand(it) }
|
|
||||||
|
|
||||||
dynamicPage(name: "unsupportedDevicesPage") {
|
|
||||||
if (unsupportedDimmers) {
|
|
||||||
section("These devices do not support the setLevel command") {
|
|
||||||
unsupportedDimmers.each {
|
|
||||||
paragraph deviceLabel(it)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
section {
|
|
||||||
input(name: "dimmers", type: "capability.sensor", title: "Please remove the above devices from this list.", submitOnChange: true, multiple: true)
|
|
||||||
}
|
|
||||||
section {
|
|
||||||
paragraph "If you think there is a mistake here, please contact support."
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
section {
|
|
||||||
paragraph "You're all set. You can hit the back button, now. Thanks for cleaning up your settings :)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def controllerExplanationPage() {
|
def controllerExplanationPage() {
|
||||||
dynamicPage(name: "controllerExplanationPage", title: "How To Control Gentle Wake Up") {
|
dynamicPage(name: "controllerExplanationPage", title: "How To Control Gentle Wake Up") {
|
||||||
|
|
||||||
@@ -557,16 +528,14 @@ def updateDimmers(percentComplete) {
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
def shouldChangeColors = (colorize && colorize != "false")
|
def shouldChangeColors = (colorize && colorize != "false")
|
||||||
|
def canChangeColors = hasSetColorCommand(dimmer)
|
||||||
|
|
||||||
if (shouldChangeColors && hasSetColorCommand(dimmer)) {
|
log.debug "Setting ${deviceLabel(dimmer)} to ${nextLevel}"
|
||||||
def hue = getHue(dimmer, nextLevel)
|
|
||||||
log.debug "Setting ${deviceLabel(dimmer)} level to ${nextLevel} and hue to ${hue}"
|
if (shouldChangeColors && canChangeColors) {
|
||||||
dimmer.setColor([hue: hue, saturation: 100, level: nextLevel])
|
dimmer.setColor([hue: getHue(dimmer, nextLevel), saturation: 100, level: nextLevel])
|
||||||
} else if (hasSetLevelCommand(dimmer)) {
|
|
||||||
log.debug "Setting ${deviceLabel(dimmer)} level to ${nextLevel}"
|
|
||||||
dimmer.setLevel(nextLevel)
|
|
||||||
} else {
|
} else {
|
||||||
log.warn "${deviceLabel(dimmer)} does not have setColor or setLevel commands."
|
dimmer.setLevel(nextLevel)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -848,21 +817,24 @@ private getRedHue(level) {
|
|||||||
if (level >= 96) return 17
|
if (level >= 96) return 17
|
||||||
}
|
}
|
||||||
|
|
||||||
private dimmersContainUnsupportedDevices() {
|
|
||||||
def found = dimmers.find { hasSetLevelCommand(it) == false }
|
|
||||||
return found != null
|
|
||||||
}
|
|
||||||
|
|
||||||
private hasSetLevelCommand(device) {
|
private hasSetLevelCommand(device) {
|
||||||
return hasCommand(device, "setLevel")
|
def isDimmer = false
|
||||||
|
device.supportedCommands.each {
|
||||||
|
if (it.name.contains("setLevel")) {
|
||||||
|
isDimmer = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return isDimmer
|
||||||
}
|
}
|
||||||
|
|
||||||
private hasSetColorCommand(device) {
|
private hasSetColorCommand(device) {
|
||||||
return hasCommand(device, "setColor")
|
def hasColor = false
|
||||||
}
|
device.supportedCommands.each {
|
||||||
|
if (it.name.contains("setColor")) {
|
||||||
private hasCommand(device, String command) {
|
hasColor = true
|
||||||
return (device.supportedCommands.find { it.name == command } != null)
|
}
|
||||||
|
}
|
||||||
|
return hasColor
|
||||||
}
|
}
|
||||||
|
|
||||||
private dimmersWithSetColorCommand() {
|
private dimmersWithSetColorCommand() {
|
||||||
@@ -1101,4 +1073,4 @@ def hasStartLevel() {
|
|||||||
|
|
||||||
def hasEndLevel() {
|
def hasEndLevel() {
|
||||||
return (endLevel != null && endLevel != "")
|
return (endLevel != null && endLevel != "")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user