mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-09 13:21:53 +00:00
Compare commits
13 Commits
PROD_2017.
...
MSA-1713-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
024300645e | ||
|
|
5ad20fbd2a | ||
|
|
52357e4c50 | ||
|
|
f969027191 | ||
|
|
5607a3e346 | ||
|
|
c028515fcd | ||
|
|
751c98d123 | ||
|
|
5b874e8f3a | ||
|
|
9e10405527 | ||
|
|
32ceaff54d | ||
|
|
5b1da30a47 | ||
|
|
0a82077b24 | ||
|
|
bbad6dfa7a |
@@ -22,9 +22,10 @@ metadata {
|
||||
capability "Sensor"
|
||||
capability "Health Check"
|
||||
|
||||
fingerprint mfr:"0063", prod:"4457", deviceJoinName: "Z-Wave Wall Dimmer"
|
||||
fingerprint mfr:"0063", prod:"4944", deviceJoinName: "Z-Wave Wall Dimmer"
|
||||
fingerprint mfr:"0063", prod:"5044", deviceJoinName: "Z-Wave Plug-In Dimmer"
|
||||
fingerprint mfr:"0063", prod:"4457", deviceJoinName: "GE In-Wall Smart Dimmer "
|
||||
fingerprint mfr:"0063", prod:"4944", deviceJoinName: "GE In-Wall Smart Dimmer "
|
||||
fingerprint mfr:"0063", prod:"5044", deviceJoinName: "GE Plug-In Smart Dimmer "
|
||||
fingerprint mfr:"0063", prod:"4944", model:"3034", deviceJoinName: "GE In-Wall Smart Fan Control"
|
||||
}
|
||||
|
||||
simulator {
|
||||
|
||||
@@ -86,7 +86,7 @@ def parse(String description) {
|
||||
def bodyString = msg.body
|
||||
if (bodyString) {
|
||||
unschedule("setOffline")
|
||||
def body = new XmlSlurper().parseText(bodyString)
|
||||
def body = new XmlSlurper().parseText(bodyString.replaceAll("[^\\x20-\\x7e]", ""))
|
||||
|
||||
if (body?.property?.TimeSyncRequest?.text()) {
|
||||
log.trace "Got TimeSyncRequest"
|
||||
|
||||
@@ -78,7 +78,7 @@ def parse(String description) {
|
||||
def bodyString = msg.body
|
||||
if (bodyString) {
|
||||
unschedule("setOffline")
|
||||
def body = new XmlSlurper().parseText(bodyString)
|
||||
def body = new XmlSlurper().parseText(bodyString.replaceAll("[^\\x20-\\x7e]", ""))
|
||||
if (body?.property?.TimeSyncRequest?.text()) {
|
||||
log.trace "Got TimeSyncRequest"
|
||||
result << timeSyncResponse()
|
||||
|
||||
@@ -84,7 +84,7 @@ def parse(String description) {
|
||||
def bodyString = msg.body
|
||||
if (bodyString) {
|
||||
unschedule("setOffline")
|
||||
def body = new XmlSlurper().parseText(bodyString)
|
||||
def body = new XmlSlurper().parseText(bodyString.replaceAll("[^\\x20-\\x7e]", ""))
|
||||
if (body?.property?.TimeSyncRequest?.text()) {
|
||||
log.trace "Got TimeSyncRequest"
|
||||
result << timeSyncResponse()
|
||||
@@ -208,7 +208,7 @@ def subscribe(ip, port) {
|
||||
def existingIp = getDataValue("ip")
|
||||
def existingPort = getDataValue("port")
|
||||
if (ip && ip != existingIp) {
|
||||
log.debug "Updating ip from $existingIp to $ip"
|
||||
log.debug "Updating ip from $existingIp to $ip"
|
||||
updateDataValue("ip", ip)
|
||||
def ipvalue = convertHexToIP(getDataValue("ip"))
|
||||
sendEvent(name: "currentIP", value: ipvalue, descriptionText: "IP changed to ${ipvalue}")
|
||||
@@ -291,4 +291,4 @@ User-Agent: CyberGarage-HTTP/1.0
|
||||
</u:GetBinaryState>
|
||||
</s:Body>
|
||||
</s:Envelope>""", physicalgraph.device.Protocol.LAN)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,10 @@ metadata {
|
||||
fingerprint inClusters: "0x26", deviceJoinName: "Z-Wave Dimmer"
|
||||
fingerprint mfr:"001D", prod:"1902", deviceJoinName: "Z-Wave Dimmer"
|
||||
fingerprint mfr:"001D", prod:"1B03", model:"0334", deviceJoinName: "Leviton Universal Dimmer"
|
||||
fingerprint mfr:"011A", prod:"0102", model:"0201", deviceJoinName: "Enerwave In-Wall Dimmer"
|
||||
fingerprint mfr:"001D", prod:"1001", model:"0334", deviceJoinName: "Leviton 3-Speed Fan Controller"
|
||||
fingerprint mfr:"001D", prod:"0602", model:"0334", deviceJoinName: "Leviton Magnetic Low Voltage Dimmer"
|
||||
fingerprint mfr:"001D", prod:"0401", model:"0334", deviceJoinName: "Leviton 600W Incandescent Dimmer"
|
||||
}
|
||||
|
||||
simulator {
|
||||
|
||||
@@ -28,6 +28,7 @@ metadata {
|
||||
fingerprint mfr: "0060", prod: "0001", model: "0002", deviceJoinName: "Everspring Motion Sensor" // Everspring SP814
|
||||
fingerprint mfr: "0060", prod: "0001", model: "0003", deviceJoinName: "Everspring Motion Sensor" // Everspring HSP02
|
||||
fingerprint mfr: "011A", prod: "0601", model: "0901", deviceJoinName: "Enerwave Motion Sensor" // Enerwave ZWN-BPC
|
||||
fingerprint mfr: "0063", prod: "4953", model: "3133", deviceJoinName: "GE Smart Motion Sensor"
|
||||
}
|
||||
|
||||
simulator {
|
||||
|
||||
@@ -25,6 +25,9 @@ metadata {
|
||||
fingerprint mfr:"0063", prod:"4F50", model:"3031", deviceJoinName: "GE Plug-in Outdoor Switch"
|
||||
fingerprint mfr:"001D", prod:"1D04", model:"0334", deviceJoinName: "Leviton Outlet"
|
||||
fingerprint mfr:"001D", prod:"1C02", model:"0334", deviceJoinName: "Leviton Switch"
|
||||
fingerprint mfr:"001D", prod:"0301", model:"0334", deviceJoinName: "Leviton 15A Switch"
|
||||
fingerprint mfr:"011A", prod:"0101", model:"0102", deviceJoinName: "Enerwave On/Off Switch"
|
||||
fingerprint mfr:"011A", prod:"0101", model:"0603", deviceJoinName: "Enerwave Duplex Receptacle"
|
||||
}
|
||||
|
||||
// simulator metadata
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* Door Sensor Light Toggle
|
||||
*
|
||||
* Copyright 2017 Garrett Geier
|
||||
*
|
||||
* 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: "Toggle lights on/off using Door Sensor",
|
||||
namespace: "GarrettGeier",
|
||||
author: "Garrett Geier",
|
||||
description: "Toggle lights on/off with a door sensor. When the door is opened, the lights will toggle based on the master switch.",
|
||||
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")
|
||||
|
||||
//main screen options
|
||||
preferences
|
||||
{
|
||||
//choose the door/contact sensor here.
|
||||
section("When this door is opened")
|
||||
{
|
||||
input "doorToggler", "capability.contactSensor", title: "Select Door Sensor", required: true, multiple: false
|
||||
}
|
||||
|
||||
// this is the master switch. If this switch is ON, then the lights will turn OFF when the door is opened.
|
||||
// If this switch is OFF, then the lights will turn ON when the door is opened.
|
||||
// Don't care about if the door is closed, this is designed for a normal door which will eventually be shut. :)
|
||||
section("Select the Master switch")
|
||||
{
|
||||
input "masterToggle", "capability.switch", title: "Master switch", required: true, multiple: false
|
||||
}
|
||||
|
||||
//based on the master switch, these will turn on or off.
|
||||
section("Stuff you want to turn on/off")
|
||||
{
|
||||
input "switchesToToggle", "capability.switch", title: "If master is ON, these will turn OFF. When the master is OFF, these will turn ON.", required: true, multiple: true
|
||||
}
|
||||
}
|
||||
|
||||
//required
|
||||
def installed()
|
||||
{
|
||||
initialize()
|
||||
}
|
||||
|
||||
//required
|
||||
def updated()
|
||||
{
|
||||
unsubscribe()
|
||||
initialize()
|
||||
}
|
||||
|
||||
// the event we care about, when the door is opened.
|
||||
// see http://docs.smartthings.com/en/latest/capabilities-reference.html#contactsensor for device capabilities
|
||||
def initialize()
|
||||
{
|
||||
subscribe(doorToggler, "contact.open", toggleSwitches)
|
||||
}
|
||||
|
||||
def toggleSwitches(evt)
|
||||
{
|
||||
//log.debug "$evt.value"
|
||||
|
||||
if (evt.value == "open" && masterToggle.currentSwitch == "off")
|
||||
{
|
||||
//log.debug "Light! Yay!"
|
||||
switchesToToggle.on()
|
||||
masterToggle.on()
|
||||
}
|
||||
|
||||
else if (evt.value == "open" && masterToggle.currentSwitch == "on")
|
||||
{
|
||||
//log.debug "Kill the lights"
|
||||
switchesToToggle.off()
|
||||
masterToggle.off()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user