mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-09 05:11:52 +00:00
Compare commits
26 Commits
master_old
...
MSA-727-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9318e9a311 | ||
|
|
e1c52454c6 | ||
|
|
145fce2062 | ||
|
|
e9996b9fd7 | ||
|
|
8be585e544 | ||
|
|
e114fafd56 | ||
|
|
e6367a7832 | ||
|
|
c5da3fe4a0 | ||
|
|
1b9d2fe9ce | ||
|
|
90dee51255 | ||
|
|
7b7fdd43cd | ||
|
|
9059718818 | ||
|
|
9d7c66c7af | ||
|
|
8e81967227 | ||
|
|
290e8e4129 | ||
|
|
8c6c68f102 | ||
|
|
661f8b3bc0 | ||
|
|
a62d825f69 | ||
|
|
1890147221 | ||
|
|
2fb5f8c78c | ||
|
|
b44356248c | ||
|
|
c30af84d70 | ||
|
|
5cf72c644c | ||
|
|
8ae9b06022 | ||
|
|
71fc8e7f5f | ||
|
|
30dedde0df |
@@ -15,6 +15,7 @@
|
||||
* Author: SmartThings
|
||||
* Date: 2013-12-04
|
||||
*/
|
||||
//DEPRECATED - Using the generic DTH for this device. Users need to be moved before deleting this DTH
|
||||
metadata {
|
||||
definition (name: "CentraLite Dimmer", namespace: "smartthings", author: "SmartThings") {
|
||||
capability "Switch Level"
|
||||
@@ -25,7 +26,6 @@ metadata {
|
||||
capability "Refresh"
|
||||
capability "Sensor"
|
||||
|
||||
fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0B04,0B05", outClusters: "0019"
|
||||
}
|
||||
|
||||
// simulator metadata
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* Ecobee Sensor
|
||||
*
|
||||
* Copyright 2015 Juan Risso
|
||||
*
|
||||
* 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 {
|
||||
definition (name: "Ecobee Sensor", namespace: "smartthings", author: "SmartThings") {
|
||||
capability "Sensor"
|
||||
capability "Temperature Measurement"
|
||||
capability "Motion Sensor"
|
||||
capability "Refresh"
|
||||
capability "Polling"
|
||||
}
|
||||
|
||||
simulator {
|
||||
// TODO: define status and reply messages here
|
||||
}
|
||||
|
||||
tiles {
|
||||
valueTile("temperature", "device.temperature", width: 2, height: 2) {
|
||||
state("temperature", label:'${currentValue}°', unit:"F",
|
||||
backgroundColors:[
|
||||
[value: 31, color: "#153591"],
|
||||
[value: 44, color: "#1e9cbb"],
|
||||
[value: 59, color: "#90d2a7"],
|
||||
[value: 74, color: "#44b621"],
|
||||
[value: 84, color: "#f1d801"],
|
||||
[value: 95, color: "#d04e00"],
|
||||
[value: 96, color: "#bc2323"]
|
||||
]
|
||||
)
|
||||
}
|
||||
|
||||
standardTile("motion", "device.motion") {
|
||||
state("active", label:'motion', icon:"st.motion.motion.active", backgroundColor:"#53a7c0")
|
||||
state("inactive", label:'no motion', icon:"st.motion.motion.inactive", backgroundColor:"#ffffff")
|
||||
}
|
||||
|
||||
standardTile("refresh", "device.refresh", inactiveLabel: false, decoration: "flat") {
|
||||
state "default", action:"refresh.refresh", icon:"st.secondary.refresh"
|
||||
}
|
||||
|
||||
main (["temperature","motion"])
|
||||
details(["temperature","motion","refresh"])
|
||||
}
|
||||
}
|
||||
|
||||
def refresh() {
|
||||
log.debug "refresh..."
|
||||
poll()
|
||||
}
|
||||
|
||||
void poll() {
|
||||
log.debug "Executing 'poll' using parent SmartApp"
|
||||
parent.pollChildren(this)
|
||||
}
|
||||
|
||||
//generate custom mobile activity feeds event
|
||||
def generateActivityFeedsEvent(notificationMessage) {
|
||||
sendEvent(name: "notificationMessage", value: "$device.displayName $notificationMessage", descriptionText: "$device.displayName $notificationMessage", displayed: true)
|
||||
}
|
||||
@@ -22,31 +22,31 @@ metadata {
|
||||
capability "Polling"
|
||||
capability "Sensor"
|
||||
capability "Refresh"
|
||||
|
||||
|
||||
command "generateEvent"
|
||||
command "raiseSetpoint"
|
||||
command "lowerSetpoint"
|
||||
command "resumeProgram"
|
||||
command "switchMode"
|
||||
|
||||
|
||||
attribute "thermostatSetpoint","number"
|
||||
attribute "thermostatStatus","string"
|
||||
}
|
||||
|
||||
simulator { }
|
||||
|
||||
tiles {
|
||||
|
||||
tiles {
|
||||
valueTile("temperature", "device.temperature", width: 2, height: 2) {
|
||||
state("temperature", label:'${currentValue}°', unit:"F",
|
||||
backgroundColors:[
|
||||
[value: 31, color: "#153591"],
|
||||
[value: 44, color: "#1e9cbb"],
|
||||
[value: 59, color: "#90d2a7"],
|
||||
[value: 74, color: "#44b621"],
|
||||
[value: 84, color: "#f1d801"],
|
||||
[value: 95, color: "#d04e00"],
|
||||
[value: 96, color: "#bc2323"]
|
||||
]
|
||||
backgroundColors:[
|
||||
[value: 31, color: "#153591"],
|
||||
[value: 44, color: "#1e9cbb"],
|
||||
[value: 59, color: "#90d2a7"],
|
||||
[value: 74, color: "#44b621"],
|
||||
[value: 84, color: "#f1d801"],
|
||||
[value: 95, color: "#d04e00"],
|
||||
[value: 96, color: "#bc2323"]
|
||||
]
|
||||
)
|
||||
}
|
||||
standardTile("mode", "device.thermostatMode", inactiveLabel: false, decoration: "flat") {
|
||||
@@ -54,27 +54,27 @@ metadata {
|
||||
state "heat", action:"switchMode", nextState: "updating", icon: "st.thermostat.heat"
|
||||
state "cool", action:"switchMode", nextState: "updating", icon: "st.thermostat.cool"
|
||||
state "auto", action:"switchMode", nextState: "updating", icon: "st.thermostat.auto"
|
||||
state "auxHeatOnly", action:"switchMode", icon: "st.thermostat.emergency-heat"
|
||||
state "updating", label:"Working", icon: "st.secondary.secondary"
|
||||
state "auxHeatOnly", action:"switchMode", icon: "st.thermostat.emergency-heat"
|
||||
state "updating", label:"Working", icon: "st.secondary.secondary"
|
||||
}
|
||||
standardTile("fanMode", "device.thermostatFanMode", inactiveLabel: false, decoration: "flat") {
|
||||
state "auto", label:'Fan: ${currentValue}', action:"switchFanMode", nextState: "on"
|
||||
state "on", label:'Fan: ${currentValue}', action:"switchFanMode", nextState: "off"
|
||||
state "off", label:'Fan: ${currentValue}', action:"switchFanMode", nextState: "circulate"
|
||||
state "off", label:'Fan: ${currentValue}', action:"switchFanMode", nextState: "circulate"
|
||||
state "circulate", label:'Fan: ${currentValue}', action:"switchFanMode", nextState: "auto"
|
||||
}
|
||||
standardTile("upButtonControl", "device.thermostatSetpoint", inactiveLabel: false, decoration: "flat") {
|
||||
state "setpoint", action:"raiseSetpoint", backgroundColor:"#d04e00", icon:"st.thermostat.thermostat-up"
|
||||
standardTile("upButtonControl", "device.thermostatSetpoint", inactiveLabel: false, decoration: "flat") {
|
||||
state "setpoint", action:"raiseSetpoint", icon:"st.thermostat.thermostat-up"
|
||||
}
|
||||
valueTile("thermostatSetpoint", "device.thermostatSetpoint", width: 1, height: 1, decoration: "flat") {
|
||||
state "thermostatSetpoint", label:'${currentValue}'
|
||||
valueTile("thermostatSetpoint", "device.thermostatSetpoint", width: 1, height: 1, decoration: "flat") {
|
||||
state "thermostatSetpoint", label:'${currentValue}°'
|
||||
}
|
||||
valueTile("currentStatus", "device.thermostatStatus", height: 1, width: 2, decoration: "flat") {
|
||||
state "thermostatStatus", label:'${currentValue}', backgroundColor:"#ffffff"
|
||||
}
|
||||
}
|
||||
standardTile("downButtonControl", "device.thermostatSetpoint", inactiveLabel: false, decoration: "flat") {
|
||||
state "setpoint", action:"lowerSetpoint", backgroundColor:"#d04e00", icon:"st.thermostat.thermostat-down"
|
||||
}
|
||||
state "setpoint", action:"lowerSetpoint", icon:"st.thermostat.thermostat-down"
|
||||
}
|
||||
controlTile("heatSliderControl", "device.heatingSetpoint", "slider", height: 1, width: 2, inactiveLabel: false) {
|
||||
state "setHeatingSetpoint", action:"thermostat.setHeatingSetpoint", backgroundColor:"#d04e00"
|
||||
}
|
||||
@@ -91,218 +91,196 @@ metadata {
|
||||
state "default", action:"refresh.refresh", icon:"st.secondary.refresh"
|
||||
}
|
||||
standardTile("resumeProgram", "device.resumeProgram", inactiveLabel: false, decoration: "flat") {
|
||||
state "resume", label:'Resume Program', action:"device.resumeProgram", icon:"st.sonos.play-icon"
|
||||
state "resume", action:"resumeProgram", nextState: "updating", label:'Resume Schedule', icon:"st.samsung.da.oven_ic_send"
|
||||
state "updating", label:"Working", icon: "st.secondary.secondary"
|
||||
}
|
||||
main "temperature"
|
||||
details(["temperature", "upButtonControl", "thermostatSetpoint", "currentStatus", "downButtonControl", "mode", "resumeProgram", "refresh"])
|
||||
details(["temperature", "upButtonControl", "thermostatSetpoint", "currentStatus", "downButtonControl", "mode", "resumeProgram", "refresh"])
|
||||
}
|
||||
|
||||
preferences {
|
||||
input "holdType", "enum", title: "Hold Type", description: "When changing temperature, use Temporary or Permanent hold", required: false, options:["Temporary", "Permanent"]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
preferences {
|
||||
input "highTemperature", "number", title: "Auto Mode High Temperature:", defaultValue: 80
|
||||
input "lowTemperature", "number", title: "Auto Mode Low Temperature:", defaultValue: 70
|
||||
input name: "holdType", type: "enum", title: "Hold Type", description: "When changing temperature, use Temporary or Permanent hold", required: true, options:["Temporary", "Permanent"]
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
// parse events into attributes
|
||||
def parse(String description) {
|
||||
log.debug "Parsing '${description}'"
|
||||
// TODO: handle '' attribute
|
||||
|
||||
|
||||
}
|
||||
|
||||
def refresh()
|
||||
{
|
||||
log.debug "refresh called"
|
||||
poll()
|
||||
log.debug "refresh ended"
|
||||
def refresh() {
|
||||
log.debug "refresh called"
|
||||
poll()
|
||||
log.debug "refresh ended"
|
||||
}
|
||||
|
||||
def go()
|
||||
{
|
||||
log.debug "before:go tile tapped"
|
||||
poll()
|
||||
log.debug "after"
|
||||
}
|
||||
|
||||
|
||||
void poll() {
|
||||
log.debug "Executing 'poll' using parent SmartApp"
|
||||
|
||||
|
||||
def results = parent.pollChild(this)
|
||||
parseEventData(results)
|
||||
generateStatusEvent()
|
||||
generateEvent(results) //parse received message from parent
|
||||
}
|
||||
|
||||
def parseEventData(Map results)
|
||||
{
|
||||
|
||||
def generateEvent(Map results) {
|
||||
log.debug "parsing data $results"
|
||||
if(results)
|
||||
{
|
||||
results.each { name, value ->
|
||||
|
||||
if(results) {
|
||||
results.each { name, value ->
|
||||
|
||||
def linkText = getLinkText(device)
|
||||
def isChange = false
|
||||
def isDisplayed = true
|
||||
|
||||
if (name=="temperature" || name=="heatingSetpoint" || name=="coolingSetpoint") {
|
||||
isChange = isTemperatureStateChange(device, name, value.toString())
|
||||
isDisplayed = isChange
|
||||
|
||||
sendEvent(
|
||||
name: name,
|
||||
value: value,
|
||||
unit: "F",
|
||||
linkText: linkText,
|
||||
descriptionText: getThermostatDescriptionText(name, value, linkText),
|
||||
handlerName: name,
|
||||
isStateChange: isChange,
|
||||
displayed: isDisplayed)
|
||||
|
||||
}
|
||||
else {
|
||||
isChange = isStateChange(device, name, value.toString())
|
||||
isDisplayed = isChange
|
||||
|
||||
sendEvent(
|
||||
name: name,
|
||||
value: value.toString(),
|
||||
linkText: linkText,
|
||||
descriptionText: getThermostatDescriptionText(name, value, linkText),
|
||||
handlerName: name,
|
||||
isStateChange: isChange,
|
||||
displayed: isDisplayed)
|
||||
|
||||
}
|
||||
}
|
||||
generateSetpointEvent ()
|
||||
generateStatusEvent ()
|
||||
}
|
||||
}
|
||||
def isChange = false
|
||||
def isDisplayed = true
|
||||
def event = [name: name, linkText: linkText, descriptionText: getThermostatDescriptionText(name, value, linkText),
|
||||
handlerName: name]
|
||||
|
||||
void generateEvent(Map results)
|
||||
{
|
||||
log.debug "parsing data $results"
|
||||
if(results)
|
||||
{
|
||||
results.each { name, value ->
|
||||
|
||||
def linkText = getLinkText(device)
|
||||
def isChange = false
|
||||
def isDisplayed = true
|
||||
|
||||
if (name=="temperature" || name=="heatingSetpoint" || name=="coolingSetpoint") {
|
||||
if (name=="temperature" || name=="heatingSetpoint" || name=="coolingSetpoint") {
|
||||
def sendValue = value? convertTemperatureIfNeeded(value.toDouble(), "F", 1): value //API return temperature value in F
|
||||
isChange = isTemperatureStateChange(device, name, value.toString())
|
||||
isDisplayed = isChange
|
||||
|
||||
sendEvent(
|
||||
name: name,
|
||||
value: value,
|
||||
unit: "F",
|
||||
linkText: linkText,
|
||||
descriptionText: getThermostatDescriptionText(name, value, linkText),
|
||||
handlerName: name,
|
||||
isStateChange: isChange,
|
||||
displayed: isDisplayed)
|
||||
}
|
||||
else {
|
||||
isChange = isStateChange(device, name, value.toString())
|
||||
isDisplayed = isChange
|
||||
|
||||
sendEvent(
|
||||
name: name,
|
||||
value: value.toString(),
|
||||
linkText: linkText,
|
||||
descriptionText: getThermostatDescriptionText(name, value, linkText),
|
||||
handlerName: name,
|
||||
isStateChange: isChange,
|
||||
displayed: isDisplayed)
|
||||
|
||||
}
|
||||
isDisplayed = isChange
|
||||
event << [value: sendValue, isStateChange: isChange, displayed: isDisplayed]
|
||||
} else if (name=="heatMode" || name=="coolMode" || name=="autoMode" || name=="auxHeatMode"){
|
||||
isChange = isStateChange(device, name, value.toString())
|
||||
event << [value: value.toString(), isStateChange: isChange, displayed: false]
|
||||
} else {
|
||||
isChange = isStateChange(device, name, value.toString())
|
||||
isDisplayed = isChange
|
||||
event << [value: value.toString(), isStateChange: isChange, displayed: isDisplayed]
|
||||
}
|
||||
sendEvent(event)
|
||||
}
|
||||
generateSetpointEvent ()
|
||||
generateStatusEvent()
|
||||
generateSetpointEvent ()
|
||||
generateStatusEvent ()
|
||||
}
|
||||
}
|
||||
|
||||
private getThermostatDescriptionText(name, value, linkText)
|
||||
{
|
||||
if(name == "temperature")
|
||||
{
|
||||
return "$linkText was $value°F"
|
||||
|
||||
//return descriptionText to be shown on mobile activity feed
|
||||
private getThermostatDescriptionText(name, value, linkText) {
|
||||
if(name == "temperature") {
|
||||
return "$linkText temperature is $value°F"
|
||||
|
||||
} else if(name == "heatingSetpoint") {
|
||||
return "heating setpoint is $value°F"
|
||||
|
||||
} else if(name == "coolingSetpoint"){
|
||||
return "cooling setpoint is $value°F"
|
||||
|
||||
} else if (name == "thermostatMode") {
|
||||
return "thermostat mode is ${value}"
|
||||
|
||||
} else if (name == "thermostatFanMode") {
|
||||
return "thermostat fan mode is ${value}"
|
||||
|
||||
} else {
|
||||
return "${name} = ${value}"
|
||||
}
|
||||
else if(name == "heatingSetpoint")
|
||||
{
|
||||
return "latest heating setpoint was $value°F"
|
||||
}
|
||||
|
||||
void setHeatingSetpoint(setpoint) {
|
||||
setHeatingSetpoint(setpoint.toDouble())
|
||||
}
|
||||
|
||||
void setHeatingSetpoint(Double setpoint) {
|
||||
// def mode = device.currentValue("thermostatMode")
|
||||
def heatingSetpoint = setpoint
|
||||
def coolingSetpoint = device.currentValue("coolingSetpoint").toDouble()
|
||||
def deviceId = device.deviceNetworkId.split(/\./).last()
|
||||
|
||||
//enforce limits of heatingSetpoint
|
||||
if (heatingSetpoint > 79) {
|
||||
heatingSetpoint = 79
|
||||
} else if (heatingSetpoint < 45) {
|
||||
heatingSetpoint = 45
|
||||
}
|
||||
else if(name == "coolingSetpoint")
|
||||
{
|
||||
return "latest cooling setpoint was $value°F"
|
||||
|
||||
//enforce limits of heatingSetpoint vs coolingSetpoint
|
||||
if (heatingSetpoint >= coolingSetpoint) {
|
||||
coolingSetpoint = heatingSetpoint
|
||||
}
|
||||
|
||||
log.debug "Sending setHeatingSetpoint> coolingSetpoint: ${coolingSetpoint}, heatingSetpoint: ${heatingSetpoint}"
|
||||
|
||||
def sendHoldType = holdType ? (holdType=="Temporary")? "nextTransition" : (holdType=="Permanent")? "indefinite" : "indefinite" : "indefinite"
|
||||
if (parent.setHold (this, heatingSetpoint, coolingSetpoint, deviceId, sendHoldType)) {
|
||||
sendEvent("name":"heatingSetpoint", "value":heatingSetpoint)
|
||||
sendEvent("name":"coolingSetpoint", "value":coolingSetpoint)
|
||||
log.debug "Done setHeatingSetpoint> coolingSetpoint: ${coolingSetpoint}, heatingSetpoint: ${heatingSetpoint}"
|
||||
generateSetpointEvent()
|
||||
generateStatusEvent()
|
||||
} else {
|
||||
log.error "Error setHeatingSetpoint(setpoint)" //This error is handled by the connect app
|
||||
}
|
||||
else if (name == "thermostatMode")
|
||||
{
|
||||
return "thermostat mode is ${value}"
|
||||
}
|
||||
else
|
||||
{
|
||||
return "${name} = ${value}"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void setHeatingSetpoint(degreesF) {
|
||||
setHeatingSetpoint(degreesF.toDouble())
|
||||
void setCoolingSetpoint(setpoint) {
|
||||
setCoolingSetpoint(setpoint.toDouble())
|
||||
}
|
||||
|
||||
void setHeatingSetpoint(Double degreesF) {
|
||||
log.debug "setHeatingSetpoint({$degreesF})"
|
||||
sendEvent("name":"heatingSetpoint", "value":degreesF)
|
||||
Double coolingSetpoint = device.currentValue("coolingSetpoint")
|
||||
log.debug "coolingSetpoint: $coolingSetpoint"
|
||||
parent.setHold(this, degreesF, coolingSetpoint)
|
||||
void setCoolingSetpoint(Double setpoint) {
|
||||
// def mode = device.currentValue("thermostatMode")
|
||||
def heatingSetpoint = device.currentValue("heatingSetpoint").toDouble()
|
||||
def coolingSetpoint = setpoint
|
||||
def deviceId = device.deviceNetworkId.split(/\./).last()
|
||||
|
||||
if (coolingSetpoint > 92) {
|
||||
coolingSetpoint = 92
|
||||
} else if (coolingSetpoint < 65) {
|
||||
coolingSetpoint = 65
|
||||
}
|
||||
|
||||
//enforce limits of heatingSetpoint vs coolingSetpoint
|
||||
if (heatingSetpoint >= coolingSetpoint) {
|
||||
heatingSetpoint = coolingSetpoint
|
||||
}
|
||||
|
||||
log.debug "Sending setCoolingSetpoint> coolingSetpoint: ${coolingSetpoint}, heatingSetpoint: ${heatingSetpoint}"
|
||||
|
||||
def sendHoldType = holdType ? (holdType=="Temporary")? "nextTransition" : (holdType=="Permanent")? "indefinite" : "indefinite" : "indefinite"
|
||||
if (parent.setHold (this, heatingSetpoint, coolingSetpoint, deviceId, sendHoldType)) {
|
||||
sendEvent("name":"heatingSetpoint", "value":heatingSetpoint)
|
||||
sendEvent("name":"coolingSetpoint", "value":coolingSetpoint)
|
||||
log.debug "Done setCoolingSetpoint>> coolingSetpoint = ${coolingSetpoint}, heatingSetpoint = ${heatingSetpoint}"
|
||||
generateSetpointEvent()
|
||||
generateStatusEvent()
|
||||
} else {
|
||||
log.error "Error setCoolingSetpoint(setpoint)" //This error is handled by the connect app
|
||||
}
|
||||
}
|
||||
|
||||
void setCoolingSetpoint(degreesF) {
|
||||
setCoolingSetpoint(degreesF.toDouble())
|
||||
}
|
||||
void resumeProgram() {
|
||||
|
||||
void setCoolingSetpoint(Double degreesF) {
|
||||
log.debug "setCoolingSetpoint({$degreesF})"
|
||||
sendEvent("name":"coolingSetpoint", "value":degreesF)
|
||||
Double heatingSetpoint = device.currentValue("heatingSetpoint")
|
||||
parent.setHold(this, heatingSetpoint, degreesF)
|
||||
}
|
||||
log.debug "resumeProgram() is called"
|
||||
sendEvent("name":"thermostatStatus", "value":"resuming schedule", "description":statusText, displayed: false)
|
||||
def deviceId = device.deviceNetworkId.split(/\./).last()
|
||||
if (parent.resumeProgram(this, deviceId)) {
|
||||
sendEvent("name":"thermostatStatus", "value":"setpoint is updating", "description":statusText, displayed: false)
|
||||
runIn(5, "poll")
|
||||
log.debug "resumeProgram() is done"
|
||||
sendEvent("name":"resumeProgram", "value":"resume", descriptionText: "resumeProgram is done", displayed: false, isStateChange: true)
|
||||
} else {
|
||||
sendEvent("name":"thermostatStatus", "value":"failed resume click refresh", "description":statusText, displayed: false)
|
||||
log.error "Error resumeProgram() check parent.resumeProgram(this, deviceId)"
|
||||
}
|
||||
|
||||
def configure() {
|
||||
|
||||
}
|
||||
|
||||
def resumeProgram() {
|
||||
parent.resumeProgram(this)
|
||||
}
|
||||
|
||||
def modes() {
|
||||
if (state.modes) {
|
||||
log.debug "Modes = ${state.modes}"
|
||||
return state.modes
|
||||
}
|
||||
else {
|
||||
state.modes = parent.availableModes(this)
|
||||
log.debug "Modes = ${state.modes}"
|
||||
return state.modes
|
||||
}
|
||||
log.debug "Modes = ${state.modes}"
|
||||
return state.modes
|
||||
}
|
||||
else {
|
||||
state.modes = parent.availableModes(this)
|
||||
log.debug "Modes = ${state.modes}"
|
||||
return state.modes
|
||||
}
|
||||
}
|
||||
|
||||
def fanModes() {
|
||||
["off", "on", "auto", "circulate"]
|
||||
}
|
||||
|
||||
|
||||
def switchMode() {
|
||||
log.debug "in switchMode"
|
||||
def currentMode = device.currentState("thermostatMode")?.value
|
||||
@@ -314,7 +292,7 @@ def switchMode() {
|
||||
}
|
||||
|
||||
def switchToMode(nextMode) {
|
||||
log.debug "In switchToMode = ${nextMode}"
|
||||
log.debug "In switchToMode = ${nextMode}"
|
||||
if (nextMode in modes()) {
|
||||
state.lastTriedMode = nextMode
|
||||
"$nextMode"()
|
||||
@@ -376,300 +354,326 @@ def getDataByName(String name) {
|
||||
|
||||
def setThermostatMode(String value) {
|
||||
log.debug "setThermostatMode({$value})"
|
||||
|
||||
|
||||
}
|
||||
|
||||
def setThermostatFanMode(String value) {
|
||||
|
||||
log.debug "setThermostatFanMode({$value})"
|
||||
|
||||
|
||||
}
|
||||
|
||||
def generateModeEvent(mode) {
|
||||
|
||||
sendEvent(name: "thermostatMode", value: mode, descriptionText: "$device.displayName is in ${mode} mode", displayed: true, isStateChange: true)
|
||||
|
||||
sendEvent(name: "thermostatMode", value: mode, descriptionText: "$device.displayName is in ${mode} mode", displayed: true)
|
||||
}
|
||||
|
||||
def generateFanModeEvent(fanMode) {
|
||||
|
||||
sendEvent(name: "thermostatFanMode", value: fanMode, descriptionText: "$device.displayName fan is in ${mode} mode", displayed: true, isStateChange: true)
|
||||
|
||||
sendEvent(name: "thermostatFanMode", value: fanMode, descriptionText: "$device.displayName fan is in ${mode} mode", displayed: true)
|
||||
}
|
||||
|
||||
def generateOperatingStateEvent(operatingState) {
|
||||
|
||||
sendEvent(name: "thermostatOperatingState", value: operatingState, descriptionText: "$device.displayName is ${operatingState}", displayed: true, isStateChange: true)
|
||||
|
||||
sendEvent(name: "thermostatOperatingState", value: operatingState, descriptionText: "$device.displayName is ${operatingState}", displayed: true)
|
||||
}
|
||||
|
||||
def off() {
|
||||
log.debug "off"
|
||||
generateModeEvent("off")
|
||||
if (parent.setMode (this,"off"))
|
||||
generateModeEvent("off")
|
||||
else {
|
||||
log.debug "Error setting new mode."
|
||||
def currentMode = device.currentState("thermostatMode")?.value
|
||||
generateModeEvent(currentMode) // reset the tile back
|
||||
}
|
||||
generateSetpointEvent()
|
||||
generateStatusEvent()
|
||||
|
||||
def deviceId = device.deviceNetworkId.split(/\./).last()
|
||||
if (parent.setMode (this,"off", deviceId))
|
||||
generateModeEvent("off")
|
||||
else {
|
||||
log.debug "Error setting new mode."
|
||||
def currentMode = device.currentState("thermostatMode")?.value
|
||||
generateModeEvent(currentMode) // reset the tile back
|
||||
}
|
||||
generateSetpointEvent()
|
||||
generateStatusEvent()
|
||||
}
|
||||
|
||||
def heat() {
|
||||
log.debug "heat"
|
||||
generateModeEvent("heat")
|
||||
if (parent.setMode (this,"heat"))
|
||||
generateModeEvent("heat")
|
||||
else {
|
||||
log.debug "Error setting new mode."
|
||||
def currentMode = device.currentState("thermostatMode")?.value
|
||||
generateModeEvent(currentMode) // reset the tile back
|
||||
}
|
||||
generateSetpointEvent()
|
||||
generateStatusEvent()
|
||||
def deviceId = device.deviceNetworkId.split(/\./).last()
|
||||
if (parent.setMode (this,"heat", deviceId))
|
||||
generateModeEvent("heat")
|
||||
else {
|
||||
log.debug "Error setting new mode."
|
||||
def currentMode = device.currentState("thermostatMode")?.value
|
||||
generateModeEvent(currentMode) // reset the tile back
|
||||
}
|
||||
generateSetpointEvent()
|
||||
generateStatusEvent()
|
||||
}
|
||||
|
||||
def auxHeatOnly() {
|
||||
log.debug "auxHeatOnly"
|
||||
generateModeEvent("auxHeatOnly")
|
||||
if (parent.setMode (this,"auxHeatOnly"))
|
||||
generateModeEvent("auxHeatOnly")
|
||||
else {
|
||||
log.debug "Error setting new mode."
|
||||
def currentMode = device.currentState("thermostatMode")?.value
|
||||
generateModeEvent(currentMode) // reset the tile back
|
||||
}
|
||||
generateSetpointEvent()
|
||||
generateStatusEvent()
|
||||
def deviceId = device.deviceNetworkId.split(/\./).last()
|
||||
if (parent.setMode (this,"auxHeatOnly", deviceId))
|
||||
generateModeEvent("auxHeatOnly")
|
||||
else {
|
||||
log.debug "Error setting new mode."
|
||||
def currentMode = device.currentState("thermostatMode")?.value
|
||||
generateModeEvent(currentMode) // reset the tile back
|
||||
}
|
||||
generateSetpointEvent()
|
||||
generateStatusEvent()
|
||||
}
|
||||
|
||||
def cool() {
|
||||
log.debug "cool"
|
||||
generateModeEvent("cool")
|
||||
if (parent.setMode (this,"cool"))
|
||||
generateModeEvent("cool")
|
||||
else {
|
||||
log.debug "Error setting new mode."
|
||||
def currentMode = device.currentState("thermostatMode")?.value
|
||||
generateModeEvent(currentMode) // reset the tile back
|
||||
}
|
||||
generateSetpointEvent()
|
||||
generateStatusEvent()
|
||||
def deviceId = device.deviceNetworkId.split(/\./).last()
|
||||
if (parent.setMode (this,"cool", deviceId))
|
||||
generateModeEvent("cool")
|
||||
else {
|
||||
log.debug "Error setting new mode."
|
||||
def currentMode = device.currentState("thermostatMode")?.value
|
||||
generateModeEvent(currentMode) // reset the tile back
|
||||
}
|
||||
generateSetpointEvent()
|
||||
generateStatusEvent()
|
||||
}
|
||||
|
||||
def auto() {
|
||||
log.debug "auto"
|
||||
generateModeEvent("auto")
|
||||
if (parent.setMode (this,"auto"))
|
||||
generateModeEvent("auto")
|
||||
else {
|
||||
log.debug "Error setting new mode."
|
||||
def currentMode = device.currentState("thermostatMode")?.value
|
||||
generateModeEvent(currentMode) // reset the tile back
|
||||
}
|
||||
generateSetpointEvent()
|
||||
generateStatusEvent()
|
||||
def deviceId = device.deviceNetworkId.split(/\./).last()
|
||||
if (parent.setMode (this,"auto", deviceId))
|
||||
generateModeEvent("auto")
|
||||
else {
|
||||
log.debug "Error setting new mode."
|
||||
def currentMode = device.currentState("thermostatMode")?.value
|
||||
generateModeEvent(currentMode) // reset the tile back
|
||||
}
|
||||
generateSetpointEvent()
|
||||
generateStatusEvent()
|
||||
}
|
||||
|
||||
def fanOn() {
|
||||
log.debug "fanOn"
|
||||
parent.setFanMode (this,"on")
|
||||
|
||||
// parent.setFanMode (this,"on")
|
||||
|
||||
}
|
||||
|
||||
def fanAuto() {
|
||||
log.debug "fanAuto"
|
||||
parent.setFanMode (this,"auto")
|
||||
|
||||
// parent.setFanMode (this,"auto")
|
||||
|
||||
}
|
||||
|
||||
def fanCirculate() {
|
||||
log.debug "fanCirculate"
|
||||
parent.setFanMode (this,"circulate")
|
||||
|
||||
// parent.setFanMode (this,"circulate")
|
||||
|
||||
}
|
||||
|
||||
def fanOff() {
|
||||
log.debug "fanOff"
|
||||
parent.setFanMode (this,"off")
|
||||
|
||||
// parent.setFanMode (this,"off")
|
||||
|
||||
}
|
||||
|
||||
def generateSetpointEvent() {
|
||||
|
||||
log.debug "Generate SetPoint Event"
|
||||
log.debug "Generate SetPoint Event"
|
||||
|
||||
def mode = device.currentValue("thermostatMode")
|
||||
log.debug "Current Mode = ${mode}"
|
||||
log.debug "Current Mode = ${mode}"
|
||||
|
||||
def heatingSetpoint = device.currentValue("heatingSetpoint").toInteger()
|
||||
log.debug "Heating Setpoint = ${heatingSetpoint}"
|
||||
def heatingSetpoint = device.currentValue("heatingSetpoint").toInteger()
|
||||
log.debug "Heating Setpoint = ${heatingSetpoint}"
|
||||
|
||||
def coolingSetpoint = device.currentValue("coolingSetpoint").toInteger()
|
||||
log.debug "Cooling Setpoint = ${coolingSetpoint}"
|
||||
|
||||
if (mode == "heat") {
|
||||
|
||||
sendEvent("name":"thermostatSetpoint", "value":heatingSetpoint.toString()+"°")
|
||||
|
||||
}
|
||||
else if (mode == "cool") {
|
||||
|
||||
sendEvent("name":"thermostatSetpoint", "value":coolingSetpoint.toString()+"°")
|
||||
log.debug "Cooling Setpoint = ${coolingSetpoint}"
|
||||
|
||||
} else if (mode == "auto") {
|
||||
|
||||
sendEvent("name":"thermostatSetpoint", "value":"Auto")
|
||||
if (mode == "heat") {
|
||||
|
||||
} else if (mode == "off") {
|
||||
|
||||
sendEvent("name":"thermostatSetpoint", "value":"Off")
|
||||
sendEvent("name":"thermostatSetpoint", "value":heatingSetpoint.toString())
|
||||
|
||||
} else if (mode == "emergencyHeat") {
|
||||
|
||||
sendEvent("name":"thermostatSetpoint", "value":heatingSetpoint.toString()+"°")
|
||||
}
|
||||
else if (mode == "cool") {
|
||||
|
||||
}
|
||||
sendEvent("name":"thermostatSetpoint", "value":coolingSetpoint.toString())
|
||||
|
||||
} else if (mode == "auto") {
|
||||
|
||||
sendEvent("name":"thermostatSetpoint", "value":"Auto")
|
||||
|
||||
} else if (mode == "off") {
|
||||
|
||||
sendEvent("name":"thermostatSetpoint", "value":"Off")
|
||||
|
||||
} else if (mode == "emergencyHeat") {
|
||||
|
||||
sendEvent("name":"thermostatSetpoint", "value":heatingSetpoint.toString())
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void raiseSetpoint() {
|
||||
|
||||
log.debug "Raise SetPoint"
|
||||
|
||||
def mode = device.currentValue("thermostatMode")
|
||||
def heatingSetpoint = device.currentValue("heatingSetpoint").toInteger()
|
||||
def coolingSetpoint = device.currentValue("coolingSetpoint").toInteger()
|
||||
|
||||
log.debug "Current Mode = ${mode}"
|
||||
|
||||
if (mode == "heat") {
|
||||
|
||||
heatingSetpoint++
|
||||
|
||||
if (heatingSetpoint > 99)
|
||||
heatingSetpoint = 99
|
||||
|
||||
sendEvent("name":"thermostatSetpoint", "value":heatingSetpoint.toString()+"°")
|
||||
sendEvent("name":"heatingSetpoint", "value":heatingSetpoint)
|
||||
|
||||
parent.setHold (this, heatingSetpoint, coolingSetpoint)
|
||||
|
||||
log.debug "New Heating Setpoint = ${heatingSetpoint}"
|
||||
|
||||
}
|
||||
else if (mode == "cool") {
|
||||
|
||||
coolingSetpoint++
|
||||
|
||||
if (coolingSetpoint > 99)
|
||||
coolingSetpoint = 99
|
||||
|
||||
sendEvent("name":"thermostatSetpoint", "value":coolingSetpoint.toString()+"°")
|
||||
sendEvent("name":"coolingSetpoint", "value":coolingSetpoint)
|
||||
|
||||
parent.setHold (this, heatingSetpoint, coolingSetpoint)
|
||||
|
||||
log.debug "New Cooling Setpoint = ${coolingSetpoint}"
|
||||
|
||||
}
|
||||
generateStatusEvent()
|
||||
def targetvalue
|
||||
|
||||
if (mode == "off" || mode == "auto") {
|
||||
log.warn "this mode: $mode does not allow raiseSetpoint"
|
||||
} else {
|
||||
def heatingSetpoint = device.currentValue("heatingSetpoint").toInteger()
|
||||
def coolingSetpoint = device.currentValue("coolingSetpoint").toInteger()
|
||||
def thermostatSetpoint = device.currentValue("thermostatSetpoint").toInteger()
|
||||
log.debug "raiseSetpoint() mode = ${mode}, heatingSetpoint: ${heatingSetpoint}, coolingSetpoint:${coolingSetpoint}, thermostatSetpoint:${thermostatSetpoint}"
|
||||
|
||||
if (device.latestState('thermostatSetpoint')) {
|
||||
targetvalue = device.latestState('thermostatSetpoint').value as Integer
|
||||
} else {
|
||||
targetvalue = 0
|
||||
}
|
||||
targetvalue = targetvalue + 1
|
||||
|
||||
if (mode == "heat" && targetvalue > 79) {
|
||||
targetvalue = 79
|
||||
} else if (mode == "cool" && targetvalue > 92) {
|
||||
targetvalue = 92
|
||||
}
|
||||
|
||||
sendEvent("name":"thermostatSetpoint", "value":targetvalue, displayed: false)
|
||||
log.info "In mode $mode raiseSetpoint() to $targetvalue"
|
||||
|
||||
runIn(3, "alterSetpoint", [data: [value:targetvalue], overwrite: true]) //when user click button this runIn will be overwrite
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//called by tile when user hit raise temperature button on UI
|
||||
void lowerSetpoint() {
|
||||
log.debug "Lower SetPoint"
|
||||
|
||||
def mode = device.currentValue("thermostatMode")
|
||||
def heatingSetpoint = device.currentValue("heatingSetpoint").toInteger()
|
||||
def coolingSetpoint = device.currentValue("coolingSetpoint").toInteger()
|
||||
|
||||
log.debug "Current Mode = ${mode}, Current Heating Setpoint = ${heatingSetpoint}, Current Cooling Setpoint = ${coolingSetpoint}"
|
||||
|
||||
if (mode == "heat" || mode == "emergencyHeat") {
|
||||
|
||||
heatingSetpoint--
|
||||
|
||||
if (heatingSetpoint < 32)
|
||||
heatingSetpoint = 32
|
||||
def targetvalue
|
||||
|
||||
sendEvent("name":"thermostatSetpoint", "value":heatingSetpoint.toString()+"°")
|
||||
sendEvent("name":"heatingSetpoint", "value":heatingSetpoint)
|
||||
|
||||
parent.setHold (this, heatingSetpoint, coolingSetpoint)
|
||||
|
||||
log.debug "New Heating Setpoint = ${heatingSetpoint}"
|
||||
|
||||
}
|
||||
else if (mode == "cool") {
|
||||
|
||||
coolingSetpoint--
|
||||
|
||||
if (coolingSetpoint < 32)
|
||||
coolingSetpoint = 32
|
||||
|
||||
sendEvent("name":"thermostatSetpoint", "value":coolingSetpoint.toString()+"°")
|
||||
sendEvent("name":"coolingSetpoint", "value":coolingSetpoint)
|
||||
|
||||
parent.setHold (this, heatingSetpoint, coolingSetpoint)
|
||||
|
||||
log.debug "New Cooling Setpoint = ${coolingSetpoint}"
|
||||
|
||||
}
|
||||
generateStatusEvent()
|
||||
if (mode == "off" || mode == "auto") {
|
||||
log.warn "this mode: $mode does not allow lowerSetpoint"
|
||||
} else {
|
||||
def heatingSetpoint = device.currentValue("heatingSetpoint").toInteger()
|
||||
def coolingSetpoint = device.currentValue("coolingSetpoint").toInteger()
|
||||
def thermostatSetpoint = device.currentValue("thermostatSetpoint").toInteger()
|
||||
log.debug "lowerSetpoint() mode = ${mode}, heatingSetpoint: ${heatingSetpoint}, coolingSetpoint:${coolingSetpoint}, thermostatSetpoint:${thermostatSetpoint}"
|
||||
if (device.latestState('thermostatSetpoint')) {
|
||||
targetvalue = device.latestState('thermostatSetpoint').value as Integer
|
||||
} else {
|
||||
targetvalue = 0
|
||||
}
|
||||
targetvalue = targetvalue - 1
|
||||
|
||||
if (mode == "heat" && targetvalue.toInteger() < 45) {
|
||||
targetvalue = 45
|
||||
} else if (mode == "cool" && targetvalue.toInteger() < 65) {
|
||||
targetvalue = 65
|
||||
}
|
||||
|
||||
sendEvent("name":"thermostatSetpoint", "value":targetvalue, displayed: false)
|
||||
log.info "In mode $mode lowerSetpoint() to $targetvalue"
|
||||
|
||||
runIn(3, "alterSetpoint", [data: [value:targetvalue], overwrite: true]) //when user click button this runIn will be overwrite
|
||||
}
|
||||
}
|
||||
|
||||
//called by raiseSetpoint() and lowerSetpoint()
|
||||
void alterSetpoint(temp) {
|
||||
|
||||
def mode = device.currentValue("thermostatMode")
|
||||
def heatingSetpoint = device.currentValue("heatingSetpoint").toInteger()
|
||||
def coolingSetpoint = device.currentValue("coolingSetpoint").toInteger()
|
||||
def deviceId = device.deviceNetworkId.split(/\./).last()
|
||||
|
||||
def targetHeatingSetpoint
|
||||
def targetCoolingSetpoint
|
||||
|
||||
//step1: check thermostatMode, enforce limits before sending request to cloud
|
||||
if (mode == "heat"){
|
||||
if (temp.value > coolingSetpoint){
|
||||
targetHeatingSetpoint = temp.value
|
||||
targetCoolingSetpoint = temp.value
|
||||
} else {
|
||||
targetHeatingSetpoint = temp.value
|
||||
targetCoolingSetpoint = coolingSetpoint
|
||||
}
|
||||
} else if (mode == "cool") {
|
||||
//enforce limits before sending request to cloud
|
||||
if (temp.value < heatingSetpoint){
|
||||
targetHeatingSetpoint = temp.value
|
||||
targetCoolingSetpoint = temp.value
|
||||
} else {
|
||||
targetHeatingSetpoint = heatingSetpoint
|
||||
targetCoolingSetpoint = temp.value
|
||||
}
|
||||
}
|
||||
|
||||
log.debug "alterSetpoint >> in mode ${mode} trying to change heatingSetpoint to ${targetHeatingSetpoint} " +
|
||||
"coolingSetpoint to ${targetCoolingSetpoint} with holdType : ${holdType}"
|
||||
|
||||
def sendHoldType = holdType ? (holdType=="Temporary")? "nextTransition" : (holdType=="Permanent")? "indefinite" : "indefinite" : "indefinite"
|
||||
//step2: call parent.setHold to send http request to 3rd party cloud
|
||||
if (parent.setHold(this, targetHeatingSetpoint, targetCoolingSetpoint, deviceId, sendHoldType)) {
|
||||
sendEvent("name": "thermostatSetpoint", "value": temp.value.toString(), displayed: false)
|
||||
sendEvent("name": "heatingSetpoint", "value": targetHeatingSetpoint)
|
||||
sendEvent("name": "coolingSetpoint", "value": targetCoolingSetpoint)
|
||||
log.debug "alterSetpoint in mode $mode succeed change setpoint to= ${temp.value}"
|
||||
} else {
|
||||
log.error "Error alterSetpoint()"
|
||||
if (mode == "heat"){
|
||||
sendEvent("name": "thermostatSetpoint", "value": heatingSetpoint.toString(), displayed: false)
|
||||
} else if (mode == "cool") {
|
||||
sendEvent("name": "thermostatSetpoint", "value": coolingSetpoint.toString(), displayed: false)
|
||||
}
|
||||
}
|
||||
generateStatusEvent()
|
||||
}
|
||||
|
||||
def generateStatusEvent() {
|
||||
|
||||
def mode = device.currentValue("thermostatMode")
|
||||
def heatingSetpoint = device.currentValue("heatingSetpoint").toInteger()
|
||||
def coolingSetpoint = device.currentValue("coolingSetpoint").toInteger()
|
||||
def temperature = device.currentValue("temperature").toInteger()
|
||||
|
||||
def statusText
|
||||
|
||||
log.debug "Generate Status Event for Mode = ${mode}"
|
||||
log.debug "Temperature = ${temperature}"
|
||||
log.debug "Heating set point = ${heatingSetpoint}"
|
||||
log.debug "Cooling set point = ${coolingSetpoint}"
|
||||
log.debug "HVAC Mode = ${mode}"
|
||||
|
||||
if (mode == "heat") {
|
||||
|
||||
if (temperature >= heatingSetpoint)
|
||||
statusText = "Right Now: Idle"
|
||||
else
|
||||
statusText = "Heating to ${heatingSetpoint}° F"
|
||||
|
||||
} else if (mode == "cool") {
|
||||
|
||||
if (temperature <= coolingSetpoint)
|
||||
statusText = "Right Now: Idle"
|
||||
else
|
||||
statusText = "Cooling to ${coolingSetpoint}° F"
|
||||
|
||||
} else if (mode == "auto") {
|
||||
|
||||
statusText = "Right Now: Auto"
|
||||
|
||||
} else if (mode == "off") {
|
||||
|
||||
statusText = "Right Now: Off"
|
||||
|
||||
} else if (mode == "emergencyHeat") {
|
||||
|
||||
statusText = "Emergency Heat"
|
||||
|
||||
} else {
|
||||
|
||||
statusText = "?"
|
||||
|
||||
}
|
||||
log.debug "Generate Status Event = ${statusText}"
|
||||
sendEvent("name":"thermostatStatus", "value":statusText, "description":statusText, displayed: true, isStateChange: true)
|
||||
def heatingSetpoint = device.currentValue("heatingSetpoint").toInteger()
|
||||
def coolingSetpoint = device.currentValue("coolingSetpoint").toInteger()
|
||||
def temperature = device.currentValue("temperature").toInteger()
|
||||
|
||||
def statusText
|
||||
|
||||
log.debug "Generate Status Event for Mode = ${mode}"
|
||||
log.debug "Temperature = ${temperature}"
|
||||
log.debug "Heating set point = ${heatingSetpoint}"
|
||||
log.debug "Cooling set point = ${coolingSetpoint}"
|
||||
log.debug "HVAC Mode = ${mode}"
|
||||
|
||||
if (mode == "heat") {
|
||||
|
||||
if (temperature >= heatingSetpoint)
|
||||
statusText = "Right Now: Idle"
|
||||
else
|
||||
statusText = "Heating to ${heatingSetpoint}° F"
|
||||
|
||||
} else if (mode == "cool") {
|
||||
|
||||
if (temperature <= coolingSetpoint)
|
||||
statusText = "Right Now: Idle"
|
||||
else
|
||||
statusText = "Cooling to ${coolingSetpoint}° F"
|
||||
|
||||
} else if (mode == "auto") {
|
||||
|
||||
statusText = "Right Now: Auto"
|
||||
|
||||
} else if (mode == "off") {
|
||||
|
||||
statusText = "Right Now: Off"
|
||||
|
||||
} else if (mode == "emergencyHeat") {
|
||||
|
||||
statusText = "Emergency Heat"
|
||||
|
||||
} else {
|
||||
|
||||
statusText = "?"
|
||||
|
||||
}
|
||||
log.debug "Generate Status Event = ${statusText}"
|
||||
sendEvent("name":"thermostatStatus", "value":statusText, "description":statusText, displayed: true)
|
||||
}
|
||||
|
||||
//generate custom mobile activity feeds event
|
||||
def generateActivityFeedsEvent(notificationMessage) {
|
||||
sendEvent(name: "notificationMessage", value: "$device.displayName $notificationMessage", descriptionText: "$device.displayName $notificationMessage", displayed: true)
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
*
|
||||
*/
|
||||
metadata {
|
||||
definition (name: "Logitech Harmony Activity", namespace: "smartthings", author: "Juan Risso") {
|
||||
definition (name: "Harmony Activity", namespace: "smartthings", author: "Juan Risso") {
|
||||
capability "Switch"
|
||||
capability "Actuator"
|
||||
capability "Refresh"
|
||||
|
||||
@@ -79,8 +79,8 @@ metadata {
|
||||
}
|
||||
|
||||
preferences {
|
||||
input description: "This feature allows you to correct any temperature variations by selecting an offset. Ex: If your sensor consistently reports a temp that's 5 degrees too warm, you'd enter \"-5\". If 3 degrees too cold, enter \"+3\".", displayDuringSetup: false, type: "paragraph", element: "paragraph"
|
||||
input "tempOffset", "number", title: "Temperature Offset", description: "Adjust temperature by this many degrees", range: "*..*", displayDuringSetup: false
|
||||
input title: "Temperature Offset", description: "This feature allows you to correct any temperature variations by selecting an offset. Ex: If your sensor consistently reports a temp that's 5 degrees too warm, you'd enter \"-5\". If 3 degrees too cold, enter \"+3\".", displayDuringSetup: false, type: "paragraph", element: "paragraph"
|
||||
input "tempOffset", "number", title: "Degrees", description: "Adjust temperature by this many degrees", range: "*..*", displayDuringSetup: false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -88,8 +88,8 @@ metadata {
|
||||
}
|
||||
|
||||
preferences {
|
||||
input description: "This feature allows you to correct any temperature variations by selecting an offset. Ex: If your sensor consistently reports a temp that's 5 degrees too warm, you'd enter \"-5\". If 3 degrees too cold, enter \"+3\".", displayDuringSetup: false, type: "paragraph", element: "paragraph"
|
||||
input "tempOffset", "number", title: "Temperature Offset", description: "Adjust temperature by this many degrees", range: "*..*", displayDuringSetup: false
|
||||
input title: "Temperature Offset", description: "This feature allows you to correct any temperature variations by selecting an offset. Ex: If your sensor consistently reports a temp that's 5 degrees too warm, you'd enter \"-5\". If 3 degrees too cold, enter \"+3\".", displayDuringSetup: false, type: "paragraph", element: "paragraph"
|
||||
input "tempOffset", "number", title: "Degrees", description: "Adjust temperature by this many degrees", range: "*..*", displayDuringSetup: false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,8 +43,8 @@ metadata {
|
||||
])
|
||||
}
|
||||
section {
|
||||
input description: "This feature allows you to correct any temperature variations by selecting an offset. Ex: If your sensor consistently reports a temp that's 5 degrees too warm, you'd enter \"-5\". If 3 degrees too cold, enter \"+3\".", displayDuringSetup: false, type: "paragraph", element: "paragraph"
|
||||
input "tempOffset", "number", title: "Temperature Offset", description: "Adjust temperature by this many degrees", range: "*..*", displayDuringSetup: false
|
||||
input title: "Temperature Offset", description: "This feature allows you to correct any temperature variations by selecting an offset. Ex: If your sensor consistently reports a temp that's 5 degrees too warm, you'd enter \"-5\". If 3 degrees too cold, enter \"+3\".", displayDuringSetup: false, type: "paragraph", element: "paragraph"
|
||||
input "tempOffset", "number", title: "Degrees", description: "Adjust temperature by this many degrees", range: "*..*", displayDuringSetup: false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,8 +45,8 @@ metadata {
|
||||
])
|
||||
}
|
||||
section {
|
||||
input description: "This feature allows you to correct any temperature variations by selecting an offset. Ex: If your sensor consistently reports a temp that's 5 degrees too warm, you'd enter \"-5\". If 3 degrees too cold, enter \"+3\".", displayDuringSetup: false, type: "paragraph", element: "paragraph"
|
||||
input "tempOffset", "number", title: "Temperature Offset", description: "Adjust temperature by this many degrees", range: "*..*", displayDuringSetup: false
|
||||
input title: "Temperature Offset", description: "This feature allows you to correct any temperature variations by selecting an offset. Ex: If your sensor consistently reports a temp that's 5 degrees too warm, you'd enter \"-5\". If 3 degrees too cold, enter \"+3\".", displayDuringSetup: false, type: "paragraph", element: "paragraph"
|
||||
input "tempOffset", "number", title: "Degrees", description: "Adjust temperature by this many degrees", range: "*..*", displayDuringSetup: false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,8 +37,8 @@ metadata {
|
||||
}
|
||||
|
||||
preferences {
|
||||
input description: "This feature allows you to correct any temperature variations by selecting an offset. Ex: If your sensor consistently reports a temp that's 5 degrees too warm, you'd enter \"-5\". If 3 degrees too cold, enter \"+3\".", displayDuringSetup: false, type: "paragraph", element: "paragraph"
|
||||
input "tempOffset", "number", title: "Temperature Offset", description: "Adjust temperature by this many degrees", range: "*..*", displayDuringSetup: false
|
||||
input title: "Temperature Offset", description: "This feature allows you to correct any temperature variations by selecting an offset. Ex: If your sensor consistently reports a temp that's 5 degrees too warm, you'd enter \"-5\". If 3 degrees too cold, enter \"+3\".", displayDuringSetup: false, type: "paragraph", element: "paragraph"
|
||||
input "tempOffset", "number", title: "Degrees", description: "Adjust temperature by this many degrees", range: "*..*", displayDuringSetup: false
|
||||
}
|
||||
|
||||
tiles(scale: 2) {
|
||||
|
||||
@@ -61,8 +61,8 @@
|
||||
])
|
||||
}
|
||||
section {
|
||||
input description: "This feature allows you to correct any temperature variations by selecting an offset. Ex: If your sensor consistently reports a temp that's 5 degrees too warm, you'd enter \"-5\". If 3 degrees too cold, enter \"+3\".", displayDuringSetup: false, type: "paragraph", element: "paragraph"
|
||||
input "tempOffset", "number", title: "Temperature Offset", description: "Adjust temperature by this many degrees", range: "*..*", displayDuringSetup: false
|
||||
input title: "Temperature Offset", description: "This feature allows you to correct any temperature variations by selecting an offset. Ex: If your sensor consistently reports a temp that's 5 degrees too warm, you'd enter \"-5\". If 3 degrees too cold, enter \"+3\".", displayDuringSetup: false, type: "paragraph", element: "paragraph"
|
||||
input "tempOffset", "number", title: "Degrees", description: "Adjust temperature by this many degrees", range: "*..*", displayDuringSetup: false
|
||||
}
|
||||
section {
|
||||
input("garageSensor", "enum", title: "Do you want to use this sensor on a garage door?", options: ["Yes", "No"], defaultValue: "No", required: false, displayDuringSetup: false)
|
||||
@@ -115,31 +115,30 @@
|
||||
}
|
||||
}
|
||||
|
||||
def parse(String description) {
|
||||
|
||||
Map map = [:]
|
||||
if (description?.startsWith('catchall:')) {
|
||||
map = parseCatchAllMessage(description)
|
||||
}
|
||||
else if (description?.startsWith('read attr -')) {
|
||||
map = parseReportAttributeMessage(description)
|
||||
}
|
||||
def parse(String description) {
|
||||
Map map = [:]
|
||||
if (description?.startsWith('catchall:')) {
|
||||
map = parseCatchAllMessage(description)
|
||||
}
|
||||
else if (description?.startsWith('temperature: ')) {
|
||||
map = parseCustomMessage(description)
|
||||
}
|
||||
else if (description?.startsWith('zone status')) {
|
||||
map = parseIasMessage(description)
|
||||
}
|
||||
map = parseCustomMessage(description)
|
||||
}
|
||||
else if (description?.startsWith('zone status')) {
|
||||
map = parseIasMessage(description)
|
||||
}
|
||||
|
||||
def result = map ? createEvent(map) : null
|
||||
|
||||
if (description?.startsWith('enroll request')) {
|
||||
List cmds = enrollResponse()
|
||||
log.debug "enroll response: ${cmds}"
|
||||
result = cmds?.collect { new physicalgraph.device.HubAction(it) }
|
||||
}
|
||||
return result
|
||||
}
|
||||
if (description?.startsWith('enroll request')) {
|
||||
List cmds = enrollResponse()
|
||||
log.debug "enroll response: ${cmds}"
|
||||
result = cmds?.collect { new physicalgraph.device.HubAction(it) }
|
||||
}
|
||||
else if (description?.startsWith('read attr -')) {
|
||||
result = parseReportAttributeMessage(description).each { createEvent(it) }
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
private Map parseCatchAllMessage(String description) {
|
||||
Map resultMap = [:]
|
||||
@@ -178,28 +177,40 @@ private boolean shouldProcessMessage(cluster) {
|
||||
return !ignoredMessage
|
||||
}
|
||||
|
||||
private Map parseReportAttributeMessage(String description) {
|
||||
private List parseReportAttributeMessage(String description) {
|
||||
Map descMap = (description - "read attr - ").split(",").inject([:]) { map, param ->
|
||||
def nameAndValue = param.split(":")
|
||||
map += [(nameAndValue[0].trim()):nameAndValue[1].trim()]
|
||||
}
|
||||
|
||||
Map resultMap = [:]
|
||||
|
||||
List result = []
|
||||
if (descMap.cluster == "0402" && descMap.attrId == "0000") {
|
||||
def value = getTemperature(descMap.value)
|
||||
resultMap = getTemperatureResult(value)
|
||||
result << getTemperatureResult(value)
|
||||
}
|
||||
else if (descMap.cluster == "FC02" && descMap.attrId == "0010") {
|
||||
resultMap = getAccelerationResult(descMap.value)
|
||||
if (descMap.value.size() == 32) {
|
||||
// value will look like 00ae29001403e2290013001629001201
|
||||
// breaking this apart and swapping byte order where appropriate, this breaks down to:
|
||||
// X (0x0012) = 0x0016
|
||||
// Y (0x0013) = 0x03E2
|
||||
// Z (0x0014) = 0x00AE
|
||||
// note that there is a known bug in that the x,y,z attributes are interpreted in the wrong order
|
||||
// this will be fixed in a future update
|
||||
def threeAxisAttributes = descMap.value[0..-9]
|
||||
result << parseAxis(threeAxisAttributes)
|
||||
descMap.value = descMap.value[-2..-1]
|
||||
}
|
||||
result << getAccelerationResult(descMap.value)
|
||||
}
|
||||
else if (descMap.cluster == "FC02" && descMap.attrId == "0012") {
|
||||
resultMap = parseAxis(descMap.value)
|
||||
else if (descMap.cluster == "FC02" && descMap.attrId == "0012") {
|
||||
result << parseAxis(descMap.value)
|
||||
}
|
||||
else if (descMap.cluster == "0001" && descMap.attrId == "0020") {
|
||||
resultMap = getBatteryResult(Integer.parseInt(descMap.value, 16))
|
||||
result << getBatteryResult(Integer.parseInt(descMap.value, 16))
|
||||
}
|
||||
|
||||
return resultMap
|
||||
return result
|
||||
}
|
||||
|
||||
private Map parseCustomMessage(String description) {
|
||||
|
||||
@@ -43,8 +43,8 @@ metadata {
|
||||
}
|
||||
|
||||
preferences {
|
||||
input description: "This feature allows you to correct any temperature variations by selecting an offset. Ex: If your sensor consistently reports a temp that's 5 degrees too warm, you'd enter \"-5\". If 3 degrees too cold, enter \"+3\".", displayDuringSetup: false, type: "paragraph", element: "paragraph"
|
||||
input "tempOffset", "number", title: "Temperature Offset", description: "Adjust temperature by this many degrees", range: "*..*", displayDuringSetup: false
|
||||
input title: "Temperature Offset", description: "This feature allows you to correct any temperature variations by selecting an offset. Ex: If your sensor consistently reports a temp that's 5 degrees too warm, you'd enter \"-5\". If 3 degrees too cold, enter \"+3\".", displayDuringSetup: false, type: "paragraph", element: "paragraph"
|
||||
input "tempOffset", "number", title: "Degrees", description: "Adjust temperature by this many degrees", range: "*..*", displayDuringSetup: false
|
||||
}
|
||||
|
||||
tiles(scale: 2) {
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
}
|
||||
|
||||
preferences {
|
||||
input description: "This feature allows you to correct any temperature variations by selecting an offset. Ex: If your sensor consistently reports a temp that's 5 degrees too warm, you'd enter \"-5\". If 3 degrees too cold, enter \"+3\".", displayDuringSetup: false, type: "paragraph", element: "paragraph"
|
||||
input "tempOffset", "number", title: "Temperature Offset", description: "Adjust temperature by this many degrees", range: "*..*", displayDuringSetup: false
|
||||
input title: "Temperature Offset", description: "This feature allows you to correct any temperature variations by selecting an offset. Ex: If your sensor consistently reports a temp that's 5 degrees too warm, you'd enter \"-5\". If 3 degrees too cold, enter \"+3\".", displayDuringSetup: false, type: "paragraph", element: "paragraph"
|
||||
input "tempOffset", "number", title: "Degrees", description: "Adjust temperature by this many degrees", range: "*..*", displayDuringSetup: false
|
||||
}
|
||||
|
||||
tiles(scale: 2) {
|
||||
|
||||
@@ -34,8 +34,8 @@ metadata {
|
||||
}
|
||||
|
||||
preferences {
|
||||
input description: "This feature allows you to correct any temperature variations by selecting an offset. Ex: If your sensor consistently reports a temp that's 5 degrees too warm, you'd enter \"-5\". If 3 degrees too cold, enter \"+3\".", displayDuringSetup: false, type: "paragraph", element: "paragraph"
|
||||
input "tempOffset", "number", title: "Temperature Offset", description: "Adjust temperature by this many degrees", range: "*..*", displayDuringSetup: false
|
||||
input title: "Temperature Offset", description: "This feature allows you to correct any temperature variations by selecting an offset. Ex: If your sensor consistently reports a temp that's 5 degrees too warm, you'd enter \"-5\". If 3 degrees too cold, enter \"+3\".", displayDuringSetup: false, type: "paragraph", element: "paragraph"
|
||||
input "tempOffset", "number", title: "Degrees", description: "Adjust temperature by this many degrees", range: "*..*", displayDuringSetup: false
|
||||
}
|
||||
|
||||
tiles(scale: 2) {
|
||||
|
||||
@@ -33,8 +33,8 @@ metadata {
|
||||
}
|
||||
|
||||
preferences {
|
||||
input description: "This feature allows you to correct any temperature variations by selecting an offset. Ex: If your sensor consistently reports a temp that's 5 degrees too warm, you'd enter \"-5\". If 3 degrees too cold, enter \"+3\".", displayDuringSetup: false, type: "paragraph", element: "paragraph"
|
||||
input "tempOffset", "number", title: "Temperature Offset", description: "Adjust temperature by this many degrees", range: "*..*", displayDuringSetup: false
|
||||
input title: "Temperature Offset", description: "This feature allows you to correct any temperature variations by selecting an offset. Ex: If your sensor consistently reports a temp that's 5 degrees too warm, you'd enter \"-5\". If 3 degrees too cold, enter \"+3\".", displayDuringSetup: false, type: "paragraph", element: "paragraph"
|
||||
input "tempOffset", "number", title: "Degrees", description: "Adjust temperature by this many degrees", range: "*..*", displayDuringSetup: false
|
||||
}
|
||||
|
||||
tiles(scale: 2) {
|
||||
|
||||
@@ -45,8 +45,8 @@ metadata {
|
||||
}
|
||||
|
||||
preferences {
|
||||
input description: "This feature allows you to correct any temperature variations by selecting an offset. Ex: If your sensor consistently reports a temp that's 5 degrees too warm, you'd enter \"-5\". If 3 degrees too cold, enter \"+3\".", displayDuringSetup: false, type: "paragraph", element: "paragraph"
|
||||
input "tempOffset", "number", title: "Temperature Offset", description: "Adjust temperature by this many degrees", range: "*..*", displayDuringSetup: false
|
||||
input title: "Temperature Offset", description: "This feature allows you to correct any temperature variations by selecting an offset. Ex: If your sensor consistently reports a temp that's 5 degrees too warm, you'd enter \"-5\". If 3 degrees too cold, enter \"+3\".", displayDuringSetup: false, type: "paragraph", element: "paragraph"
|
||||
input "tempOffset", "number", title: "Degrees", description: "Adjust temperature by this many degrees", range: "*..*", displayDuringSetup: false
|
||||
}
|
||||
|
||||
tiles {
|
||||
|
||||
@@ -33,8 +33,8 @@ metadata {
|
||||
}
|
||||
|
||||
preferences {
|
||||
input description: "This feature allows you to correct any temperature variations by selecting an offset. Ex: If your sensor consistently reports a temp that's 5 degrees too warm, you'd enter \"-5\". If 3 degrees too cold, enter \"+3\".", displayDuringSetup: false, type: "paragraph", element: "paragraph"
|
||||
input "tempOffset", "number", title: "Temperature Offset", description: "Adjust temperature by this many degrees", range: "*..*", displayDuringSetup: false
|
||||
input title: "Temperature Offset", description: "This feature allows you to correct any temperature variations by selecting an offset. Ex: If your sensor consistently reports a temp that's 5 degrees too warm, you'd enter \"-5\". If 3 degrees too cold, enter \"+3\".", displayDuringSetup: false, type: "paragraph", element: "paragraph"
|
||||
input "tempOffset", "number", title: "Degrees", description: "Adjust temperature by this many degrees", range: "*..*", displayDuringSetup: false
|
||||
}
|
||||
|
||||
tiles {
|
||||
|
||||
@@ -25,8 +25,8 @@ metadata {
|
||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0B04"
|
||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0702"
|
||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0702, 0B05", outClusters: "0019", manufacturer: "sengled", model: "Z01-CIA19NAE26", deviceJoinName: "Sengled Element touch"
|
||||
fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0B05,0702", outClusters: "000A,0019", manufacturer: "Jasco Products", model: "45852", deviceJoinName: "GE Zigbee Plug-In Dimmer"
|
||||
fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0B05,0702", outClusters: "000A,0019", manufacturer: "Jasco Products", model: "45857", deviceJoinName: "GE Zigbee In-Wall Dimmer"
|
||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0702, 0B05", outClusters: "000A, 0019", manufacturer: "Jasco Products", model: "45852", deviceJoinName: "GE Zigbee Plug-In Dimmer"
|
||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0702, 0B05", outClusters: "000A, 0019", manufacturer: "Jasco Products", model: "45857", deviceJoinName: "GE Zigbee In-Wall Dimmer"
|
||||
}
|
||||
|
||||
tiles(scale: 2) {
|
||||
|
||||
@@ -17,15 +17,14 @@ metadata {
|
||||
capability "Actuator"
|
||||
capability "Configuration"
|
||||
capability "Refresh"
|
||||
capability "Sensor"
|
||||
capability "Switch"
|
||||
capability "Switch Level"
|
||||
|
||||
|
||||
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: "OSRAM LIGHTIFY LED Smart Connected Light"
|
||||
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, 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"
|
||||
}
|
||||
|
||||
tiles(scale: 2) {
|
||||
|
||||
@@ -23,8 +23,8 @@ metadata {
|
||||
|
||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0B04"
|
||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0702"
|
||||
fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0B05,0702", outClusters: "0003, 000A,0019", manufacturer: "Jasco Products", model: "45853", deviceJoinName: "GE ZigBee Plug-In Switch"
|
||||
fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0B05,0702", outClusters: "000A,0019", manufacturer: "Jasco Products", model: "45856", deviceJoinName: "GE ZigBee In-Wall Switch"
|
||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0702, 0B05", outClusters: "0003, 000A, 0019", manufacturer: "Jasco Products", model: "45853", deviceJoinName: "GE ZigBee Plug-In Switch"
|
||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0702, 0B05", outClusters: "000A, 0019", manufacturer: "Jasco Products", model: "45856", deviceJoinName: "GE ZigBee In-Wall Switch"
|
||||
}
|
||||
|
||||
tiles(scale: 2) {
|
||||
|
||||
@@ -17,7 +17,6 @@ metadata {
|
||||
capability "Actuator"
|
||||
capability "Configuration"
|
||||
capability "Refresh"
|
||||
capability "Sensor"
|
||||
capability "Switch"
|
||||
|
||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006"
|
||||
|
||||
@@ -23,18 +23,18 @@ metadata {
|
||||
capability "Color Temperature"
|
||||
capability "Configuration"
|
||||
capability "Refresh"
|
||||
capability "Sensor"
|
||||
capability "Switch"
|
||||
capability "Switch Level"
|
||||
|
||||
attribute "colorName", "string"
|
||||
command "setGenericName"
|
||||
|
||||
fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0300,0B04", outClusters: "0019"
|
||||
fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0300,0B04,FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY BR Tunable White", deviceJoinName: "OSRAM LIGHTIFY LED Flood BR30 Tunable White"
|
||||
fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0300,0B04,FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY RT Tunable White", deviceJoinName: "OSRAM LIGHTIFY LED Recessed Kit RT 5/6 Tunable White"
|
||||
fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0300,0B04,FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "Classic A60 TW", deviceJoinName: "OSRAM LIGHTIFY LED Tunable White 60W"
|
||||
fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0300,0B04,FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY A19 Tunable White", deviceJoinName: "OSRAM LIGHTIFY LED Tunable White 60W"
|
||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0300", outClusters: "0019"
|
||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0300, 0B04", outClusters: "0019"
|
||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0300, 0B04, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY BR Tunable White", deviceJoinName: "OSRAM LIGHTIFY LED Flood BR30 Tunable White"
|
||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0300, 0B04, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY RT Tunable White", deviceJoinName: "OSRAM LIGHTIFY LED Recessed Kit RT 5/6 Tunable White"
|
||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0300, 0B04, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "Classic A60 TW", deviceJoinName: "OSRAM LIGHTIFY LED Tunable White 60W"
|
||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0300, 0B04, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY A19 Tunable White", deviceJoinName: "OSRAM LIGHTIFY LED Tunable White 60W"
|
||||
}
|
||||
|
||||
// UI tile definitions
|
||||
|
||||
@@ -66,9 +66,20 @@ metadata {
|
||||
import physicalgraph.zwave.commands.doorlockv1.*
|
||||
import physicalgraph.zwave.commands.usercodev1.*
|
||||
|
||||
def updated() {
|
||||
try {
|
||||
if (!state.init) {
|
||||
state.init = true
|
||||
response(secureSequence([zwave.doorLockV1.doorLockOperationGet(), zwave.batteryV1.batteryGet()]))
|
||||
}
|
||||
} catch (e) {
|
||||
log.warn "updated() threw $e"
|
||||
}
|
||||
}
|
||||
|
||||
def parse(String description) {
|
||||
def result = null
|
||||
if (description.startsWith("Err")) {
|
||||
if (description.startsWith("Err 106")) {
|
||||
if (state.sec) {
|
||||
result = createEvent(descriptionText:description, displayed:false)
|
||||
} else {
|
||||
@@ -80,6 +91,8 @@ def parse(String description) {
|
||||
displayed: true,
|
||||
)
|
||||
}
|
||||
} else if (description == "updated") {
|
||||
return null
|
||||
} else {
|
||||
def cmd = zwave.parse(description, [ 0x98: 1, 0x72: 2, 0x85: 2, 0x86: 1 ])
|
||||
if (cmd) {
|
||||
@@ -286,7 +299,7 @@ def zwaveEvent(physicalgraph.zwave.commands.alarmv2.AlarmReport cmd) {
|
||||
}
|
||||
break
|
||||
case 167:
|
||||
if (!state.lastbatt || (new Date().time) - state.lastbatt > 12*60*60*1000) {
|
||||
if (!state.lastbatt || now() - state.lastbatt > 12*60*60*1000) {
|
||||
map = [ descriptionText: "$device.displayName: battery low", isStateChange: true ]
|
||||
result << response(secure(zwave.batteryV1.batteryGet()))
|
||||
} else {
|
||||
@@ -431,7 +444,7 @@ def zwaveEvent(physicalgraph.zwave.commands.batteryv1.BatteryReport cmd) {
|
||||
} else {
|
||||
map.value = cmd.batteryLevel
|
||||
}
|
||||
state.lastbatt = new Date().time
|
||||
state.lastbatt = now()
|
||||
createEvent(map)
|
||||
}
|
||||
|
||||
@@ -499,15 +512,14 @@ def refresh() {
|
||||
cmds << "delay 4200"
|
||||
cmds << zwave.associationV1.associationGet(groupingIdentifier:2).format() // old Schlage locks use group 2 and don't secure the Association CC
|
||||
cmds << secure(zwave.associationV1.associationGet(groupingIdentifier:1))
|
||||
state.associationQuery = new Date().time
|
||||
} else if (new Date().time - state.associationQuery.toLong() > 9000) {
|
||||
log.debug "setting association"
|
||||
state.associationQuery = now()
|
||||
} else if (secondsPast(state.associationQuery, 9)) {
|
||||
cmds << "delay 6000"
|
||||
cmds << zwave.associationV1.associationSet(groupingIdentifier:2, nodeId:zwaveHubNodeId).format()
|
||||
cmds << secure(zwave.associationV1.associationSet(groupingIdentifier:1, nodeId:zwaveHubNodeId))
|
||||
cmds << zwave.associationV1.associationGet(groupingIdentifier:2).format()
|
||||
cmds << secure(zwave.associationV1.associationGet(groupingIdentifier:1))
|
||||
state.associationQuery = new Date().time
|
||||
state.associationQuery = now()
|
||||
}
|
||||
log.debug "refresh sending ${cmds.inspect()}"
|
||||
cmds
|
||||
@@ -515,55 +527,22 @@ def refresh() {
|
||||
|
||||
def poll() {
|
||||
def cmds = []
|
||||
if (state.assoc != zwaveHubNodeId && secondsPast(state.associationQuery, 19 * 60)) {
|
||||
log.debug "setting association"
|
||||
cmds << zwave.associationV1.associationSet(groupingIdentifier:2, nodeId:zwaveHubNodeId).format()
|
||||
cmds << secure(zwave.associationV1.associationSet(groupingIdentifier:1, nodeId:zwaveHubNodeId))
|
||||
cmds << zwave.associationV1.associationGet(groupingIdentifier:2).format()
|
||||
cmds << "delay 6000"
|
||||
cmds << secure(zwave.associationV1.associationGet(groupingIdentifier:1))
|
||||
cmds << "delay 6000"
|
||||
state.associationQuery = new Date().time
|
||||
} else {
|
||||
// Only check lock state if it changed recently or we haven't had an update in an hour
|
||||
def latest = device.currentState("lock")?.date?.time
|
||||
if (!latest || !secondsPast(latest, 6 * 60) || secondsPast(state.lastPoll, 55 * 60)) {
|
||||
cmds << secure(zwave.doorLockV1.doorLockOperationGet())
|
||||
state.lastPoll = (new Date()).time
|
||||
} else if (!state.MSR) {
|
||||
cmds << zwave.manufacturerSpecificV1.manufacturerSpecificGet().format()
|
||||
} else if (!state.fw) {
|
||||
cmds << zwave.versionV1.versionGet().format()
|
||||
} else if (!state.codes) {
|
||||
state.pollCode = 1
|
||||
cmds << secure(zwave.userCodeV1.usersNumberGet())
|
||||
} else if (state.pollCode && state.pollCode <= state.codes) {
|
||||
cmds << requestCode(state.pollCode)
|
||||
} else if (!state.lastbatt || (new Date().time) - state.lastbatt > 53*60*60*1000) {
|
||||
cmds << secure(zwave.batteryV1.batteryGet())
|
||||
} else if (!state.enc) {
|
||||
encryptCodes()
|
||||
state.enc = 1
|
||||
}
|
||||
// Only check lock state if it changed recently or we haven't had an update in an hour
|
||||
def latest = device.currentState("lock")?.date?.time
|
||||
if (!latest || !secondsPast(latest, 6 * 60) || secondsPast(state.lastPoll, 55 * 60)) {
|
||||
cmds << secure(zwave.doorLockV1.doorLockOperationGet())
|
||||
state.lastPoll = now()
|
||||
} else if (!state.lastbatt || now() - state.lastbatt > 53*60*60*1000) {
|
||||
cmds << secure(zwave.batteryV1.batteryGet())
|
||||
state.lastbatt = now() //inside-214
|
||||
}
|
||||
log.debug "poll is sending ${cmds.inspect()}"
|
||||
device.activity()
|
||||
cmds ?: null
|
||||
}
|
||||
|
||||
private def encryptCodes() {
|
||||
def keys = new ArrayList(state.keySet().findAll { it.startsWith("code") })
|
||||
keys.each { key ->
|
||||
def match = (key =~ /^code(\d+)$/)
|
||||
if (match) try {
|
||||
def keynum = match[0][1].toInteger()
|
||||
if (keynum > 30 && !state[key]) {
|
||||
state.remove(key)
|
||||
} else if (state[key] && !state[key].startsWith("~")) {
|
||||
log.debug "encrypting $key: ${state[key].inspect()}"
|
||||
state[key] = encrypt(state[key])
|
||||
}
|
||||
} catch (java.lang.NumberFormatException e) { }
|
||||
if (cmds) {
|
||||
log.debug "poll is sending ${cmds.inspect()}"
|
||||
cmds
|
||||
} else {
|
||||
// workaround to keep polling from stopping due to lack of activity
|
||||
sendEvent(descriptionText: "skipping poll", isStateChange: true, displayed: false)
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -672,7 +651,7 @@ private Boolean secondsPast(timestamp, seconds) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return (new Date().time - timestamp) > (seconds * 1000)
|
||||
return (now() - timestamp) > (seconds * 1000)
|
||||
}
|
||||
|
||||
private allCodesDeleted() {
|
||||
|
||||
@@ -246,6 +246,9 @@ def toggle(devices) {
|
||||
else if (devices*.currentValue('lock').contains('locked')) {
|
||||
devices.unlock()
|
||||
}
|
||||
else if (devices*.currentValue('lock').contains('unlocked')) {
|
||||
devices.lock()
|
||||
}
|
||||
else if (devices*.currentValue('alarm').contains('off')) {
|
||||
devices.siren()
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -592,7 +592,7 @@ def updated() {
|
||||
// log.debug "External Id=${app.id}:${member.id}"
|
||||
|
||||
// create the device
|
||||
def childDevice = addChildDevice("smartthings", "life360-user", "${app.id}.${member.id}",null,[name:member.firstName, completedSetup: true])
|
||||
def childDevice = addChildDevice("smartthings", "Life360 User", "${app.id}.${member.id}",null,[name:member.firstName, completedSetup: true])
|
||||
// childDevice.setMemberId(member.id)
|
||||
|
||||
if (childDevice)
|
||||
|
||||
@@ -49,6 +49,7 @@ preferences {
|
||||
section("Via a push notification and/or an SMS message"){
|
||||
input("recipients", "contact", title: "Send notifications to") {
|
||||
input "phone", "phone", title: "Phone Number (for SMS, optional)", required: false
|
||||
paragraph "If outside the US please make sure to enter the proper country code"
|
||||
input "pushAndPhone", "enum", title: "Both Push and SMS?", required: false, options: ["Yes", "No"]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,24 +10,24 @@
|
||||
* 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.
|
||||
*
|
||||
* Sonos Control
|
||||
* Speaker Control
|
||||
*
|
||||
* Author: SmartThings
|
||||
*
|
||||
* Date: 2013-12-10
|
||||
*/
|
||||
definition(
|
||||
name: "Sonos Control",
|
||||
name: "Speaker Control",
|
||||
namespace: "smartthings",
|
||||
author: "SmartThings",
|
||||
description: "Play or pause your Sonos when certain actions take place in your home.",
|
||||
description: "Play or pause your Speaker when certain actions take place in your home.",
|
||||
category: "SmartThings Labs",
|
||||
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Partner/sonos.png",
|
||||
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Partner/sonos@2x.png"
|
||||
)
|
||||
|
||||
preferences {
|
||||
page(name: "mainPage", title: "Control your Sonos when something happens", install: true, uninstall: true)
|
||||
page(name: "mainPage", title: "Control your Speaker when something happens", install: true, uninstall: true)
|
||||
page(name: "timeIntervalInput", title: "Only during a certain time") {
|
||||
section {
|
||||
input "starting", "time", title: "Starting", required: false
|
||||
@@ -81,7 +81,7 @@ def mainPage() {
|
||||
]
|
||||
}
|
||||
section {
|
||||
input "sonos", "capability.musicPlayer", title: "Sonos music player", required: true
|
||||
input "sonos", "capability.musicPlayer", title: "Speaker music player", required: true
|
||||
}
|
||||
section("More options", hideable: true, hidden: true) {
|
||||
input "volume", "number", title: "Set the volume volume", description: "0-100%", required: false
|
||||
@@ -10,7 +10,7 @@
|
||||
* 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.
|
||||
*
|
||||
* Sonos Mood Music
|
||||
* Speaker Mood Music
|
||||
*
|
||||
* Author: SmartThings
|
||||
* Date: 2014-02-12
|
||||
@@ -65,7 +65,7 @@ private saveSelectedSong() {
|
||||
}
|
||||
|
||||
definition(
|
||||
name: "Sonos Mood Music",
|
||||
name: "Speaker Mood Music",
|
||||
namespace: "smartthings",
|
||||
author: "SmartThings",
|
||||
description: "Plays a selected song or station.",
|
||||
@@ -75,7 +75,7 @@ definition(
|
||||
)
|
||||
|
||||
preferences {
|
||||
page(name: "mainPage", title: "Play a selected song or station on your Sonos when something happens", nextPage: "chooseTrack", uninstall: true)
|
||||
page(name: "mainPage", title: "Play a selected song or station on your Speaker when something happens", nextPage: "chooseTrack", uninstall: true)
|
||||
page(name: "chooseTrack", title: "Select a song", install: true)
|
||||
page(name: "timeIntervalInput", title: "Only during a certain time") {
|
||||
section {
|
||||
@@ -125,7 +125,7 @@ def mainPage() {
|
||||
ifUnset "timeOfDay", "time", title: "At a Scheduled Time", required: false
|
||||
}
|
||||
section {
|
||||
input "sonos", "capability.musicPlayer", title: "On this Sonos player", required: true
|
||||
input "sonos", "capability.musicPlayer", title: "On this Speaker player", required: true
|
||||
}
|
||||
section("More options", hideable: true, hidden: true) {
|
||||
input "volume", "number", title: "Set the volume", description: "0-100%", required: false
|
||||
@@ -10,23 +10,23 @@
|
||||
* 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.
|
||||
*
|
||||
* Sonos Custom Message
|
||||
* Speaker Custom Message
|
||||
*
|
||||
* Author: SmartThings
|
||||
* Date: 2014-1-29
|
||||
*/
|
||||
definition(
|
||||
name: "Sonos Notify with Sound",
|
||||
name: "Speaker Notify with Sound",
|
||||
namespace: "smartthings",
|
||||
author: "SmartThings",
|
||||
description: "Play a sound or custom message through your Sonos when the mode changes or other events occur.",
|
||||
description: "Play a sound or custom message through your Speaker when the mode changes or other events occur.",
|
||||
category: "SmartThings Labs",
|
||||
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Partner/sonos.png",
|
||||
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Partner/sonos@2x.png"
|
||||
)
|
||||
|
||||
preferences {
|
||||
page(name: "mainPage", title: "Play a message on your Sonos when something happens", install: true, uninstall: true)
|
||||
page(name: "mainPage", title: "Play a message on your Speaker when something happens", install: true, uninstall: true)
|
||||
page(name: "chooseTrack", title: "Select a song or station")
|
||||
page(name: "timeIntervalInput", title: "Only during a certain time") {
|
||||
section {
|
||||
@@ -92,7 +92,7 @@ def mainPage() {
|
||||
input "message","text",title:"Play this message", required:false, multiple: false
|
||||
}
|
||||
section {
|
||||
input "sonos", "capability.musicPlayer", title: "On this Sonos player", required: true
|
||||
input "sonos", "capability.musicPlayer", title: "On this Speaker player", required: true
|
||||
}
|
||||
section("More options", hideable: true, hidden: true) {
|
||||
input "resumePlaying", "bool", title: "Resume currently playing music after notification", required: false, defaultValue: true
|
||||
@@ -10,23 +10,23 @@
|
||||
* 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.
|
||||
*
|
||||
* Sonos Weather Forecast
|
||||
* Speaker Weather Forecast
|
||||
*
|
||||
* Author: SmartThings
|
||||
* Date: 2014-1-29
|
||||
*/
|
||||
definition(
|
||||
name: "Sonos Weather Forecast",
|
||||
name: "Speaker Weather Forecast",
|
||||
namespace: "smartthings",
|
||||
author: "SmartThings",
|
||||
description: "Play a weather report through your Sonos when the mode changes or other events occur",
|
||||
description: "Play a weather report through your Speaker when the mode changes or other events occur",
|
||||
category: "SmartThings Labs",
|
||||
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Partner/sonos.png",
|
||||
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Partner/sonos@2x.png"
|
||||
)
|
||||
|
||||
preferences {
|
||||
page(name: "mainPage", title: "Play the weather report on your sonos", install: true, uninstall: true)
|
||||
page(name: "mainPage", title: "Play the weather report on your speaker", install: true, uninstall: true)
|
||||
page(name: "chooseTrack", title: "Select a song or station")
|
||||
page(name: "timeIntervalInput", title: "Only during a certain time") {
|
||||
section {
|
||||
@@ -85,7 +85,7 @@ def mainPage() {
|
||||
)
|
||||
}
|
||||
section {
|
||||
input "sonos", "capability.musicPlayer", title: "On this Sonos player", required: true
|
||||
input "sonos", "capability.musicPlayer", title: "On this Speaker player", required: true
|
||||
}
|
||||
section("More options", hideable: true, hidden: true) {
|
||||
input "resumePlaying", "bool", title: "Resume currently playing music after weather report finishes", required: false, defaultValue: true
|
||||
@@ -78,7 +78,7 @@ def firstPage()
|
||||
def motionsDiscovered = motionsDiscovered()
|
||||
def lightSwitchesDiscovered = lightSwitchesDiscovered()
|
||||
|
||||
return dynamicPage(name:"firstPage", title:"Discovery Started!", nextPage:"", refreshInterval: refreshInterval, install:true, uninstall: selectedSwitches != null || selectedMotions != null || selectedLightSwitches != null) {
|
||||
return dynamicPage(name:"firstPage", title:"Discovery Started!", nextPage:"", refreshInterval: refreshInterval, install:true, uninstall: true) {
|
||||
section("Select a device...") {
|
||||
input "selectedSwitches", "enum", required:false, title:"Select Wemo Switches \n(${switchesDiscovered.size() ?: 0} found)", multiple:true, options:switchesDiscovered
|
||||
input "selectedMotions", "enum", required:false, title:"Select Wemo Motions \n(${motionsDiscovered.size() ?: 0} found)", multiple:true, options:motionsDiscovered
|
||||
|
||||
Reference in New Issue
Block a user