mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-21 21:03:47 +00:00
Compare commits
9 Commits
MSA-1594-1
...
PROD_2016.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
20239ca982 | ||
|
|
b20c0e371f | ||
|
|
ee2e1ee04f | ||
|
|
e443cb641c | ||
|
|
b9993a9bf2 | ||
|
|
a8ee927893 | ||
|
|
51979f0030 | ||
|
|
1dfd1818b4 | ||
|
|
e5c21ef720 |
@@ -120,6 +120,15 @@ def configure() {
|
|||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def installed() {
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
def updated() {
|
def updated() {
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
|
def initialize() {
|
||||||
sendEvent(name: "numberOfButtons", value: 4)
|
sendEvent(name: "numberOfButtons", value: 4)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,6 +109,15 @@ def configure() {
|
|||||||
return cmds
|
return cmds
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def installed() {
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
def updated() {
|
def updated() {
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
|
def initialize() {
|
||||||
sendEvent(name: "numberOfButtons", value: 4)
|
sendEvent(name: "numberOfButtons", value: 4)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -183,6 +183,15 @@ def updateState(String name, String value) {
|
|||||||
device.updateDataValue(name, value)
|
device.updateDataValue(name, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def installed() {
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
def updated() {
|
def updated() {
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
|
def initialize() {
|
||||||
sendEvent(name: "numberOfButtons", value: 3)
|
sendEvent(name: "numberOfButtons", value: 3)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ def parse(String description) {
|
|||||||
|
|
||||||
private Map parseBasicMessage(description) {
|
private Map parseBasicMessage(description) {
|
||||||
def name = parseName(description)
|
def name = parseName(description)
|
||||||
|
def results = [:]
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
def value = parseValue(description)
|
def value = parseValue(description)
|
||||||
def linkText = getLinkText(device)
|
def linkText = getLinkText(device)
|
||||||
@@ -64,7 +65,7 @@ private Map parseBasicMessage(description) {
|
|||||||
def handlerName = value
|
def handlerName = value
|
||||||
def isStateChange = isStateChange(device, name, value)
|
def isStateChange = isStateChange(device, name, value)
|
||||||
|
|
||||||
def results = [
|
results = [
|
||||||
name : name,
|
name : name,
|
||||||
value : value,
|
value : value,
|
||||||
linkText : linkText,
|
linkText : linkText,
|
||||||
@@ -73,8 +74,6 @@ private Map parseBasicMessage(description) {
|
|||||||
isStateChange : isStateChange,
|
isStateChange : isStateChange,
|
||||||
displayed : displayed(description, isStateChange)
|
displayed : displayed(description, isStateChange)
|
||||||
]
|
]
|
||||||
} else {
|
|
||||||
results = [:]
|
|
||||||
}
|
}
|
||||||
log.debug "Parse returned $results.descriptionText"
|
log.debug "Parse returned $results.descriptionText"
|
||||||
return results
|
return results
|
||||||
|
|||||||
@@ -126,6 +126,15 @@ private hold(button) {
|
|||||||
sendEvent(name: "button", value: "held", data: [buttonNumber: button], descriptionText: "$device.displayName button $button was held", isStateChange: true)
|
sendEvent(name: "button", value: "held", data: [buttonNumber: button], descriptionText: "$device.displayName button $button was held", isStateChange: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def installed() {
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
def updated() {
|
def updated() {
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
|
def initialize() {
|
||||||
sendEvent(name: "numberOfButtons", value: 4)
|
sendEvent(name: "numberOfButtons", value: 4)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,91 +0,0 @@
|
|||||||
/**
|
|
||||||
* Switch Sync
|
|
||||||
*
|
|
||||||
* Copyright 2016 Kelly Kristek
|
|
||||||
*
|
|
||||||
* 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: "Switch Sync",
|
|
||||||
namespace: "Electricview",
|
|
||||||
author: "Kelly Kristek",
|
|
||||||
description: "This is an app that attempts to keep your virtual 3 way switches in sync regardless of where they are iniated from.\r\n",
|
|
||||||
category: "Convenience",
|
|
||||||
iconUrl: "http://i230.photobucket.com/albums/ee70/pickyassgamer/switchsyncsmall.png",
|
|
||||||
iconX2Url: "http://i230.photobucket.com/albums/ee70/pickyassgamer/switchsyncmedium.png",
|
|
||||||
iconX3Url: "http://i230.photobucket.com/albums/ee70/pickyassgamer/switchsync.png")
|
|
||||||
|
|
||||||
|
|
||||||
preferences {
|
|
||||||
section("Select Mains Switch") {
|
|
||||||
input "firstswitch", "capability.switch", required: true
|
|
||||||
}
|
|
||||||
section("Select AUX switch") {
|
|
||||||
input "secondswitch", "capability.switch", required: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def installed() {
|
|
||||||
log.debug "Installed with settings: ${settings}"
|
|
||||||
|
|
||||||
initialize()
|
|
||||||
}
|
|
||||||
|
|
||||||
def updated() {
|
|
||||||
log.debug "Updated with settings: ${settings}"
|
|
||||||
|
|
||||||
unsubscribe()
|
|
||||||
initialize()
|
|
||||||
}
|
|
||||||
|
|
||||||
def initialize() {
|
|
||||||
subscribe(firstswitch, "switch.on", firstswitchon)
|
|
||||||
subscribe(firstswitch, "switch.off", firstswitchoff)
|
|
||||||
subscribe(secondswitch,"switch.on", secondswitchon)
|
|
||||||
subscribe(secondswitch,"switch.off", secondswitchoff)
|
|
||||||
}
|
|
||||||
def firstswitchon(evt){
|
|
||||||
log.debug "FirstSwitchOn called: $evt"
|
|
||||||
|
|
||||||
// Adding an if statement to verify the switch isn't already in the position we desire, to avoid endless loops
|
|
||||||
if( "off" == secondswitch.currentSwitch) {
|
|
||||||
secondswitch.on()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def firstswitchoff(evt){
|
|
||||||
log.debug "FirstSwitchOff called: $evt"
|
|
||||||
|
|
||||||
// Adding an if statement to verify the switch isn't already in the position we desire, to avoid endless loops
|
|
||||||
if ( "on" == secondswitch.currentSwitch){
|
|
||||||
secondswitch.off()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def secondswitchon(evt){
|
|
||||||
log.debug "SecondSwitchOn called: $evt"
|
|
||||||
|
|
||||||
// Adding an if statement to verify the switch isn't already in the position we desire, to avoid endless loops
|
|
||||||
if ( "off" == firstswitch.currentSwitch){
|
|
||||||
firstswitch.on()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def secondswitchoff(evt){
|
|
||||||
log.debug "SecondSwitchOff called: $evt"
|
|
||||||
|
|
||||||
// Adding an if statement to verify the switch isn't already in the position we desire, to avoid endless loops
|
|
||||||
if ( "on" == firstswitch.currentSwitch){
|
|
||||||
firstswitch.off()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: implement event handlers
|
|
||||||
Reference in New Issue
Block a user