mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-29 06:13:07 +01:00
Compare commits
1 Commits
MSA-1695-1
...
MSA-1599-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
21e304d1ed |
@@ -1,345 +0,0 @@
|
|||||||
/**
|
|
||||||
* Device Type Definition File
|
|
||||||
*
|
|
||||||
* Device Type: Fibaro Roller Shutter
|
|
||||||
* File Name: fibaro-roller-shutter.groovy
|
|
||||||
* Initial Release: 2015-06-00
|
|
||||||
* Author: SmartThings
|
|
||||||
*
|
|
||||||
* Copyright 2015 SmartThings
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
metadata {
|
|
||||||
// Automatically generated. Make future change here.
|
|
||||||
definition (name: "Fibaro Roller Shutter", namespace: "ADF", author: "ADF") {
|
|
||||||
capability "Switch Level"
|
|
||||||
capability "Actuator"
|
|
||||||
capability "Switch"
|
|
||||||
capability "Polling"
|
|
||||||
capability "Refresh"
|
|
||||||
capability "Sensor"
|
|
||||||
|
|
||||||
command "resetParams2StDefaults"
|
|
||||||
command "listCurrentParams"
|
|
||||||
command "updateZwaveParam"
|
|
||||||
|
|
||||||
fingerprint deviceId: "0x1101", inClusters: "0x72,0x86,0x70,0x85,0x8E,0x26,0x7A,0x27,0x73,0xEF,0x26,0x2B"
|
|
||||||
}
|
|
||||||
|
|
||||||
simulator {
|
|
||||||
status "on": "command: 2003, payload: FF"
|
|
||||||
status "off": "command: 2003, payload: 00"
|
|
||||||
status "09%": "command: 2003, payload: 09"
|
|
||||||
status "10%": "command: 2003, payload: 0A"
|
|
||||||
status "33%": "command: 2003, payload: 21"
|
|
||||||
status "66%": "command: 2003, payload: 42"
|
|
||||||
status "99%": "command: 2003, payload: 63"
|
|
||||||
|
|
||||||
// reply messages
|
|
||||||
reply "2001FF,delay 5000,2602": "command: 2603, payload: FF"
|
|
||||||
reply "200100,delay 5000,2602": "command: 2603, payload: 00"
|
|
||||||
reply "200119,delay 5000,2602": "command: 2603, payload: 19"
|
|
||||||
reply "200132,delay 5000,2602": "command: 2603, payload: 32"
|
|
||||||
reply "20014B,delay 5000,2602": "command: 2603, payload: 4B"
|
|
||||||
reply "200163,delay 5000,2602": "command: 2603, payload: 63"
|
|
||||||
}
|
|
||||||
|
|
||||||
tiles {
|
|
||||||
multiAttributeTile(name:"switch", type: "lighting", width: 6, height: 4, canChangeIcon: true) {
|
|
||||||
tileAttribute("device.switch", key: "PRIMARY_CONTROL") {
|
|
||||||
attributeState("on", label:"open", action:"switch.off", icon:"st.doors.garage.garage-open", backgroundColor:"#79b821", nextState: "turningOff")
|
|
||||||
attributeState("off", label:"close", action:"switch.on", icon:"st.doors.garage.garage-closed", backgroundColor:"#ffffff", nextState: "turningOn")
|
|
||||||
attributeState("turningOn", label:"opening", action:"switch.off", icon:"st.doors.garage.garage-opening", backgroundColor:"#79b821", nextState: "turningOff")
|
|
||||||
attributeState("turningOff", label:"closing", action:"switch.on", icon:"st.doors.garage.garage-closing", backgroundColor:"#ffffff", nextState:"turningOn")
|
|
||||||
}
|
|
||||||
tileAttribute ("device.level", key: "SLIDER_CONTROL") {
|
|
||||||
attributeState("level", action:"switch level.setLevel")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
standardTile("refresh", "device.switch", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
|
|
||||||
state "default", label:"", action:"refresh.refresh", icon:"st.secondary.refresh"
|
|
||||||
}
|
|
||||||
standardTile("on", "device.switch", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
|
|
||||||
state("on", label:'open', action:"switch.on", icon:"st.doors.garage.garage-opening")
|
|
||||||
}
|
|
||||||
standardTile("off", "device.switch", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
|
|
||||||
state("off", label:'close', action:"switch.off", icon:"st.doors.garage.garage-closing")
|
|
||||||
}
|
|
||||||
standardTile("stop", "device.level", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
|
|
||||||
state("default", label:'stop/my', action:"switch level.setLevel", icon:"st.Transportation.transportation13")
|
|
||||||
}
|
|
||||||
|
|
||||||
main(["switch"])
|
|
||||||
details(["switch", "refresh", "on", "off", "stop"])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def parse(String description) {
|
|
||||||
def item1 = [
|
|
||||||
canBeCurrentState: false,
|
|
||||||
linkText: getLinkText(device),
|
|
||||||
isStateChange: false,
|
|
||||||
displayed: false,
|
|
||||||
descriptionText: description,
|
|
||||||
value: description
|
|
||||||
]
|
|
||||||
def result
|
|
||||||
def cmd = zwave.parse(description, [0x26: 1, 0x70: 2, 072: 2])
|
|
||||||
//log.debug "cmd: ${cmd}"
|
|
||||||
|
|
||||||
if (cmd) {
|
|
||||||
result = createEvent(cmd, item1)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
item1.displayed = displayed(description, item1.isStateChange)
|
|
||||||
result = [item1]
|
|
||||||
}
|
|
||||||
|
|
||||||
if(result?.descriptionText)
|
|
||||||
log.debug "Parse returned ${result?.descriptionText}"
|
|
||||||
|
|
||||||
result
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
def createEvent(physicalgraph.zwave.commands.basicv1.BasicReport cmd, Map item1) {
|
|
||||||
def result = doCreateEvent(cmd, item1)
|
|
||||||
for (int i = 0; i < result.size(); i++) {
|
|
||||||
result[i].type = "physical"
|
|
||||||
}
|
|
||||||
result
|
|
||||||
}
|
|
||||||
|
|
||||||
def createEvent(physicalgraph.zwave.commands.basicv1.BasicSet cmd, Map item1) {
|
|
||||||
def result = doCreateEvent(cmd, item1)
|
|
||||||
for (int i = 0; i < result.size(); i++) {
|
|
||||||
result[i].type = "physical"
|
|
||||||
}
|
|
||||||
result
|
|
||||||
}
|
|
||||||
|
|
||||||
def createEvent(physicalgraph.zwave.commands.switchmultilevelv1.SwitchMultilevelStartLevelChange cmd, Map item1) {
|
|
||||||
[]
|
|
||||||
}
|
|
||||||
|
|
||||||
def createEvent(physicalgraph.zwave.commands.switchmultilevelv1.SwitchMultilevelStopLevelChange cmd, Map item1) {
|
|
||||||
[response(zwave.basicV1.basicGet())]
|
|
||||||
}
|
|
||||||
|
|
||||||
def createEvent(physicalgraph.zwave.commands.switchmultilevelv1.SwitchMultilevelSet cmd, Map item1) {
|
|
||||||
def result = doCreateEvent(cmd, item1)
|
|
||||||
for (int i = 0; i < result.size(); i++) {
|
|
||||||
result[i].type = "physical"
|
|
||||||
}
|
|
||||||
result
|
|
||||||
}
|
|
||||||
|
|
||||||
def createEvent(physicalgraph.zwave.commands.switchmultilevelv1.SwitchMultilevelReport cmd, Map item1) {
|
|
||||||
def result = doCreateEvent(cmd, item1)
|
|
||||||
result[0].descriptionText = "${item1.linkText} is ${item1.value}"
|
|
||||||
result[0].handlerName = cmd.value ? "statusOn" : "statusOff"
|
|
||||||
for (int i = 0; i < result.size(); i++) {
|
|
||||||
result[i].type = "digital"
|
|
||||||
}
|
|
||||||
result
|
|
||||||
}
|
|
||||||
|
|
||||||
def doCreateEvent(physicalgraph.zwave.Command cmd, Map item1) {
|
|
||||||
def result = [item1]
|
|
||||||
|
|
||||||
item1.name = "switch"
|
|
||||||
item1.value = cmd.value ? "on" : "off"
|
|
||||||
item1.handlerName = item1.value
|
|
||||||
item1.descriptionText = "${item1.linkText} was turned ${item1.value}"
|
|
||||||
item1.canBeCurrentState = true
|
|
||||||
item1.isStateChange = isStateChange(device, item1.name, item1.value)
|
|
||||||
item1.displayed = item1.isStateChange
|
|
||||||
|
|
||||||
if (cmd.value >= 5) {
|
|
||||||
def item2 = new LinkedHashMap(item1)
|
|
||||||
item2.name = "level"
|
|
||||||
item2.value = cmd.value as String
|
|
||||||
item2.unit = "%"
|
|
||||||
item2.descriptionText = "${item1.linkText} dimmed ${item2.value} %"
|
|
||||||
item2.canBeCurrentState = true
|
|
||||||
item2.isStateChange = isStateChange(device, item2.name, item2.value)
|
|
||||||
item2.displayed = false
|
|
||||||
result << item2
|
|
||||||
}
|
|
||||||
result
|
|
||||||
}
|
|
||||||
|
|
||||||
def createEvent(physicalgraph.zwave.Command cmd, Map map) {
|
|
||||||
// Handles any Z-Wave commands we aren't interested in
|
|
||||||
log.debug "UNHANDLED COMMAND $cmd"
|
|
||||||
}
|
|
||||||
|
|
||||||
def on() {
|
|
||||||
log.info "on"
|
|
||||||
delayBetween([zwave.basicV1.basicSet(value: 0xFF).format(), zwave.switchMultilevelV1.switchMultilevelGet().format()], 5000)
|
|
||||||
}
|
|
||||||
|
|
||||||
def off() {
|
|
||||||
delayBetween ([zwave.basicV1.basicSet(value: 0x00).format(), zwave.switchMultilevelV1.switchMultilevelGet().format()], 5000)
|
|
||||||
}
|
|
||||||
|
|
||||||
def setLevel(value) {
|
|
||||||
def level = Math.min(value as Integer, 99)
|
|
||||||
delayBetween ([zwave.basicV1.basicSet(value: level).format(), zwave.switchMultilevelV1.switchMultilevelGet().format()], 5000)
|
|
||||||
}
|
|
||||||
|
|
||||||
def setLevel(value, duration) {
|
|
||||||
def level = Math.min(value as Integer, 99)
|
|
||||||
def dimmingDuration = duration < 128 ? duration : 128 + Math.round(duration / 60)
|
|
||||||
zwave.switchMultilevelV2.switchMultilevelSet(value: level, dimmingDuration: dimmingDuration).format()
|
|
||||||
}
|
|
||||||
|
|
||||||
def poll() {
|
|
||||||
zwave.switchMultilevelV1.switchMultilevelGet().format()
|
|
||||||
}
|
|
||||||
|
|
||||||
def refresh() {
|
|
||||||
zwave.switchMultilevelV1.switchMultilevelGet().format()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Configures the device to settings needed by SmarthThings at device discovery time. Assumes
|
|
||||||
* device is already at default parameter settings.
|
|
||||||
*
|
|
||||||
* @param none
|
|
||||||
*
|
|
||||||
* @return none
|
|
||||||
*/
|
|
||||||
def configure() {
|
|
||||||
log.debug "Configuring Device..."
|
|
||||||
def cmds = []
|
|
||||||
|
|
||||||
// send associate to group 3 to get sensor data reported only to hub
|
|
||||||
cmds << zwave.associationV2.associationSet(groupingIdentifier:3, nodeId:[zwaveHubNodeId]).format()
|
|
||||||
|
|
||||||
|
|
||||||
delayBetween(cmds, 500)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def createEvent(physicalgraph.zwave.commands.configurationv2.ConfigurationReport cmd, Map item1) {
|
|
||||||
|
|
||||||
log.debug "${device.displayName} parameter '${cmd.parameterNumber}' with a byte size of '${cmd.size}' is set to '${cmd.configurationValue}'"
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method will allow the user to update device parameters (behavior) from an app.
|
|
||||||
* the user can write his/her own app to envoke this method.
|
|
||||||
* No type or value checking is done to compare to what device capability or reaction.
|
|
||||||
* It is up to user to read OEM documentation prio to envoking this method.
|
|
||||||
*
|
|
||||||
* <p>THIS IS AN ADVANCED OPERATION. USE AT YOUR OWN RISK! READ OEM DOCUMENTATION!
|
|
||||||
*
|
|
||||||
* @param List[paramNumber:80,value:10,size:1]
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return none
|
|
||||||
*/
|
|
||||||
def updateZwaveParam(params) {
|
|
||||||
if ( params ) {
|
|
||||||
def pNumber = params.paramNumber
|
|
||||||
def pSize = params.size
|
|
||||||
def pValue = [params.value]
|
|
||||||
log.debug "Make sure device is awake and in recieve mode"
|
|
||||||
log.debug "Updating ${device.displayName} parameter number '${pNumber}' with value '${pValue}' with size of '${pSize}'"
|
|
||||||
|
|
||||||
def cmds = []
|
|
||||||
cmds << zwave.configurationV1.configurationSet(configurationValue: pValue, parameterNumber: pNumber, size: pSize).format()
|
|
||||||
cmds << zwave.configurationV1.configurationGet(parameterNumber: pNumber).format()
|
|
||||||
delayBetween(cmds, 1000)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets all of available Fibaro parameters back to the device defaults except for what
|
|
||||||
* SmartThings needs to support the stock functionality as released.
|
|
||||||
*
|
|
||||||
* <p>THIS IS AN ADVANCED OPERATION. USE AT YOUR OWN RISK! READ OEM DOCUMENTATION!
|
|
||||||
*
|
|
||||||
* @param none
|
|
||||||
*
|
|
||||||
* @return none
|
|
||||||
*/
|
|
||||||
def resetParams2StDefaults() {
|
|
||||||
log.debug "Resetting ${device.displayName} parameters to SmartThings compatible defaults"
|
|
||||||
def cmds = []
|
|
||||||
cmds << zwave.configurationV1.configurationSet(configurationValue: [255], parameterNumber: 1, size: 1).format()
|
|
||||||
cmds << zwave.configurationV1.configurationSet(configurationValue: [0], parameterNumber: 6, size: 1).format()
|
|
||||||
cmds << zwave.configurationV1.configurationSet(configurationValue: [1], parameterNumber: 7, size: 1).format()
|
|
||||||
cmds << zwave.configurationV1.configurationSet(configurationValue: [1], parameterNumber: 8, size: 1).format()
|
|
||||||
cmds << zwave.configurationV1.configurationSet(configurationValue: [5], parameterNumber: 9, size: 1).format()
|
|
||||||
cmds << zwave.configurationV1.configurationSet(configurationValue: [1], parameterNumber: 10, size: 1).format()
|
|
||||||
cmds << zwave.configurationV1.configurationSet(configurationValue: [1], parameterNumber: 11, size: 1).format()
|
|
||||||
cmds << zwave.configurationV1.configurationSet(configurationValue: [99], parameterNumber: 12, size: 1).format()
|
|
||||||
cmds << zwave.configurationV1.configurationSet(configurationValue: [2], parameterNumber: 13, size: 1).format()
|
|
||||||
cmds << zwave.configurationV1.configurationSet(configurationValue: [0], parameterNumber: 14, size: 1).format()
|
|
||||||
cmds << zwave.configurationV1.configurationSet(configurationValue: [1], parameterNumber: 15, size: 1).format()
|
|
||||||
cmds << zwave.configurationV1.configurationSet(configurationValue: [1], parameterNumber: 16, size: 1).format()
|
|
||||||
cmds << zwave.configurationV1.configurationSet(configurationValue: [0], parameterNumber: 17, size: 1).format()
|
|
||||||
cmds << zwave.configurationV1.configurationSet(configurationValue: [0], parameterNumber: 18, size: 1).format()
|
|
||||||
cmds << zwave.configurationV1.configurationSet(configurationValue: [0], parameterNumber: 19, size: 1).format()
|
|
||||||
//Param 20 is different for 50Hz or 60 Hz uncomment the line that will reflect the power frequency used
|
|
||||||
//cmds << zwave.configurationV1.configurationSet(configurationValue: [101], parameterNumber: 20, size: 1).format() //60 Hz (US)
|
|
||||||
//cmds << zwave.configurationV1.configurationSet(configurationValue: [110], parameterNumber: 20, size: 1).format() //50 Hz (UK)
|
|
||||||
cmds << zwave.configurationV1.configurationSet(configurationValue: [3], parameterNumber: 30, size: 1).format()
|
|
||||||
cmds << zwave.configurationV1.configurationSet(configurationValue: [600], parameterNumber: 39, size: 1).format()
|
|
||||||
//Param 40 not needed by SmartThings
|
|
||||||
//cmds << zwave.configurationV1.configurationSet(configurationValue: [0], parameterNumber: 40, size: 1).format()
|
|
||||||
cmds << zwave.configurationV1.configurationSet(configurationValue: [0], parameterNumber: 41, size: 1).format()
|
|
||||||
|
|
||||||
delayBetween(cmds, 500)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Lists all of available Fibaro parameters and thier current settings out to the
|
|
||||||
* logging window in the IDE. This will be called from the "Fibaro Tweaker" or
|
|
||||||
* user's own app.
|
|
||||||
*
|
|
||||||
* <p>THIS IS AN ADVANCED OPERATION. USE AT YOUR OWN RISK! READ OEM DOCUMENTATION!
|
|
||||||
*
|
|
||||||
* @param none
|
|
||||||
*
|
|
||||||
* @return none
|
|
||||||
*/
|
|
||||||
def listCurrentParams() {
|
|
||||||
log.debug "Listing of current parameter settings of ${device.displayName}"
|
|
||||||
def cmds = []
|
|
||||||
cmds << zwave.configurationV1.configurationGet(parameterNumber: 1).format()
|
|
||||||
cmds << zwave.configurationV1.configurationGet(parameterNumber: 6).format()
|
|
||||||
cmds << zwave.configurationV1.configurationGet(parameterNumber: 7).format()
|
|
||||||
cmds << zwave.configurationV1.configurationGet(parameterNumber: 8).format()
|
|
||||||
cmds << zwave.configurationV1.configurationGet(parameterNumber: 9).format()
|
|
||||||
cmds << zwave.configurationV1.configurationGet(parameterNumber: 10).format()
|
|
||||||
cmds << zwave.configurationV1.configurationGet(parameterNumber: 11).format()
|
|
||||||
cmds << zwave.configurationV1.configurationGet(parameterNumber: 12).format()
|
|
||||||
cmds << zwave.configurationV1.configurationGet(parameterNumber: 13).format()
|
|
||||||
cmds << zwave.configurationV1.configurationGet(parameterNumber: 14).format()
|
|
||||||
cmds << zwave.configurationV1.configurationGet(parameterNumber: 15).format()
|
|
||||||
cmds << zwave.configurationV1.configurationGet(parameterNumber: 16).format()
|
|
||||||
cmds << zwave.configurationV1.configurationGet(parameterNumber: 17).format()
|
|
||||||
cmds << zwave.configurationV1.configurationGet(parameterNumber: 18).format()
|
|
||||||
cmds << zwave.configurationV1.configurationGet(parameterNumber: 19).format()
|
|
||||||
cmds << zwave.configurationV1.configurationGet(parameterNumber: 20).format()
|
|
||||||
cmds << zwave.configurationV1.configurationGet(parameterNumber: 30).format()
|
|
||||||
cmds << zwave.configurationV1.configurationGet(parameterNumber: 39).format()
|
|
||||||
cmds << zwave.configurationV1.configurationGet(parameterNumber: 40).format()
|
|
||||||
cmds << zwave.configurationV1.configurationGet(parameterNumber: 41).format()
|
|
||||||
|
|
||||||
delayBetween(cmds, 500)
|
|
||||||
}
|
|
||||||
241
devicetypes/blebson/iris-smart-plug.src/iris-smart-plug.groovy
Normal file
241
devicetypes/blebson/iris-smart-plug.src/iris-smart-plug.groovy
Normal file
@@ -0,0 +1,241 @@
|
|||||||
|
/**
|
||||||
|
* Copyright 2015 SmartThings
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* SmartPower Outlet (CentraLite)
|
||||||
|
*
|
||||||
|
* Author: SmartThings
|
||||||
|
* Date: 2015-08-23
|
||||||
|
*/
|
||||||
|
metadata {
|
||||||
|
// Automatically generated. Make future change here.
|
||||||
|
definition (name: "Iris Smart Plug", namespace: "blebson", author: "SmartThings") {
|
||||||
|
capability "Actuator"
|
||||||
|
capability "Switch"
|
||||||
|
capability "Power Meter"
|
||||||
|
capability "Energy Meter"
|
||||||
|
capability "Configuration"
|
||||||
|
capability "Refresh"
|
||||||
|
capability "Sensor"
|
||||||
|
|
||||||
|
// indicates that device keeps track of heartbeat (in state.heartbeat)
|
||||||
|
attribute "heartbeat", "string"
|
||||||
|
attribute "timerStart", "number"
|
||||||
|
|
||||||
|
attribute "energyDisplay", "string"
|
||||||
|
attribute "elapsedTimeDisplay", "string"
|
||||||
|
|
||||||
|
command "resetEnergyUsage"
|
||||||
|
|
||||||
|
fingerprint profileId: "0104", inClusters: "0000 0003 0004 0005 0006 0B04 0B05 FC03", outClusters: "0019", manufacturer: "CentraLite", model: "3210-L", deviceJoinName: "Outlet"
|
||||||
|
//fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0B04,0B05", outClusters: "0019", manufacturer: "CentraLite", model: "3200", deviceJoinName: "Outlet"
|
||||||
|
//fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0B04,0B05", outClusters: "0019", manufacturer: "CentraLite", model: "3200-Sgb", deviceJoinName: "Outlet"
|
||||||
|
//fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0B04,0B05", outClusters: "0019", manufacturer: "CentraLite", model: "4257050-RZHAC", deviceJoinName: "Outlet"
|
||||||
|
//fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0B04,0B05", outClusters: "0019"
|
||||||
|
}
|
||||||
|
|
||||||
|
// simulator metadata
|
||||||
|
simulator {
|
||||||
|
// status messages
|
||||||
|
status "on": "on/off: 1"
|
||||||
|
status "off": "on/off: 0"
|
||||||
|
|
||||||
|
// reply messages
|
||||||
|
reply "zcl on-off on": "on/off: 1"
|
||||||
|
reply "zcl on-off off": "on/off: 0"
|
||||||
|
}
|
||||||
|
|
||||||
|
preferences {
|
||||||
|
section {
|
||||||
|
image(name: 'educationalcontent', multiple: true, images: [
|
||||||
|
"http://cdn.device-gse.smartthings.com/Outlet/US/OutletUS1.jpg",
|
||||||
|
"http://cdn.device-gse.smartthings.com/Outlet/US/OutletUS2.jpg"
|
||||||
|
])
|
||||||
|
}
|
||||||
|
|
||||||
|
section("Reporting Intervals") {
|
||||||
|
input "intervalMin", "number", title: "Minimum interval between reports [s]", defaultValue: 5, range: "1..600"
|
||||||
|
input "intervalMax", "number", title: "Maximum interval between reports [s]", defaultValue: 600, range: "1..600"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// UI tile definitions
|
||||||
|
tiles(scale: 2) {
|
||||||
|
multiAttributeTile(name:"switch", type: "lighting", width: 6, height: 4, canChangeIcon: true){
|
||||||
|
tileAttribute ("device.switch", key: "PRIMARY_CONTROL") {
|
||||||
|
attributeState "on", label: '${name}', action: "switch.off", icon: "st.switches.switch.on", backgroundColor: "#79b821", nextState: "turningOff"
|
||||||
|
attributeState "off", label: '${name}', action: "switch.on", icon: "st.switches.switch.off", backgroundColor: "#ffffff", nextState: "turningOn"
|
||||||
|
attributeState "turningOn", label: '${name}', action: "switch.off", icon: "st.switches.switch.on", backgroundColor: "#79b821", nextState: "turningOff"
|
||||||
|
attributeState "turningOff", label: '${name}', action: "switch.on", icon: "st.switches.switch.off", backgroundColor: "#ffffff", nextState: "turningOn"
|
||||||
|
}
|
||||||
|
tileAttribute ("power", key: "SECONDARY_CONTROL") {
|
||||||
|
attributeState "power", label:'${currentValue} W'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
valueTile("energyDisplay", "device.energyDisplay", width: 5, height: 1, decoration: "flat") {
|
||||||
|
state "default", label:'Energy used: ${currentValue}', unit: "kWh"
|
||||||
|
}
|
||||||
|
|
||||||
|
standardTile("refresh", "device.switch", inactiveLabel: false, decoration: "flat", width: 1, height: 1) {
|
||||||
|
state "default", label:"", action:"refresh.refresh", icon:"st.secondary.refresh"
|
||||||
|
}
|
||||||
|
|
||||||
|
standardTile("resetUsage", "command.resetEnergyUsage", decoration: "flat", width: 1, height: 1){
|
||||||
|
state "default", action: "resetEnergyUsage", label:'Reset kWh', icon:"st.Health & Wellness.health7"
|
||||||
|
}
|
||||||
|
|
||||||
|
valueTile("elapsedTimeDisplay", "device.elapsedTimeDisplay", decoration: "flat", width: 5, height: 1){
|
||||||
|
state "default", label: 'Time: ${currentValue}', unit: "h"
|
||||||
|
}
|
||||||
|
|
||||||
|
standardTile("configure", "device.switch", inactiveLabel: false, decoration: "flat", width: 1, height: 1) {
|
||||||
|
state "default", label:"", action:"configure", icon:"st.secondary.configure"
|
||||||
|
}
|
||||||
|
|
||||||
|
main "switch"
|
||||||
|
details(["switch","energyDisplay","resetUsage","power","elapsedTimeDisplay","refresh"])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse incoming device messages to generate events
|
||||||
|
def parse(String description) {
|
||||||
|
log.debug "description is $description"
|
||||||
|
|
||||||
|
// save heartbeat (i.e. last time we got a message from device)
|
||||||
|
state.heartbeat = Calendar.getInstance().getTimeInMillis()
|
||||||
|
if (state.timerStart == null)
|
||||||
|
{
|
||||||
|
state.timerStart = Calendar.getInstance().getTimeInMillis()
|
||||||
|
state.energy = 0.0
|
||||||
|
}
|
||||||
|
|
||||||
|
def finalResult = zigbee.getKnownDescription(description)
|
||||||
|
|
||||||
|
//TODO: Remove this after getKnownDescription can parse it automatically
|
||||||
|
if (!finalResult && description!="updated")
|
||||||
|
finalResult = getPowerDescription(zigbee.parseDescriptionAsMap(description))
|
||||||
|
|
||||||
|
if (finalResult) {
|
||||||
|
log.info finalResult
|
||||||
|
if (finalResult.type == "update") {
|
||||||
|
log.info "$device updates: ${finalResult.value}"
|
||||||
|
}
|
||||||
|
else if (finalResult.type == "power") {
|
||||||
|
def powerValue = (finalResult.value as Integer)/10
|
||||||
|
sendEvent(name: "power", value: powerValue, isStateChange: true, displayed: false) // note: stateChange = true added so the energy calculation can work properly
|
||||||
|
/*
|
||||||
|
Dividing by 10 as the Divisor is 10000 and unit is kW for the device. AttrId: 0302 and 0300. Simplifying to 10
|
||||||
|
power level is an integer. The exact power level with correct units needs to be handled in the device type
|
||||||
|
to account for the different Divisor value (AttrId: 0302) and POWER Unit (AttrId: 0300). CLUSTER for simple metering is 0702
|
||||||
|
*/
|
||||||
|
calculateAndShowEnergy()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sendEvent(name: finalResult.type, value: finalResult.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
log.warn "DID NOT PARSE MESSAGE for description : $description"
|
||||||
|
log.debug zigbee.parseDescriptionAsMap(description)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def calculateAndShowEnergy()
|
||||||
|
{
|
||||||
|
def recentEvents = device.statesSince("power", new Date()-1, [max: 2]).collect {[value: it.value as float, date: it.date]}
|
||||||
|
def deltaT = (recentEvents[0].date.getTime() - recentEvents[1].date.getTime()) // time since last "power" event in milliseconds
|
||||||
|
deltaT = deltaT / 3600000 // convert to hours
|
||||||
|
|
||||||
|
def energyValue = device.currentValue("energy")
|
||||||
|
if(energyValue != null) {
|
||||||
|
energyValue += (recentEvents[1].value * deltaT) / 1000 // energy used since last "power" event in kWh
|
||||||
|
}
|
||||||
|
|
||||||
|
sendEvent(name: "energy", value: energyValue, displayed: false)
|
||||||
|
sendEvent(name: "energyDisplay", value: String.format("%6.3f kWh",energyValue), displayed: false)
|
||||||
|
|
||||||
|
def currentTime = Calendar.getInstance().getTimeInMillis()
|
||||||
|
def timeDifference = ((long)currentTime - state.timerStart)/1000; // in seconds
|
||||||
|
int h = (int) (timeDifference / (3600));
|
||||||
|
int m = (int) ((timeDifference - (h * 3600)) / 60);
|
||||||
|
int s = (int) (timeDifference - (h * 3600) - m * 60);
|
||||||
|
int d = (int) h >= 24 ? h / 24 : 0
|
||||||
|
h = d > 0 ? h % 24 : h
|
||||||
|
|
||||||
|
sendEvent(name: "elapsedTimeDisplay", value: String.format("%dd %02d:%02d:%02d", d, h, m, s), displayed: false)
|
||||||
|
}
|
||||||
|
|
||||||
|
def off() {
|
||||||
|
zigbee.off()
|
||||||
|
}
|
||||||
|
|
||||||
|
def on() {
|
||||||
|
zigbee.on()
|
||||||
|
}
|
||||||
|
|
||||||
|
def resetEnergyUsage() {
|
||||||
|
sendEvent(name: "energy", value: 0.0, displayed: false)
|
||||||
|
state.timerStart = Calendar.getInstance().getTimeInMillis()
|
||||||
|
sendEvent(name: "energyDisplay", value: String.format("%6.3f kWh",0.0), displayed: false)
|
||||||
|
sendEvent(name: "elapsedTimeDisplay", value: String.format("%dd %02d:%02d:%02d", 0, 0, 0, 0), displayed: false)
|
||||||
|
}
|
||||||
|
|
||||||
|
def refresh() {
|
||||||
|
sendEvent(name: "heartbeat", value: "alive", displayed:false)
|
||||||
|
return zigbee.onOffRefresh() + zigbee.refreshData("0x0B04", "0x050B")
|
||||||
|
}
|
||||||
|
|
||||||
|
def configure() {
|
||||||
|
log.debug "Configuring..."
|
||||||
|
return zigbee.onOffConfig() + powerConfig() + refresh()
|
||||||
|
}
|
||||||
|
|
||||||
|
def updated() {
|
||||||
|
response(configure())
|
||||||
|
}
|
||||||
|
|
||||||
|
//power config for devices with min reporting interval as 1 seconds and reporting interval if no activity as 10min (600s)
|
||||||
|
//min change in value is 01
|
||||||
|
def powerConfig() {
|
||||||
|
[
|
||||||
|
"zdo bind 0x${device.deviceNetworkId} 1 ${endpointId} 0x0B04 {${device.zigbeeId}} {}", "delay 200",
|
||||||
|
"zcl global send-me-a-report 0x0B04 0x050B 0x29 ${intervalMin ?: 5} ${intervalMax ?: 600} {05 00}", //The send-me-a-report is custom to the attribute type for CentraLite
|
||||||
|
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
private getEndpointId() {
|
||||||
|
new BigInteger(device.endpointId, 16).toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO: Remove this after getKnownDescription can parse it automatically
|
||||||
|
def getPowerDescription(descMap) {
|
||||||
|
def powerValue = "undefined"
|
||||||
|
if (descMap.cluster == "0B04") {
|
||||||
|
if (descMap.attrId == "050b") {
|
||||||
|
if(descMap.value!="ffff")
|
||||||
|
powerValue = zigbee.convertHexToInt(descMap.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (descMap.clusterId == "0B04") {
|
||||||
|
if(descMap.command=="07"){
|
||||||
|
return [type: "update", value : "power (0B04) capability configured successfully"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (powerValue != "undefined"){
|
||||||
|
return [type: "power", value : powerValue]
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return [:]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,10 +22,9 @@ metadata {
|
|||||||
capability "Sensor"
|
capability "Sensor"
|
||||||
capability "Health Check"
|
capability "Health Check"
|
||||||
|
|
||||||
fingerprint mfr:"0063", prod:"4457", deviceJoinName: "GE In-Wall Smart Dimmer "
|
fingerprint mfr:"0063", prod:"4457", deviceJoinName: "Z-Wave Wall Dimmer"
|
||||||
fingerprint mfr:"0063", prod:"4944", deviceJoinName: "GE In-Wall Smart Dimmer "
|
fingerprint mfr:"0063", prod:"4944", deviceJoinName: "Z-Wave Wall Dimmer"
|
||||||
fingerprint mfr:"0063", prod:"5044", deviceJoinName: "GE Plug-In Smart Dimmer "
|
fingerprint mfr:"0063", prod:"5044", deviceJoinName: "Z-Wave Plug-In Dimmer"
|
||||||
fingerprint mfr:"0063", prod:"4944", model:"3034", deviceJoinName: "GE In-Wall Smart Fan Control"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
simulator {
|
simulator {
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ metadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def generatePresenceEvent(boolean present) {
|
def generatePresenceEvent(boolean present) {
|
||||||
log.info "Life360 generatePresenceEvent($present)"
|
log.debug "Here in generatePresenceEvent!"
|
||||||
def value = formatValue(present)
|
def value = formatValue(present)
|
||||||
def linkText = getLinkText(device)
|
def linkText = getLinkText(device)
|
||||||
def descriptionText = formatDescriptionText(linkText, present)
|
def descriptionText = formatDescriptionText(linkText, present)
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ private Map parseCatchAllMessage(String description) {
|
|||||||
if (cluster.command == 0x07) {
|
if (cluster.command == 0x07) {
|
||||||
if (cluster.data[0] == 0x00){
|
if (cluster.data[0] == 0x00){
|
||||||
log.debug "TEMP REPORTING CONFIG RESPONSE" + cluster
|
log.debug "TEMP REPORTING CONFIG RESPONSE" + cluster
|
||||||
resultMap = [name: "checkInterval", value: 60 * 12, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID]]
|
sendEvent(name: "checkInterval", value: 60 * 12, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID])
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log.warn "TEMP REPORTING CONFIG FAILED- error code:${cluster.data[0]}"
|
log.warn "TEMP REPORTING CONFIG FAILED- error code:${cluster.data[0]}"
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ private Map parseCatchAllMessage(String description) {
|
|||||||
if (cluster.command == 0x07) {
|
if (cluster.command == 0x07) {
|
||||||
if (cluster.data[0] == 0x00) {
|
if (cluster.data[0] == 0x00) {
|
||||||
log.debug "TEMP REPORTING CONFIG RESPONSE" + cluster
|
log.debug "TEMP REPORTING CONFIG RESPONSE" + cluster
|
||||||
resultMap = [name: "checkInterval", value: 60 * 12, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID]]
|
sendEvent(name: "checkInterval", value: 60 * 12, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID])
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log.warn "TEMP REPORTING CONFIG FAILED- error code:${cluster.data[0]}"
|
log.warn "TEMP REPORTING CONFIG FAILED- error code:${cluster.data[0]}"
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ private Map parseCatchAllMessage(String description) {
|
|||||||
if (cluster.command == 0x07) {
|
if (cluster.command == 0x07) {
|
||||||
if(cluster.data[0] == 0x00) {
|
if(cluster.data[0] == 0x00) {
|
||||||
log.debug "TEMP REPORTING CONFIG RESPONSE" + cluster
|
log.debug "TEMP REPORTING CONFIG RESPONSE" + cluster
|
||||||
resultMap = [name: "checkInterval", value: 60 * 12, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID]]
|
sendEvent(name: "checkInterval", value: 60 * 12, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID])
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log.warn "TEMP REPORTING CONFIG FAILED- error code:${cluster.data[0]}"
|
log.warn "TEMP REPORTING CONFIG FAILED- error code:${cluster.data[0]}"
|
||||||
@@ -339,7 +339,7 @@ private Map getContactResult(value) {
|
|||||||
log.debug "Contact: ${device.displayName} value = ${value}"
|
log.debug "Contact: ${device.displayName} value = ${value}"
|
||||||
def descriptionText = value == 'open' ? '{{ device.displayName }} was opened' : '{{ device.displayName }} was closed'
|
def descriptionText = value == 'open' ? '{{ device.displayName }} was opened' : '{{ device.displayName }} was closed'
|
||||||
sendEvent(name: 'contact', value: value, descriptionText: descriptionText, displayed: false, translatable: true)
|
sendEvent(name: 'contact', value: value, descriptionText: descriptionText, displayed: false, translatable: true)
|
||||||
return [name: 'status', value: value, descriptionText: descriptionText, translatable: true]
|
sendEvent(name: 'status', value: value, descriptionText: descriptionText, translatable: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
private getAccelerationResult(numValue) {
|
private getAccelerationResult(numValue) {
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ private Map parseCatchAllMessage(String description) {
|
|||||||
if (cluster.command == 0x07){
|
if (cluster.command == 0x07){
|
||||||
if (cluster.data[0] == 0x00) {
|
if (cluster.data[0] == 0x00) {
|
||||||
log.debug "TEMP REPORTING CONFIG RESPONSE" + cluster
|
log.debug "TEMP REPORTING CONFIG RESPONSE" + cluster
|
||||||
resultMap = [name: "checkInterval", value: 60 * 12, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID]]
|
sendEvent(name: "checkInterval", value: 60 * 12, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID])
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log.warn "TEMP REPORTING CONFIG FAILED- error code:${cluster.data[0]}"
|
log.warn "TEMP REPORTING CONFIG FAILED- error code:${cluster.data[0]}"
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ private Map parseCatchAllMessage(String description) {
|
|||||||
if (cluster.command == 0x07) {
|
if (cluster.command == 0x07) {
|
||||||
if (cluster.data[0] == 0x00){
|
if (cluster.data[0] == 0x00){
|
||||||
log.debug "TEMP REPORTING CONFIG RESPONSE" + cluster
|
log.debug "TEMP REPORTING CONFIG RESPONSE" + cluster
|
||||||
resultMap = [name: "checkInterval", value: 60 * 12, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID]]
|
sendEvent(name: "checkInterval", value: 60 * 12, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID])
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log.warn "TEMP REPORTING CONFIG FAILED- error code:${cluster.data[0]}"
|
log.warn "TEMP REPORTING CONFIG FAILED- error code:${cluster.data[0]}"
|
||||||
|
|||||||
@@ -127,8 +127,8 @@ def configureHealthCheck() {
|
|||||||
|
|
||||||
def configure() {
|
def configure() {
|
||||||
log.debug "configure()"
|
log.debug "configure()"
|
||||||
configureHealthCheck()
|
|
||||||
zigbee.onOffConfig() + zigbee.levelConfig() + zigbee.onOffRefresh() + zigbee.levelRefresh()
|
zigbee.onOffConfig() + zigbee.levelConfig() + zigbee.onOffRefresh() + zigbee.levelRefresh()
|
||||||
|
configureHealthCheck()
|
||||||
}
|
}
|
||||||
|
|
||||||
def updated() {
|
def updated() {
|
||||||
|
|||||||
@@ -24,10 +24,6 @@ metadata {
|
|||||||
fingerprint inClusters: "0x26", deviceJoinName: "Z-Wave Dimmer"
|
fingerprint inClusters: "0x26", deviceJoinName: "Z-Wave Dimmer"
|
||||||
fingerprint mfr:"001D", prod:"1902", 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:"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 {
|
simulator {
|
||||||
|
|||||||
@@ -25,9 +25,6 @@ metadata {
|
|||||||
fingerprint mfr:"0063", prod:"4F50", model:"3031", deviceJoinName: "GE Plug-in Outdoor Switch"
|
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:"1D04", model:"0334", deviceJoinName: "Leviton Outlet"
|
||||||
fingerprint mfr:"001D", prod:"1C02", model:"0334", deviceJoinName: "Leviton Switch"
|
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
|
// simulator metadata
|
||||||
|
|||||||
@@ -289,12 +289,12 @@ def initializeLife360Connection() {
|
|||||||
state.life360AccessToken = result.data.access_token
|
state.life360AccessToken = result.data.access_token
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
log.info "Life360 initializeLife360Connection, response=${result.data}"
|
log.debug "Response=${result.data}"
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
log.error "Life360 initializeLife360Connection, error: $e"
|
log.debug e
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -656,7 +656,7 @@ def generateInitialEvent (member, childDevice) {
|
|||||||
|
|
||||||
try { // we are going to just ignore any errors
|
try { // we are going to just ignore any errors
|
||||||
|
|
||||||
log.info "Life360 generateInitialEvent($member, $childDevice)"
|
log.debug "Generate Initial Event for New Device for Member = ${member.id}"
|
||||||
|
|
||||||
def place = state.places.find{it.id==settings.place}
|
def place = state.places.find{it.id==settings.place}
|
||||||
|
|
||||||
@@ -677,8 +677,6 @@ def generateInitialEvent (member, childDevice) {
|
|||||||
// log.debug "Distance Away = ${distanceAway}"
|
// log.debug "Distance Away = ${distanceAway}"
|
||||||
|
|
||||||
boolean isPresent = (distanceAway <= placeRadius)
|
boolean isPresent = (distanceAway <= placeRadius)
|
||||||
|
|
||||||
log.info "Life360 generateInitialEvent, member: ($memberLatitude, $memberLongitude), place: ($placeLatitude, $placeLongitude), radius: $placeRadius, dist: $distanceAway, present: $isPresent"
|
|
||||||
|
|
||||||
// log.debug "External Id=${app.id}:${member.id}"
|
// log.debug "External Id=${app.id}:${member.id}"
|
||||||
|
|
||||||
@@ -720,7 +718,7 @@ def haversine(lat1, lon1, lat2, lon2) {
|
|||||||
|
|
||||||
def placeEventHandler() {
|
def placeEventHandler() {
|
||||||
|
|
||||||
log.info "Life360 placeEventHandler: params=$params, settings.place=$settings.place"
|
log.debug "In placeEventHandler method."
|
||||||
|
|
||||||
// the POST to this end-point will look like:
|
// the POST to this end-point will look like:
|
||||||
// POST http://test.com/webhook?circleId=XXXX&placeId=XXXX&userId=XXXX&direction=arrive
|
// POST http://test.com/webhook?circleId=XXXX&placeId=XXXX&userId=XXXX&direction=arrive
|
||||||
@@ -731,6 +729,8 @@ def placeEventHandler() {
|
|||||||
def direction = params?.direction
|
def direction = params?.direction
|
||||||
def timestamp = params?.timestamp
|
def timestamp = params?.timestamp
|
||||||
|
|
||||||
|
log.debug "Life360 Event: Circle: ${circleId}, Place: ${placeId}, User: ${userId}, Direction: ${direction}"
|
||||||
|
|
||||||
if (placeId == settings.place) {
|
if (placeId == settings.place) {
|
||||||
|
|
||||||
def presenceState = (direction=="in")
|
def presenceState = (direction=="in")
|
||||||
@@ -745,10 +745,10 @@ def placeEventHandler() {
|
|||||||
|
|
||||||
if (deviceWrapper) {
|
if (deviceWrapper) {
|
||||||
deviceWrapper.generatePresenceEvent(presenceState)
|
deviceWrapper.generatePresenceEvent(presenceState)
|
||||||
log.debug "Life360 event raised on child device: ${externalId}"
|
log.debug "Event raised on child device: ${externalId}"
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log.warn "Life360 couldn't find child device associated with inbound Life360 event."
|
log.debug "Couldn't find child device associated with inbound Life360 event."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user