mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-28 13:23:07 +00:00
Compare commits
18 Commits
MSA-1969-1
...
MSA-1996-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d7b448b699 | ||
|
|
9285536f73 | ||
|
|
e7713caec9 | ||
|
|
f0de2f1a19 | ||
|
|
01c2968f91 | ||
|
|
40b75ce665 | ||
|
|
9b01a7d8be | ||
|
|
12bb6c0492 | ||
|
|
7cf8bb1917 | ||
|
|
d4fd778a64 | ||
|
|
eb870e5f31 | ||
|
|
d60657e466 | ||
|
|
d8dc70ae9e | ||
|
|
3457bbad42 | ||
|
|
c6c4b09fbb | ||
|
|
7e25d32c70 | ||
|
|
abc5683ed3 | ||
|
|
1d629cfc9a |
@@ -1,212 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright 2017 Ian Lindsay
|
|
||||||
*
|
|
||||||
* Code snippets taken from Tim Slagle
|
|
||||||
* https://community.smartthings.com/u/tslagle13
|
|
||||||
* here:
|
|
||||||
* https://community.smartthings.com/t/generic-camera-device-using-local-connection-new-version-now-available/3269/75?u=l0kiscot
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
preferences {
|
|
||||||
input("devicekey", "text", title: "Device Key", description: "Your OpenGarage.io device key")
|
|
||||||
input("ipadd", "text", title: "IP address", description: "The IP address of your OpenGarage.io unit")
|
|
||||||
input("port", "text", title: "Port", description: "The port of your OpenGarage.io unit")
|
|
||||||
}
|
|
||||||
|
|
||||||
metadata {
|
|
||||||
definition (name: "OpenGarage.io Handler", namespace: "littlegumSmartHome", author: "Ian Lindsay") {
|
|
||||||
capability "Door Control"
|
|
||||||
capability "Garage Door Control"
|
|
||||||
capability "Refresh"
|
|
||||||
}
|
|
||||||
|
|
||||||
tiles (scale: 2){
|
|
||||||
standardTile("garagedoor", "device.garagedoor", width: 6, height: 4) {
|
|
||||||
state "open", label: '${name}', action: "close", icon: "st.doors.garage.garage-open", backgroundColor: "#e54444"
|
|
||||||
state "closed", label: '${name}', action: "open", icon: "st.doors.garage.garage-closed", backgroundColor: "#79b821"
|
|
||||||
}
|
|
||||||
standardTile("refresh", "device.refresh", inactiveLabel: false, decoration: "flat", width: 6, height: 2) {
|
|
||||||
state "default", action: "refresh.refresh", icon: "st.secondary.refresh"
|
|
||||||
}
|
|
||||||
|
|
||||||
main("garagedoor")
|
|
||||||
details(["garagedoor", "refresh"])
|
|
||||||
}
|
|
||||||
simulator {
|
|
||||||
// simulator metadata
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def installed() {
|
|
||||||
initialize()
|
|
||||||
}
|
|
||||||
|
|
||||||
def initialize() {
|
|
||||||
log.debug "initialize triggered"
|
|
||||||
// initialize state
|
|
||||||
state.doorStatus = 1 // 1 means open, 0 means closed
|
|
||||||
api("getstatus", [])
|
|
||||||
}
|
|
||||||
|
|
||||||
def open() {
|
|
||||||
log.debug "Executing 'close'"
|
|
||||||
api("openclose", [])
|
|
||||||
}
|
|
||||||
|
|
||||||
def close() {
|
|
||||||
log.debug "Executing 'close'"
|
|
||||||
api("openclose", [])
|
|
||||||
}
|
|
||||||
|
|
||||||
def refresh() {
|
|
||||||
log.debug "Refreshing Values "
|
|
||||||
|
|
||||||
api("getstatus", [])
|
|
||||||
}
|
|
||||||
|
|
||||||
def api(method, args = [], success = {}) {
|
|
||||||
def methods = [
|
|
||||||
"getstatus": [gdipadd: "${ipadd}", gdport:"${port}", gdpath:"/jc", gdtype: "get"],
|
|
||||||
"openclose": [gdipadd: "${ipadd}", gdport:"${port}", gdpath:"/cc?dkey=${devicekey}&click=1", gdtype: "get"]
|
|
||||||
]
|
|
||||||
|
|
||||||
def request = methods.getAt(method)
|
|
||||||
|
|
||||||
doRequest(request.gdipadd, request.gdport, request.gdpath, request.gdtype, success)
|
|
||||||
}
|
|
||||||
|
|
||||||
private doRequest(gdipadd, gdport, gdpath, gdtype, success) {
|
|
||||||
log.debug(gdipadd)
|
|
||||||
|
|
||||||
//if(type == "post") {
|
|
||||||
// httpPost(uri , "", success)
|
|
||||||
//}
|
|
||||||
|
|
||||||
//else if(type == "get") {
|
|
||||||
// httpGet(uri, success)
|
|
||||||
//}
|
|
||||||
|
|
||||||
def host = gdipadd
|
|
||||||
def hosthex = convertIPToHex(host)
|
|
||||||
def porthex = Long.toHexString(Long.parseLong((gdport)))
|
|
||||||
if (porthex.length() < 4) { porthex = "00" + porthex }
|
|
||||||
|
|
||||||
//log.debug "Port in Hex is $porthex"
|
|
||||||
//log.debug "Hosthex is : $hosthex"
|
|
||||||
device.deviceNetworkId = "$hosthex:$porthex"
|
|
||||||
|
|
||||||
//log.debug "The device id configured is: $device.deviceNetworkId"
|
|
||||||
|
|
||||||
//def path = gdpath //"/SnapshotJPEG?Resolution=640x480&Quality=Clarity"
|
|
||||||
log.debug "path is: $gdpath"
|
|
||||||
|
|
||||||
def headers = [:] //"HOST:" + getHostAddress() + ""
|
|
||||||
headers.put("HOST", "$host:$gdport")
|
|
||||||
|
|
||||||
try {
|
|
||||||
def hubAction = new physicalgraph.device.HubAction(
|
|
||||||
method: method,
|
|
||||||
path: gdpath,
|
|
||||||
headers: headers
|
|
||||||
)
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
log.debug "Hit Exception on $hubAction"
|
|
||||||
log.debug e
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
def parse(description) {
|
|
||||||
|
|
||||||
def msg = parseLanMessage(description)
|
|
||||||
|
|
||||||
log.debug msg
|
|
||||||
|
|
||||||
def headersAsString = msg.header // => headers as a string
|
|
||||||
def headerMap = msg.headers // => headers as a Map
|
|
||||||
def body = msg.body // => request body as a string
|
|
||||||
def status = msg.status // => http status code of the response
|
|
||||||
//def json = msg.json // => any JSON included in response body, as a data structure of lists and maps
|
|
||||||
//def xml = msg.xml // => any XML included in response body, as a document tree structure
|
|
||||||
//def data = msg.data // => either JSON or XML in response body (whichever is specified by content-type header in response)
|
|
||||||
|
|
||||||
def slurper = new groovy.json.JsonSlurper()
|
|
||||||
def json = slurper.parseText(msg.body)
|
|
||||||
|
|
||||||
log.debug json
|
|
||||||
|
|
||||||
def result
|
|
||||||
log.debug "before state.doorStatus: $state.doorStatus"
|
|
||||||
|
|
||||||
// open / close event
|
|
||||||
if(json.result){
|
|
||||||
if(state.doorStatus){
|
|
||||||
log.debug "door open - so closing"
|
|
||||||
state.doorStatus = 0
|
|
||||||
result = createEvent(name: "garagedoor", value: "closed")
|
|
||||||
} else {
|
|
||||||
log.debug "door closed - so opening"
|
|
||||||
state.doorStatus = 1
|
|
||||||
result = createEvent(name: "garagedoor", value: "open")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//status update request
|
|
||||||
if(json.mac){
|
|
||||||
if(json.door){
|
|
||||||
log.debug "door is open - refreshing setting"
|
|
||||||
state.doorStatus = 1
|
|
||||||
result = createEvent(name: "garagedoor", value: "open")
|
|
||||||
} else {
|
|
||||||
log.debug "door is closed - refreshing setting"
|
|
||||||
state.doorStatus = 0
|
|
||||||
result = createEvent(name: "garagedoor", value: "closed")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
log.debug "after state.doorStatus: $state.doorStatus"
|
|
||||||
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
private Long converIntToLong(ipAddress) {
|
|
||||||
long result = 0
|
|
||||||
def parts = ipAddress.split("\\.")
|
|
||||||
for (int i = 3; i >= 0; i--) {
|
|
||||||
result |= (Long.parseLong(parts[3 - i]) << (i * 8));
|
|
||||||
}
|
|
||||||
|
|
||||||
return result & 0xFFFFFFFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String convertIPToHex(ipAddress) {
|
|
||||||
return Long.toHexString(converIntToLong(ipAddress));
|
|
||||||
}
|
|
||||||
|
|
||||||
private Integer convertHexToInt(hex) {
|
|
||||||
Integer.parseInt(hex,16)
|
|
||||||
}
|
|
||||||
private String convertHexToIP(hex) {
|
|
||||||
log.debug("Convert hex to ip: $hex") // a0 00 01 6
|
|
||||||
[convertHexToInt(hex[0..1]),convertHexToInt(hex[2..3]),convertHexToInt(hex[4..5]),convertHexToInt(hex[6..7])].join(".")
|
|
||||||
}
|
|
||||||
|
|
||||||
private getHostAddress() {
|
|
||||||
def parts = device.deviceNetworkId.split(":")
|
|
||||||
log.debug device.deviceNetworkId
|
|
||||||
def ip = convertHexToIP(parts[0])
|
|
||||||
def port = convertHexToInt(parts[1])
|
|
||||||
return ip + ":" + port
|
|
||||||
}
|
|
||||||
@@ -4,7 +4,7 @@ Cloud Execution
|
|||||||
|
|
||||||
Works with:
|
Works with:
|
||||||
|
|
||||||
* [FortrezZ Siren Strobe Alarm](https://www.smartthings.com/works-with-smartthings/other/fortrezz-water-valve)
|
* [FortrezZ Siren Strobe Alarm](https://www.smartthings.com/products/fortrezz-siren-strobe-alarm)
|
||||||
|
|
||||||
## Table of contents
|
## Table of contents
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ metadata {
|
|||||||
|
|
||||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008"
|
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008"
|
||||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0B04, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY A19 ON/OFF/DIM", deviceJoinName: "SYLVANIA Smart A19 Soft White"
|
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0B04, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY A19 ON/OFF/DIM", deviceJoinName: "SYLVANIA Smart A19 Soft White"
|
||||||
|
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY A19 ON/OFF/DIM 10 Year", deviceJoinName: "SYLVANIA Smart 10-Year A19"
|
||||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, FF00", outClusters: "0019", manufacturer: "MRVL", model: "MZ100", deviceJoinName: "Wemo Bulb"
|
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, FF00", outClusters: "0019", manufacturer: "MRVL", model: "MZ100", deviceJoinName: "Wemo Bulb"
|
||||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0B05", outClusters: "0019", manufacturer: "OSRAM SYLVANIA", model: "iQBR30", deviceJoinName: "Sylvania Ultra iQ"
|
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0B05", outClusters: "0019", manufacturer: "OSRAM SYLVANIA", model: "iQBR30", deviceJoinName: "Sylvania Ultra iQ"
|
||||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY PAR38 ON/OFF/DIM", deviceJoinName: "SYLVANIA Smart PAR38 Soft White"
|
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY PAR38 ON/OFF/DIM", deviceJoinName: "SYLVANIA Smart PAR38 Soft White"
|
||||||
|
|||||||
2
devicetypes/smartthings/zwave-water-valve.src/.st-ignore
Normal file
2
devicetypes/smartthings/zwave-water-valve.src/.st-ignore
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
.st-ignore
|
||||||
|
README.md
|
||||||
38
devicetypes/smartthings/zwave-water-valve.src/README.md
Normal file
38
devicetypes/smartthings/zwave-water-valve.src/README.md
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
# Z-Wave Water Valve
|
||||||
|
|
||||||
|
Cloud Execution
|
||||||
|
|
||||||
|
Works with:
|
||||||
|
|
||||||
|
* [Leak Intelligence Leak Gopher Water Shutoff Valve](https://www.smartthings.com/works-with-smartthings/other/leak-intelligence-leak-gopher-water-shutoff-valve)
|
||||||
|
|
||||||
|
|
||||||
|
## Table of contents
|
||||||
|
|
||||||
|
* [Capabilities](#capabilities)
|
||||||
|
* [Health](#device-health)
|
||||||
|
* [Troubleshooting](#Troubleshooting)
|
||||||
|
|
||||||
|
## Capabilities
|
||||||
|
|
||||||
|
* **Actuator** - represents that a Device has commands
|
||||||
|
* **Health Check** - indicates ability to get device health notifications
|
||||||
|
* **Valve** - allows for the control of a valve device
|
||||||
|
* **Polling** - represents that poll() can be implemented for the device
|
||||||
|
* **Refresh** - _refresh()_ command for status updates
|
||||||
|
* **Sensor** - detects sensor events
|
||||||
|
|
||||||
|
## Device Health
|
||||||
|
|
||||||
|
SmartThings platform will ping the device after `checkInterval` seconds of inactivity in last attempt to reach the device before marking it `OFFLINE`
|
||||||
|
|
||||||
|
* __32min__ checkInterval
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
If the device doesn't pair when trying from the SmartThings mobile app, it is possible that the device is out of range.
|
||||||
|
Pairing needs to be tried again by placing the device closer to the hub.
|
||||||
|
Instructions related to pairing, resetting and removing the device from SmartThings can be found in the following link:
|
||||||
|
* [Leak Intelligence Leak Gopher Water Shutoff Valve Troubleshooting Tips](https://support.smartthings.com/hc/en-us/articles/209631423-Leak-Gopher-Z-Wave-Valve-Control)
|
||||||
|
|
||||||
|
|
||||||
@@ -14,12 +14,14 @@
|
|||||||
metadata {
|
metadata {
|
||||||
definition (name: "Z-Wave Water Valve", namespace: "smartthings", author: "SmartThings") {
|
definition (name: "Z-Wave Water Valve", namespace: "smartthings", author: "SmartThings") {
|
||||||
capability "Actuator"
|
capability "Actuator"
|
||||||
|
capability "Health Check"
|
||||||
capability "Valve"
|
capability "Valve"
|
||||||
capability "Polling"
|
capability "Polling"
|
||||||
capability "Refresh"
|
capability "Refresh"
|
||||||
capability "Sensor"
|
capability "Sensor"
|
||||||
|
|
||||||
fingerprint deviceId: "0x1006", inClusters: "0x25"
|
fingerprint deviceId: "0x1006", inClusters: "0x25"
|
||||||
|
fingerprint mfr:"0173", prod:"0003", model:"0002", deviceJoinName: "Leak Intelligence Leak Gopher Water Shutoff Valve"
|
||||||
}
|
}
|
||||||
|
|
||||||
// simulator metadata
|
// simulator metadata
|
||||||
@@ -53,7 +55,14 @@ metadata {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def installed() {
|
||||||
|
// Device-Watch simply pings if no device events received for 32min(checkInterval)
|
||||||
|
sendEvent(name: "checkInterval", value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
||||||
|
}
|
||||||
|
|
||||||
def updated() {
|
def updated() {
|
||||||
|
// Device-Watch simply pings if no device events received for 32min(checkInterval)
|
||||||
|
sendEvent(name: "checkInterval", value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
||||||
response(refresh())
|
response(refresh())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,6 +123,13 @@ def poll() {
|
|||||||
zwave.switchBinaryV1.switchBinaryGet().format()
|
zwave.switchBinaryV1.switchBinaryGet().format()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PING is used by Device-Watch in attempt to reach the Device
|
||||||
|
* */
|
||||||
|
def ping() {
|
||||||
|
refresh()
|
||||||
|
}
|
||||||
|
|
||||||
def refresh() {
|
def refresh() {
|
||||||
log.debug "refresh() is called"
|
log.debug "refresh() is called"
|
||||||
def commands = [zwave.switchBinaryV1.switchBinaryGet().format()]
|
def commands = [zwave.switchBinaryV1.switchBinaryGet().format()]
|
||||||
|
|||||||
@@ -765,7 +765,6 @@ def turnOffSwitch() {
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
device.off();
|
device.off();
|
||||||
|
|
||||||
return [Device_id: params.id, result_action: "200"]
|
return [Device_id: params.id, result_action: "200"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -789,6 +788,7 @@ def getTempSensorsStatus(id) {
|
|||||||
return []
|
return []
|
||||||
} else {
|
} else {
|
||||||
def bat = getBatteryStatus(device.id)
|
def bat = getBatteryStatus(device.id)
|
||||||
return [temperature: device.currentValue('temperature')] + bat
|
def scale = [Scale: location.temperatureScale]
|
||||||
|
return [temperature: device.currentValue('temperature')] + bat + scale
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -162,6 +162,17 @@ def registerAllDeviceSubscriptions() {
|
|||||||
registerChangeHandler(inputs)
|
registerChangeHandler(inputs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Subscribe to events from a list of devices
|
||||||
|
def registerChangeHandler(myList) {
|
||||||
|
myList.each { myDevice ->
|
||||||
|
def theAtts = myDevice.supportedAttributes
|
||||||
|
theAtts.each { att ->
|
||||||
|
subscribe(myDevice, att.name, deviceEventHandler)
|
||||||
|
log.info "Registering for ${myDevice.displayName}.${att.name}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Endpoints function: Subscribe to events from a specific device
|
//Endpoints function: Subscribe to events from a specific device
|
||||||
def registerDeviceChange() {
|
def registerDeviceChange() {
|
||||||
def subscriptionEndpt = params.subscriptionURL
|
def subscriptionEndpt = params.subscriptionURL
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ def motionHandler(evt) {
|
|||||||
else {
|
else {
|
||||||
state.motionStopTime = now()
|
state.motionStopTime = now()
|
||||||
if(delayMinutes) {
|
if(delayMinutes) {
|
||||||
runIn(delayMinutes*60, turnOffMotionAfterDelay, [overwrite: false])
|
runIn(delayMinutes*60, turnOffMotionAfterDelay, [overwrite: true])
|
||||||
} else {
|
} else {
|
||||||
turnOffMotionAfterDelay()
|
turnOffMotionAfterDelay()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,19 +125,19 @@
|
|||||||
if(allOk) {
|
if(allOk) {
|
||||||
|
|
||||||
if(everyoneIsAway() && (state.sunMode == "sunrise")) {
|
if(everyoneIsAway() && (state.sunMode == "sunrise")) {
|
||||||
log.info("Home is Empty Setting New Away Mode")
|
log.debug("Home is Empty Setting New Away Mode")
|
||||||
def delay = (falseAlarmThreshold != null && falseAlarmThreshold != "") ? falseAlarmThreshold * 60 : 10 * 60
|
def delay = (falseAlarmThreshold != null && falseAlarmThreshold != "") ? falseAlarmThreshold * 60 : 10 * 60
|
||||||
runIn(delay, "setAway")
|
runIn(delay, "setAway")
|
||||||
}
|
}
|
||||||
|
|
||||||
if(everyoneIsAway() && (state.sunMode == "sunset")) {
|
if(everyoneIsAway() && (state.sunMode == "sunset")) {
|
||||||
log.info("Home is Empty Setting New Away Mode")
|
log.debug("Home is Empty Setting New Away Mode")
|
||||||
def delay = (falseAlarmThreshold != null && falseAlarmThreshold != "") ? falseAlarmThreshold * 60 : 10 * 60
|
def delay = (falseAlarmThreshold != null && falseAlarmThreshold != "") ? falseAlarmThreshold * 60 : 10 * 60
|
||||||
runIn(delay, "setAway")
|
runIn(delay, "setAway")
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
log.info("Home is Occupied Setting New Home Mode")
|
log.debug("Home is Occupied Setting New Home Mode")
|
||||||
setHome()
|
setHome()
|
||||||
|
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@
|
|||||||
log.debug("Checking if everyone is away")
|
log.debug("Checking if everyone is away")
|
||||||
|
|
||||||
if(everyoneIsAway()) {
|
if(everyoneIsAway()) {
|
||||||
log.info("Nobody is home, running away sequence")
|
log.debug("Nobody is home, running away sequence")
|
||||||
def delay = (falseAlarmThreshold != null && falseAlarmThreshold != "") ? falseAlarmThreshold * 60 : 10 * 60
|
def delay = (falseAlarmThreshold != null && falseAlarmThreshold != "") ? falseAlarmThreshold * 60 : 10 * 60
|
||||||
runIn(delay, "setAway")
|
runIn(delay, "setAway")
|
||||||
}
|
}
|
||||||
@@ -161,7 +161,7 @@
|
|||||||
else {
|
else {
|
||||||
def lastTime = state[evt.deviceId]
|
def lastTime = state[evt.deviceId]
|
||||||
if (lastTime == null || now() - lastTime >= 1 * 60000) {
|
if (lastTime == null || now() - lastTime >= 1 * 60000) {
|
||||||
log.info("Someone is home, running home sequence")
|
log.debug("Someone is home, running home sequence")
|
||||||
setHome()
|
setHome()
|
||||||
}
|
}
|
||||||
state[evt.deviceId] = now()
|
state[evt.deviceId] = now()
|
||||||
@@ -175,14 +175,14 @@
|
|||||||
if(everyoneIsAway()) {
|
if(everyoneIsAway()) {
|
||||||
if(state.sunMode == "sunset") {
|
if(state.sunMode == "sunset") {
|
||||||
def message = "Performing \"${awayNight}\" for you as requested."
|
def message = "Performing \"${awayNight}\" for you as requested."
|
||||||
log.info(message)
|
log.debug(message)
|
||||||
sendAway(message)
|
sendAway(message)
|
||||||
location.helloHome.execute(settings.awayNight)
|
location.helloHome.execute(settings.awayNight)
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(state.sunMode == "sunrise") {
|
else if(state.sunMode == "sunrise") {
|
||||||
def message = "Performing \"${awayDay}\" for you as requested."
|
def message = "Performing \"${awayDay}\" for you as requested."
|
||||||
log.info(message)
|
log.debug(message)
|
||||||
sendAway(message)
|
sendAway(message)
|
||||||
location.helloHome.execute(settings.awayDay)
|
location.helloHome.execute(settings.awayDay)
|
||||||
}
|
}
|
||||||
@@ -192,19 +192,19 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
log.info("Somebody returned home before we set to '${newAwayMode}'")
|
log.debug("Somebody returned home before we set to '${newAwayMode}'")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//set home mode when house is occupied
|
//set home mode when house is occupied
|
||||||
def setHome() {
|
def setHome() {
|
||||||
sendOutOfDateNotification()
|
sendOutOfDateNotification()
|
||||||
log.info("Setting Home Mode!!")
|
log.debug("Setting Home Mode!!")
|
||||||
if(anyoneIsHome()) {
|
if(anyoneIsHome()) {
|
||||||
if(state.sunMode == "sunset"){
|
if(state.sunMode == "sunset"){
|
||||||
if (location.mode != "${homeModeNight}"){
|
if (location.mode != "${homeModeNight}"){
|
||||||
def message = "Performing \"${homeNight}\" for you as requested."
|
def message = "Performing \"${homeNight}\" for you as requested."
|
||||||
log.info(message)
|
log.debug(message)
|
||||||
sendHome(message)
|
sendHome(message)
|
||||||
location.helloHome.execute(settings.homeNight)
|
location.helloHome.execute(settings.homeNight)
|
||||||
}
|
}
|
||||||
@@ -213,7 +213,7 @@
|
|||||||
if(state.sunMode == "sunrise"){
|
if(state.sunMode == "sunrise"){
|
||||||
if (location.mode != "${homeModeDay}"){
|
if (location.mode != "${homeModeDay}"){
|
||||||
def message = "Performing \"${homeDay}\" for you as requested."
|
def message = "Performing \"${homeDay}\" for you as requested."
|
||||||
log.info(message)
|
log.debug(message)
|
||||||
sendHome(message)
|
sendHome(message)
|
||||||
location.helloHome.execute(settings.homeDay)
|
location.helloHome.execute(settings.homeDay)
|
||||||
}
|
}
|
||||||
@@ -329,4 +329,4 @@
|
|||||||
sendNotification("Your version of Hello, Home Phrase Director is currently out of date. Please look for the new version of Hello, Home Phrase Director now called 'Routine Director' in the marketplace.")
|
sendNotification("Your version of Hello, Home Phrase Director is currently out of date. Please look for the new version of Hello, Home Phrase Director now called 'Routine Director' in the marketplace.")
|
||||||
state.lastTime = (new Date() + 31).getTime()
|
state.lastTime = (new Date() + 31).getTime()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user