Compare commits
19 Commits
MSA-2159-1
...
MSA-2189-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f9ea07ab81 | ||
|
|
f4367fa2f1 | ||
|
|
40cfb980cf | ||
|
|
c7151b235a | ||
|
|
51bf0a6df2 | ||
|
|
1312526a09 | ||
|
|
969b4b3a31 | ||
|
|
c7bd232046 | ||
|
|
b0e28ba968 | ||
|
|
1611b21aa6 | ||
|
|
27d9bdd86c | ||
|
|
2b09b7c574 | ||
|
|
eb9b55e01c | ||
|
|
10fef276db | ||
|
|
2ea99a1b9e | ||
|
|
4370a552d5 | ||
|
|
2cd00cdd51 | ||
|
|
485204c461 | ||
|
|
66f356d275 |
@@ -18,6 +18,7 @@ metadata {
|
||||
command "raiseHeatingSetpoint"
|
||||
command "lowerCoolSetpoint"
|
||||
command "raiseCoolSetpoint"
|
||||
command "poll"
|
||||
|
||||
fingerprint deviceId: "0x08", inClusters: "0x43,0x40,0x44,0x31,0x80,0x85,0x60"
|
||||
fingerprint mfr:"0098", prod:"6401", model:"0107", deviceJoinName: "2Gig CT100 Programmable Thermostat"
|
||||
@@ -101,9 +102,8 @@ metadata {
|
||||
|
||||
def installed() {
|
||||
// Configure device
|
||||
def cmds = []
|
||||
cmds << new physicalgraph.device.HubAction(zwave.associationV1.associationSet(groupingIdentifier:1, nodeId:[zwaveHubNodeId]).format())
|
||||
cmds << new physicalgraph.device.HubAction(zwave.manufacturerSpecificV2.manufacturerSpecificGet().format())
|
||||
def cmds = [new physicalgraph.device.HubAction(zwave.associationV1.associationSet(groupingIdentifier:1, nodeId:[zwaveHubNodeId]).format()),
|
||||
new physicalgraph.device.HubAction(zwave.manufacturerSpecificV2.manufacturerSpecificGet().format())]
|
||||
sendHubCommand(cmds)
|
||||
runIn(3, "initialize", [overwrite: true]) // Allow configure command to be sent and acknowledged before proceeding
|
||||
}
|
||||
@@ -123,7 +123,7 @@ def initialize() {
|
||||
// Device-Watch simply pings if no device events received for 32min(checkInterval)
|
||||
sendEvent(name: "checkInterval", value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
||||
// Poll device for additional data that will be updated by refresh tile
|
||||
poll()
|
||||
pollDevice()
|
||||
}
|
||||
|
||||
def parse(String description)
|
||||
@@ -150,7 +150,6 @@ def parse(String description)
|
||||
|
||||
def zwaveEvent(physicalgraph.zwave.commands.multichannelv3.MultiInstanceCmdEncap cmd) {
|
||||
def encapsulatedCommand = cmd.encapsulatedCommand([0x31: 3])
|
||||
log.debug ("multiinstancev1.MultiInstanceCmdEncap: command from instance ${cmd.instance}: ${encapsulatedCommand}")
|
||||
if (encapsulatedCommand) {
|
||||
zwaveEvent(encapsulatedCommand)
|
||||
}
|
||||
@@ -341,7 +340,7 @@ def zwaveEvent(physicalgraph.zwave.commands.thermostatmodev2.ThermostatModeSuppo
|
||||
if(cmd.auxiliaryemergencyHeat) { supportedModes << "emergency heat" }
|
||||
|
||||
state.supportedModes = supportedModes
|
||||
sendEvent(name: "supportedThermostatModes", value: supportedModes, isStateChange: true, displayed: false)
|
||||
sendEvent(name: "supportedThermostatModes", value: supportedModes, displayed: false)
|
||||
}
|
||||
|
||||
def zwaveEvent(physicalgraph.zwave.commands.thermostatfanmodev3.ThermostatFanModeSupportedReport cmd) {
|
||||
@@ -351,7 +350,7 @@ def zwaveEvent(physicalgraph.zwave.commands.thermostatfanmodev3.ThermostatFanMod
|
||||
if(cmd.circulation) { supportedFanModes << "circulate" }
|
||||
|
||||
state.supportedFanModes = supportedFanModes
|
||||
sendEvent(name: "supportedThermostatFanModes", value: supportedFanModes, isStateChange: true, displayed: false)
|
||||
sendEvent(name: "supportedThermostatFanModes", value: supportedFanModes, displayed: false)
|
||||
}
|
||||
|
||||
def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicReport cmd) {
|
||||
@@ -377,7 +376,6 @@ def zwaveEvent(physicalgraph.zwave.Command cmd) {
|
||||
}
|
||||
|
||||
def zwaveEvent(physicalgraph.zwave.commands.manufacturerspecificv2.ManufacturerSpecificReport cmd) {
|
||||
log.debug "ManufacturerSpecificReport ${cmd}: value:${cmd}"
|
||||
if (cmd.manufacturerName) {
|
||||
updateDataValue("manufacturer", cmd.manufacturerName)
|
||||
}
|
||||
@@ -389,6 +387,11 @@ log.debug "ManufacturerSpecificReport ${cmd}: value:${cmd}"
|
||||
}
|
||||
}
|
||||
|
||||
def poll() {
|
||||
// Call refresh which will cap the polling to once every 2 minutes
|
||||
refresh()
|
||||
}
|
||||
|
||||
def refresh() {
|
||||
// Only allow refresh every 2 minutes to prevent flooding the Zwave network
|
||||
def timeNow = now()
|
||||
@@ -397,11 +400,11 @@ def refresh() {
|
||||
// refresh will request battery, prevent multiple request by setting lastbatt now
|
||||
state.lastbatt = timeNow
|
||||
// use runIn with overwrite to prevent multiple DTH instances run before state.refreshTriggeredAt has been saved
|
||||
runIn(2, "poll", [overwrite: true])
|
||||
runIn(2, "pollDevice", [overwrite: true])
|
||||
}
|
||||
}
|
||||
|
||||
def poll() {
|
||||
def pollDevice() {
|
||||
def cmds = []
|
||||
cmds << new physicalgraph.device.HubAction(zwave.thermostatModeV2.thermostatModeSupportedGet().format())
|
||||
cmds << new physicalgraph.device.HubAction(zwave.thermostatFanModeV3.thermostatFanModeSupportedGet().format())
|
||||
@@ -614,17 +617,18 @@ def updateThermostatSetpoint(setpoint, value) {
|
||||
* */
|
||||
def ping() {
|
||||
log.debug "ping() called"
|
||||
// Just get Operating State as it is not reported when it chnages and there's no need to flood more commands
|
||||
// Just get Operating State as it is not reported when it changes and there's no need to flood more commands
|
||||
sendHubCommand(new physicalgraph.device.HubAction(zwave.thermostatOperatingStateV1.thermostatOperatingStateGet().format()))
|
||||
}
|
||||
|
||||
def switchMode() {
|
||||
def currentMode = device.currentValue("thermostatMode")
|
||||
def supportedModes = state.supportedModes
|
||||
if (supportedModes) {
|
||||
// Old version of supportedModes was as string, make sure it gets updated
|
||||
if (supportedModes && supportedModes.size() && supportedModes[0].size() > 1) {
|
||||
def next = { supportedModes[supportedModes.indexOf(it) + 1] ?: supportedModes[0] }
|
||||
def nextMode = next(currentMode)
|
||||
runIn(2, "setThermostatMode", [data: [nextMode: nextMode], overwrite: true])
|
||||
runIn(2, "setGetThermostatMode", [data: [nextMode: nextMode], overwrite: true])
|
||||
} else {
|
||||
log.warn "supportedModes not defined"
|
||||
getSupportedModes()
|
||||
@@ -633,9 +637,10 @@ def switchMode() {
|
||||
|
||||
def switchToMode(nextMode) {
|
||||
def supportedModes = state.supportedModes
|
||||
if (supportedModes) {
|
||||
// Old version of supportedModes was as string, make sure it gets updated
|
||||
if (supportedModes && supportedModes.size() && supportedModes[0].size() > 1) {
|
||||
if (supportedModes.contains(nextMode)) {
|
||||
runIn(2, "setThermostatMode", [data: [nextMode: nextMode], overwrite: true])
|
||||
runIn(2, "setGetThermostatMode", [data: [nextMode: nextMode], overwrite: true])
|
||||
} else {
|
||||
log.debug("ThermostatMode $nextMode is not supported by ${device.displayName}")
|
||||
}
|
||||
@@ -654,10 +659,11 @@ def getSupportedModes() {
|
||||
def switchFanMode() {
|
||||
def currentMode = device.currentValue("thermostatFanMode")
|
||||
def supportedFanModes = state.supportedFanModes
|
||||
if (supportedFanModes) {
|
||||
// Old version of supportedFanModes was as string, make sure it gets updated
|
||||
if (supportedFanModes && supportedFanModes.size() && supportedFanModes[0].size() > 1) {
|
||||
def next = { supportedFanModes[supportedFanModes.indexOf(it) + 1] ?: supportedFanModes[0] }
|
||||
def nextMode = next(currentMode)
|
||||
runIn(2, "setThermostatFanMode", [data: [nextMode: nextMode], overwrite: true])
|
||||
runIn(2, "setGetThermostatFanMode", [data: [nextMode: nextMode], overwrite: true])
|
||||
} else {
|
||||
log.warn "supportedFanModes not defined"
|
||||
getSupportedFanModes()
|
||||
@@ -666,9 +672,10 @@ def switchFanMode() {
|
||||
|
||||
def switchToFanMode(nextMode) {
|
||||
def supportedFanModes = state.supportedFanModes
|
||||
if (supportedFanModes) {
|
||||
// Old version of supportedFanModes was as string, make sure it gets updated
|
||||
if (supportedFanModes && supportedFanModes.size() && supportedFanModes[0].size() > 1) {
|
||||
if (supportedFanModes.contains(nextMode)) {
|
||||
runIn(2, "setThermostatFanMode", [data: [nextMode: nextMode], overwrite: true])
|
||||
runIn(2, "setGetThermostatFanMode", [data: [nextMode: nextMode], overwrite: true])
|
||||
} else {
|
||||
log.debug("FanMode $nextMode is not supported by ${device.displayName}")
|
||||
}
|
||||
@@ -679,8 +686,7 @@ def switchToFanMode(nextMode) {
|
||||
}
|
||||
|
||||
def getSupportedFanModes() {
|
||||
def cmds = []
|
||||
cmds << new physicalgraph.device.HubAction(zwave.thermostatFanModeV3.thermostatFanModeSupportedGet().format())
|
||||
def cmds = [new physicalgraph.device.HubAction(zwave.thermostatFanModeV3.thermostatFanModeSupportedGet().format())]
|
||||
sendHubCommand(cmds)
|
||||
}
|
||||
|
||||
@@ -696,10 +702,9 @@ def setThermostatMode(String value) {
|
||||
switchToMode(value)
|
||||
}
|
||||
|
||||
def setThermostatMode(data) {
|
||||
def cmds = []
|
||||
cmds << new physicalgraph.device.HubAction(zwave.thermostatModeV2.thermostatModeSet(mode: modeMap[data.nextMode]).format())
|
||||
cmds << new physicalgraph.device.HubAction(zwave.thermostatModeV2.thermostatModeGet().format())
|
||||
def setGetThermostatMode(data) {
|
||||
def cmds = [new physicalgraph.device.HubAction(zwave.thermostatModeV2.thermostatModeSet(mode: modeMap[data.nextMode]).format()),
|
||||
new physicalgraph.device.HubAction(zwave.thermostatModeV2.thermostatModeGet().format())]
|
||||
sendHubCommand(cmds)
|
||||
}
|
||||
|
||||
@@ -713,10 +718,9 @@ def setThermostatFanMode(String value) {
|
||||
switchToFanMode(value)
|
||||
}
|
||||
|
||||
def setThermostatFanMode(data) {
|
||||
def cmds = []
|
||||
cmds << new physicalgraph.device.HubAction(zwave.thermostatFanModeV3.thermostatFanModeSet(fanMode: fanModeMap[data.nextMode]).format())
|
||||
cmds << new physicalgraph.device.HubAction(zwave.thermostatFanModeV3.thermostatFanModeGet().format())
|
||||
def setGetThermostatFanMode(data) {
|
||||
def cmds = [new physicalgraph.device.HubAction(zwave.thermostatFanModeV3.thermostatFanModeSet(fanMode: fanModeMap[data.nextMode]).format()),
|
||||
new physicalgraph.device.HubAction(zwave.thermostatFanModeV3.thermostatFanModeGet().format())]
|
||||
sendHubCommand(cmds)
|
||||
}
|
||||
|
||||
|
||||
@@ -78,15 +78,21 @@ metadata {
|
||||
attributeState("replacement required", label:"REPLACE", icon:"st.alarm.smoke.test", backgroundColor:"#FFFF66")
|
||||
attributeState("unknown", label:"UNKNOWN", icon:"st.alarm.smoke.test", backgroundColor:"#ffffff")
|
||||
}
|
||||
tileAttribute ("device.battery", key: "SECONDARY_CONTROL") {
|
||||
attributeState "battery", label:'Battery: ${currentValue}%', unit:"%"
|
||||
}
|
||||
}
|
||||
valueTile("battery", "device.battery", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
|
||||
state "battery", label:'${currentValue}% battery', unit:"%"
|
||||
}
|
||||
valueTile("temperature", "device.temperature", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
|
||||
state "temperature", label:'${currentValue}°', unit:"C"
|
||||
valueTile("temperature", "device.temperature", inactiveLabel: false, width: 2, height: 2) {
|
||||
state "temperature", label: '${currentValue}°',
|
||||
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"]
|
||||
]
|
||||
}
|
||||
valueTile("heatAlarm", "device.heatAlarm", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
|
||||
state "clear", label:'TEMPERATURE OK', backgroundColor:"#ffffff"
|
||||
@@ -100,7 +106,7 @@ metadata {
|
||||
}
|
||||
|
||||
main "smoke"
|
||||
details(["smoke","temperature"])
|
||||
details(["smoke","temperature","battery"])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,6 +169,19 @@ def zwaveEvent(physicalgraph.zwave.commands.applicationstatusv1.ApplicationRejec
|
||||
createEvent(displayed: true, descriptionText: "$device.displayName rejected the last request")
|
||||
}
|
||||
|
||||
//crc16
|
||||
def zwaveEvent(physicalgraph.zwave.commands.crc16encapv1.Crc16Encap cmd) {
|
||||
def versions = [0x31: 5, 0x71: 3, 0x84: 1]
|
||||
def version = versions[cmd.commandClass as Integer]
|
||||
def ccObj = version ? zwave.commandClass(cmd.commandClass, version) : zwave.commandClass(cmd.commandClass)
|
||||
def encapsulatedCommand = ccObj?.command(cmd.command)?.parse(cmd.data)
|
||||
if (!encapsulatedCommand) {
|
||||
log.debug "Could not extract command from $cmd"
|
||||
} else {
|
||||
zwaveEvent(encapsulatedCommand)
|
||||
}
|
||||
}
|
||||
|
||||
def zwaveEvent(physicalgraph.zwave.commands.securityv1.SecurityMessageEncapsulation cmd) {
|
||||
setSecured()
|
||||
def encapsulatedCommand = cmd.encapsulatedCommand([0x31: 5, 0x71: 3, 0x84: 1])
|
||||
@@ -342,6 +361,8 @@ def zwaveEvent(physicalgraph.zwave.Command cmd) {
|
||||
def configure() {
|
||||
// Device wakes up every 4 hours, this interval allows us to miss one wakeup notification before marking offline
|
||||
sendEvent(name: "checkInterval", value: 8 * 60 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
||||
//making the default state as "clear"
|
||||
sendEvent(name: "smoke", value: "clear", displayed: false)
|
||||
// This sensor joins as a secure device if you tripple-click the button to include it
|
||||
log.debug "configure() >> isSecured() : ${isSecured()}"
|
||||
if (!isSecured()) {
|
||||
|
||||
@@ -28,6 +28,7 @@ metadata {
|
||||
command "raiseHeatingSetpoint"
|
||||
command "lowerCoolSetpoint"
|
||||
command "raiseCoolSetpoint"
|
||||
command "poll"
|
||||
|
||||
fingerprint deviceId: "0x08"
|
||||
fingerprint inClusters: "0x43,0x40,0x44,0x31"
|
||||
@@ -91,7 +92,7 @@ metadata {
|
||||
standardTile("raiseCoolSetpoint", "device.heatingSetpoint", width:2, height:1, inactiveLabel: false, decoration: "flat") {
|
||||
state "heatingSetpoint", action:"raiseCoolSetpoint", icon:"st.thermostat.thermostat-right"
|
||||
}
|
||||
valueTile("thermostatOperatingState", "device.thermostatOperatingState", width: 2, height:1, decoration: "flat") {
|
||||
standardTile("thermostatOperatingState", "device.thermostatOperatingState", width: 2, height:1, decoration: "flat") {
|
||||
state "thermostatOperatingState", label:'${currentValue}', backgroundColor:"#ffffff"
|
||||
}
|
||||
standardTile("refresh", "device.thermostatMode", width:2, height:1, inactiveLabel: false, decoration: "flat") {
|
||||
@@ -105,9 +106,8 @@ metadata {
|
||||
|
||||
def installed() {
|
||||
// Configure device
|
||||
def cmds = []
|
||||
cmds << new physicalgraph.device.HubAction(zwave.associationV1.associationSet(groupingIdentifier:1, nodeId:[zwaveHubNodeId]).format())
|
||||
cmds << new physicalgraph.device.HubAction(zwave.manufacturerSpecificV2.manufacturerSpecificGet().format())
|
||||
def cmds = [new physicalgraph.device.HubAction(zwave.associationV1.associationSet(groupingIdentifier:1, nodeId:[zwaveHubNodeId]).format()),
|
||||
new physicalgraph.device.HubAction(zwave.manufacturerSpecificV2.manufacturerSpecificGet().format())]
|
||||
sendHubCommand(cmds)
|
||||
runIn(3, "initialize", [overwrite: true]) // Allow configure command to be sent and acknowledged before proceeding
|
||||
}
|
||||
@@ -129,7 +129,7 @@ def initialize() {
|
||||
if (getDataValue("manufacturer") != "Honeywell") {
|
||||
runEvery5Minutes("poll") // This is not necessary for Honeywell Z-wave, but could be for other Z-wave thermostats
|
||||
}
|
||||
poll()
|
||||
pollDevice()
|
||||
}
|
||||
|
||||
def parse(String description)
|
||||
@@ -319,17 +319,22 @@ def zwaveEvent(physicalgraph.zwave.Command cmd) {
|
||||
}
|
||||
|
||||
// Command Implementations
|
||||
def poll() {
|
||||
// Call refresh which will cap the polling to once every 2 minutes
|
||||
refresh()
|
||||
}
|
||||
|
||||
def refresh() {
|
||||
// Only allow refresh every 2 minutes to prevent flooding the Zwave network
|
||||
def timeNow = now()
|
||||
if (!state.refreshTriggeredAt || (2 * 60 * 1000 < (timeNow - state.refreshTriggeredAt))) {
|
||||
state.refreshTriggeredAt = timeNow
|
||||
// use runIn with overwrite to prevent multiple DTH instances run before state.refreshTriggeredAt has been saved
|
||||
runIn(2, "poll", [overwrite: true])
|
||||
runIn(2, "pollDevice", [overwrite: true])
|
||||
}
|
||||
}
|
||||
|
||||
def poll() {
|
||||
def pollDevice() {
|
||||
def cmds = []
|
||||
cmds << new physicalgraph.device.HubAction(zwave.thermostatModeV2.thermostatModeSupportedGet().format())
|
||||
cmds << new physicalgraph.device.HubAction(zwave.thermostatFanModeV3.thermostatFanModeSupportedGet().format())
|
||||
@@ -502,10 +507,11 @@ def ping() {
|
||||
def switchMode() {
|
||||
def currentMode = device.currentValue("thermostatMode")
|
||||
def supportedModes = state.supportedModes
|
||||
if (supportedModes) {
|
||||
// Old version of supportedModes was as string, make sure it gets updated
|
||||
if (supportedModes && supportedModes.size() && supportedModes[0].size() > 1) {
|
||||
def next = { supportedModes[supportedModes.indexOf(it) + 1] ?: supportedModes[0] }
|
||||
def nextMode = next(currentMode)
|
||||
runIn(2, "setThermostatMode", [data: [nextMode: nextMode], overwrite: true])
|
||||
runIn(2, "setGetThermostatMode", [data: [nextMode: nextMode], overwrite: true])
|
||||
} else {
|
||||
log.warn "supportedModes not defined"
|
||||
getSupportedModes()
|
||||
@@ -514,9 +520,10 @@ def switchMode() {
|
||||
|
||||
def switchToMode(nextMode) {
|
||||
def supportedModes = state.supportedModes
|
||||
if (supportedModes) {
|
||||
// Old version of supportedModes was as string, make sure it gets updated
|
||||
if (supportedModes && supportedModes.size() && supportedModes[0].size() > 1) {
|
||||
if (supportedModes.contains(nextMode)) {
|
||||
runIn(2, "setThermostatMode", [data: [nextMode: nextMode], overwrite: true])
|
||||
runIn(2, "setGetThermostatMode", [data: [nextMode: nextMode], overwrite: true])
|
||||
} else {
|
||||
log.debug("ThermostatMode $nextMode is not supported by ${device.displayName}")
|
||||
}
|
||||
@@ -535,10 +542,11 @@ def getSupportedModes() {
|
||||
def switchFanMode() {
|
||||
def currentMode = device.currentValue("thermostatFanMode")
|
||||
def supportedFanModes = state.supportedFanModes
|
||||
if (supportedFanModes) {
|
||||
// Old version of supportedFanModes was as string, make sure it gets updated
|
||||
if (supportedFanModes && supportedFanModes.size() && supportedFanModes[0].size() > 1) {
|
||||
def next = { supportedFanModes[supportedFanModes.indexOf(it) + 1] ?: supportedFanModes[0] }
|
||||
def nextMode = next(currentMode)
|
||||
runIn(2, "setThermostatFanMode", [data: [nextMode: nextMode], overwrite: true])
|
||||
runIn(2, "setGetThermostatFanMode", [data: [nextMode: nextMode], overwrite: true])
|
||||
} else {
|
||||
log.warn "supportedFanModes not defined"
|
||||
getSupportedFanModes()
|
||||
@@ -547,9 +555,10 @@ def switchFanMode() {
|
||||
|
||||
def switchToFanMode(nextMode) {
|
||||
def supportedFanModes = state.supportedFanModes
|
||||
if (supportedFanModes) {
|
||||
// Old version of supportedFanModes was as string, make sure it gets updated
|
||||
if (supportedFanModes && supportedFanModes.size() && supportedFanModes[0].size() > 1) {
|
||||
if (supportedFanModes.contains(nextMode)) {
|
||||
runIn(2, "setThermostatFanMode", [data: [nextMode: nextMode], overwrite: true])
|
||||
runIn(2, "setGetThermostatFanMode", [data: [nextMode: nextMode], overwrite: true])
|
||||
} else {
|
||||
log.debug("FanMode $nextMode is not supported by ${device.displayName}")
|
||||
}
|
||||
@@ -560,8 +569,7 @@ def switchToFanMode(nextMode) {
|
||||
}
|
||||
|
||||
def getSupportedFanModes() {
|
||||
def cmds = []
|
||||
cmds << new physicalgraph.device.HubAction(zwave.thermostatFanModeV3.thermostatFanModeSupportedGet().format())
|
||||
def cmds = [new physicalgraph.device.HubAction(zwave.thermostatFanModeV3.thermostatFanModeSupportedGet().format())]
|
||||
sendHubCommand(cmds)
|
||||
}
|
||||
|
||||
@@ -577,10 +585,9 @@ def setThermostatMode(String value) {
|
||||
switchToMode(value)
|
||||
}
|
||||
|
||||
def setThermostatMode(data) {
|
||||
def cmds = []
|
||||
cmds << new physicalgraph.device.HubAction(zwave.thermostatModeV2.thermostatModeSet(mode: modeMap[data.nextMode]).format())
|
||||
cmds << new physicalgraph.device.HubAction(zwave.thermostatModeV2.thermostatModeGet().format())
|
||||
def setGetThermostatMode(data) {
|
||||
def cmds = [new physicalgraph.device.HubAction(zwave.thermostatModeV2.thermostatModeSet(mode: modeMap[data.nextMode]).format()),
|
||||
new physicalgraph.device.HubAction(zwave.thermostatModeV2.thermostatModeGet().format())]
|
||||
sendHubCommand(cmds)
|
||||
}
|
||||
|
||||
@@ -594,10 +601,9 @@ def setThermostatFanMode(String value) {
|
||||
switchToFanMode(value)
|
||||
}
|
||||
|
||||
def setThermostatFanMode(data) {
|
||||
def cmds = []
|
||||
cmds << new physicalgraph.device.HubAction(zwave.thermostatFanModeV3.thermostatFanModeSet(fanMode: fanModeMap[data.nextMode]).format())
|
||||
cmds << new physicalgraph.device.HubAction(zwave.thermostatFanModeV3.thermostatFanModeGet().format())
|
||||
def setGetThermostatFanMode(data) {
|
||||
def cmds = [new physicalgraph.device.HubAction(zwave.thermostatFanModeV3.thermostatFanModeSet(fanMode: fanModeMap[data.nextMode]).format()),
|
||||
new physicalgraph.device.HubAction(zwave.thermostatFanModeV3.thermostatFanModeGet().format())]
|
||||
sendHubCommand(cmds)
|
||||
}
|
||||
|
||||
@@ -663,7 +669,7 @@ def getTempInDeviceScale(temp, scale) {
|
||||
if (temp && scale) {
|
||||
def deviceScale = (state.scale == 1) ? "F" : "C"
|
||||
return (deviceScale == scale) ? temp :
|
||||
(deviceScale == "F" ? celsiusToFahrenheit(temp) : roundC(fahrenheitToCelsius(temp)))
|
||||
(deviceScale == "F" ? celsiusToFahrenheit(temp).toDouble().round(0).toInteger() : roundC(fahrenheitToCelsius(temp)))
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* If the switch is already on, if won't be affected by the timer (Must be turned of manually)
|
||||
* If the switch is toggled while in timeout-mode, it will remain on and ignore the timer (Must be turned of manually)
|
||||
*
|
||||
* The timeout perid begins when the contact is closed, or motion stops, so leaving a door open won't start the timer until it's closed.
|
||||
* The timeout period begins when the contact is closed, or motion stops, so leaving a door open won't start the timer until it's closed.
|
||||
*
|
||||
* Author: andersheie@gmail.com
|
||||
* Date: 2014-08-31
|
||||
@@ -37,31 +37,29 @@ preferences {
|
||||
}
|
||||
}
|
||||
|
||||
def installed() {
|
||||
initialize()
|
||||
}
|
||||
|
||||
def installed()
|
||||
{
|
||||
def updated() {
|
||||
unsubscribe()
|
||||
initialize()
|
||||
|
||||
log.debug "state: " + state.myState
|
||||
}
|
||||
|
||||
def initialize() {
|
||||
subscribe(switches, "switch", switchChange)
|
||||
subscribe(motions, "motion", motionHandler)
|
||||
subscribe(contacts, "contact", contactHandler)
|
||||
schedule("0 * * * * ?", "scheduleCheck")
|
||||
state.myState = "ready"
|
||||
}
|
||||
|
||||
|
||||
def updated()
|
||||
{
|
||||
unsubscribe()
|
||||
subscribe(motions, "motion", motionHandler)
|
||||
subscribe(switches, "switch", switchChange)
|
||||
subscribe(contacts, "contact", contactHandler)
|
||||
|
||||
state.myState = "ready"
|
||||
log.debug "state: " + state.myState
|
||||
runEvery1Minute("scheduleCheck")
|
||||
state.myState = "ready"
|
||||
}
|
||||
|
||||
def switchChange(evt) {
|
||||
log.debug "SwitchChange: $evt.name: $evt.value"
|
||||
|
||||
|
||||
if(evt.value == "on") {
|
||||
// Slight change of Race condition between motion or contact turning the switch on,
|
||||
// versus user turning the switch on. Since we can't pass event parameters :-(, we rely
|
||||
@@ -84,7 +82,7 @@ def switchChange(evt) {
|
||||
|
||||
def contactHandler(evt) {
|
||||
log.debug "contactHandler: $evt.name: $evt.value"
|
||||
|
||||
|
||||
if (evt.value == "open") {
|
||||
if(state.myState == "ready") {
|
||||
log.debug "Turning on lights by contact opening"
|
||||
@@ -124,7 +122,7 @@ def setActiveAndSchedule() {
|
||||
unschedule()
|
||||
state.myState = "active"
|
||||
state.inactiveAt = now()
|
||||
schedule("0 * * * * ?", "scheduleCheck")
|
||||
runEvery1Minute("scheduleCheck")
|
||||
}
|
||||
|
||||
def scheduleCheck() {
|
||||
|
||||
@@ -279,7 +279,7 @@ def getEcobeeThermostats() {
|
||||
|
||||
Map sensorsDiscovered() {
|
||||
def map = [:]
|
||||
log.info "list ${atomicState.remoteSensors}"
|
||||
log.debug "list ${atomicState.remoteSensors}"
|
||||
atomicState.remoteSensors.each { sensors ->
|
||||
sensors.each {
|
||||
if (it.type != "thermostat") {
|
||||
@@ -440,7 +440,7 @@ def pollChild() {
|
||||
if (!child.device.deviceNetworkId.startsWith("ecobee_sensor")) {
|
||||
if(atomicState.thermostats[child.device.deviceNetworkId] != null) {
|
||||
def tData = atomicState.thermostats[child.device.deviceNetworkId]
|
||||
log.info "pollChild(child)>> data for ${child.device.deviceNetworkId} : ${tData.data}"
|
||||
log.debug "pollChild(child)>> data for ${child.device.deviceNetworkId} : ${tData.data}"
|
||||
child.generateEvent(tData.data) //parse received message from parent
|
||||
} else if(atomicState.thermostats[child.device.deviceNetworkId] == null) {
|
||||
log.error "ERROR: Device connection removed? no data for ${child.device.deviceNetworkId}"
|
||||
@@ -449,7 +449,7 @@ def pollChild() {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log.info "ERROR: pollChildren()"
|
||||
log.error "ERROR: pollChildren()"
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
* ---------------------+----------------+--------------------------+------------------------------------
|
||||
*/
|
||||
|
||||
include 'asynchttp_v1'
|
||||
|
||||
definition(
|
||||
name: "IFTTT",
|
||||
namespace: "smartthings",
|
||||
@@ -249,9 +251,7 @@ def deviceHandler(evt) {
|
||||
def deviceInfo = state[evt.deviceId]
|
||||
if (deviceInfo) {
|
||||
try {
|
||||
httpPostJson(uri: deviceInfo.callbackUrl, path: '', body: [evt: [deviceId: evt.deviceId, name: evt.name, value: evt.value]]) {
|
||||
log.debug "[PROD IFTTT] Event data successfully posted"
|
||||
}
|
||||
asynchttp_v1.post([uri: deviceInfo.callbackUrl, path: '', body: [evt: [deviceId: evt.deviceId, name: evt.name, value: evt.value]]])
|
||||
} catch (groovyx.net.http.ResponseParseException e) {
|
||||
log.debug("Error parsing ifttt payload ${e}")
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ def authPage() {
|
||||
|
||||
def oauthInit() {
|
||||
def oauthParams = [client_id: "${appSettings.clientId}", scope: "remote_control:all", response_type: "code" ]
|
||||
log.info("Redirecting user to OAuth setup")
|
||||
log.debug("Redirecting user to OAuth setup")
|
||||
redirect(location: "https://cloud.lifx.com/oauth/authorize?${toQueryString(oauthParams)}")
|
||||
}
|
||||
|
||||
@@ -265,7 +265,7 @@ def updated() {
|
||||
}
|
||||
|
||||
def uninstalled() {
|
||||
log.info("Uninstalling, removing child devices...")
|
||||
log.debug("Uninstalling, removing child devices...")
|
||||
unschedule('updateDevices')
|
||||
removeChildDevices(getChildDevices())
|
||||
}
|
||||
@@ -305,8 +305,8 @@ Map apiRequestHeaders() {
|
||||
// Requests
|
||||
|
||||
def logResponse(response) {
|
||||
log.info("Status: ${response.status}")
|
||||
log.info("Body: ${response.data}")
|
||||
log.debug("Status: ${response.status}")
|
||||
log.debug("Body: ${response.data}")
|
||||
}
|
||||
|
||||
// API Requests
|
||||
@@ -428,7 +428,7 @@ def updateDevices() {
|
||||
state.devices[device.id] = [online: device.connected]
|
||||
}
|
||||
getChildDevices().findAll { !selectors.contains("${it.deviceNetworkId}") }.each {
|
||||
log.info("Deleting ${it.deviceNetworkId}")
|
||||
log.debug("Deleting ${it.deviceNetworkId}")
|
||||
if (state.devices[it.deviceNetworkId])
|
||||
state.devices[it.deviceNetworkId] = null
|
||||
// The reason the implementation is trying to delete this bulb is because it is not longer connected to the LIFX location.
|
||||
|
||||
Reference in New Issue
Block a user