Merge pull request #1852 from marstorp/zwaveThermostat-ICP493-fixInvalidValues

ICP-493 Thermostat Capabilities Payload Issues
This commit is contained in:
Vinay Rao
2017-04-03 19:52:00 -07:00
committed by GitHub

View File

@@ -42,9 +42,9 @@ metadata {
status "auto" : "command: 4003, payload: 03" status "auto" : "command: 4003, payload: 03"
status "emergencyHeat" : "command: 4003, payload: 04" status "emergencyHeat" : "command: 4003, payload: 04"
status "fanAuto" : "command: 4403, payload: 00" status "auto" : "command: 4403, payload: 00" // "fanAuto"
status "fanOn" : "command: 4403, payload: 01" status "on" : "command: 4403, payload: 01" // "fanOn"
status "fanCirculate" : "command: 4403, payload: 06" status "circulate" : "command: 4403, payload: 06" // "fanCirculate
status "heat 60" : "command: 4303, payload: 01 09 3C" status "heat 60" : "command: 4303, payload: 01 09 3C"
status "heat 68" : "command: 4303, payload: 01 09 44" status "heat 68" : "command: 4303, payload: 01 09 44"
@@ -74,8 +74,9 @@ metadata {
} }
tiles { tiles {
valueTile("temperature", "device.temperature", width: 2, height: 2) { // Using standardTile instead of valueTile as it renders the icon better
state("temperature", label:'${currentValue}°', standardTile("temperature", "device.temperature", width: 2, height: 2) {
state("temperature", label:'${currentValue}°', icon: "st.thermostat.ac.air-conditioning",
backgroundColors:[ backgroundColors:[
[value: 31, color: "#153591"], [value: 31, color: "#153591"],
[value: 44, color: "#1e9cbb"], [value: 44, color: "#1e9cbb"],
@@ -88,19 +89,20 @@ metadata {
) )
} }
standardTile("mode", "device.thermostatMode", inactiveLabel: false, decoration: "flat") { standardTile("mode", "device.thermostatMode", inactiveLabel: false, decoration: "flat") {
state "off", label:'${name}', action:"switchMode", nextState:"to_heat" state "off", action:"switchMode", nextState:"to_heat", icon: "st.thermostat.heating-cooling-off"
state "heat", label:'${name}', action:"switchMode", nextState:"to_cool" state "heat", action:"switchMode", nextState:"to_cool", icon: "st.thermostat.heat"
state "cool", label:'${name}', action:"switchMode", nextState:"..." state "cool", action:"switchMode", nextState:"...", icon: "st.thermostat.cool"
state "auto", label:'${name}', action:"switchMode", nextState:"..." state "auto", action:"switchMode", nextState:"...", icon: "st.thermostat.auto"
state "emergency heat", label:'${name}', action:"switchMode", nextState:"..." state "emergency heat", action:"switchMode", nextState:"...", icon: "st.thermostat.emergency-heat"
state "to_heat", label: "heat", action:"switchMode", nextState:"to_cool" state "to_heat", action:"switchMode", nextState:"to_cool", icon: "st.thermostat.heat"
state "to_cool", label: "cool", action:"switchMode", nextState:"..." state "to_cool", action:"switchMode", nextState:"...", icon: "st.thermostat.cool"
state "...", label: "...", action:"off", nextState:"off" state "...", label: "...", action:"off", nextState:"off"
} }
standardTile("fanMode", "device.thermostatFanMode", inactiveLabel: false, decoration: "flat") { standardTile("fanMode", "device.thermostatFanMode", inactiveLabel: false, decoration: "flat") {
state "fanAuto", label:'${name}', action:"switchFanMode" state "auto", action:"switchFanMode", nextState:"...", icon: "st.thermostat.fan-auto" // "fanAuto"
state "fanOn", label:'${name}', action:"switchFanMode" state "on", action:"switchFanMode", nextState:"...", icon: "st.thermostat.fan-on" // "fanOn"
state "fanCirculate", label:'${name}', action:"switchFanMode" state "circulate", action:"switchFanMode", nextState:"...", icon: "st.thermostat.fan-circulate" // "fanCirculate"
state "...", label: "...", nextState:"..."
} }
controlTile("heatSliderControl", "device.heatingSetpoint", "slider", height: 1, width: 2, inactiveLabel: false) { controlTile("heatSliderControl", "device.heatingSetpoint", "slider", height: 1, width: 2, inactiveLabel: false) {
state "setHeatingSetpoint", action:"quickSetHeat", backgroundColor:"#d04e00" state "setHeatingSetpoint", action:"quickSetHeat", backgroundColor:"#d04e00"
@@ -117,11 +119,8 @@ metadata {
standardTile("refresh", "device.thermostatMode", inactiveLabel: false, decoration: "flat") { standardTile("refresh", "device.thermostatMode", inactiveLabel: false, decoration: "flat") {
state "default", action:"polling.poll", icon:"st.secondary.refresh" state "default", action:"polling.poll", icon:"st.secondary.refresh"
} }
standardTile("configure", "device.configure", inactiveLabel: false, decoration: "flat") {
state "configure", label:'', action:"configuration.configure", icon:"st.secondary.configure"
}
main "temperature" main "temperature"
details(["temperature", "mode", "fanMode", "heatSliderControl", "heatingSetpoint", "coolSliderControl", "coolingSetpoint", "refresh", "configure"]) details(["temperature", "mode", "fanMode", "heatSliderControl", "heatingSetpoint", "coolSliderControl", "coolingSetpoint", "refresh"])
} }
} }
@@ -286,13 +285,13 @@ def zwaveEvent(physicalgraph.zwave.commands.thermostatfanmodev3.ThermostatFanMod
def map = [:] def map = [:]
switch (cmd.fanMode) { switch (cmd.fanMode) {
case physicalgraph.zwave.commands.thermostatfanmodev3.ThermostatFanModeReport.FAN_MODE_AUTO_LOW: case physicalgraph.zwave.commands.thermostatfanmodev3.ThermostatFanModeReport.FAN_MODE_AUTO_LOW:
map.value = "fanAuto" map.value = "auto" // "fanAuto"
break break
case physicalgraph.zwave.commands.thermostatfanmodev3.ThermostatFanModeReport.FAN_MODE_LOW: case physicalgraph.zwave.commands.thermostatfanmodev3.ThermostatFanModeReport.FAN_MODE_LOW:
map.value = "fanOn" map.value = "on" // "fanOn"
break break
case physicalgraph.zwave.commands.thermostatfanmodev3.ThermostatFanModeReport.FAN_MODE_CIRCULATION: case physicalgraph.zwave.commands.thermostatfanmodev3.ThermostatFanModeReport.FAN_MODE_CIRCULATION:
map.value = "fanCirculate" map.value = "circulate" // "fanCirculate"
break break
} }
map.name = "thermostatFanMode" map.name = "thermostatFanMode"
@@ -309,15 +308,19 @@ def zwaveEvent(physicalgraph.zwave.commands.thermostatmodev2.ThermostatModeSuppo
if(cmd.auto) { supportedModes += "auto " } if(cmd.auto) { supportedModes += "auto " }
state.supportedModes = supportedModes state.supportedModes = supportedModes
// No events to be generated, return empty map
return [:]
} }
def zwaveEvent(physicalgraph.zwave.commands.thermostatfanmodev3.ThermostatFanModeSupportedReport cmd) { def zwaveEvent(physicalgraph.zwave.commands.thermostatfanmodev3.ThermostatFanModeSupportedReport cmd) {
def supportedFanModes = "" def supportedFanModes = ""
if(cmd.auto) { supportedFanModes += "fanAuto " } if(cmd.auto) { supportedFanModes += "auto " } // "fanAuto "
if(cmd.low) { supportedFanModes += "fanOn " } if(cmd.low) { supportedFanModes += "on " } // "fanOn"
if(cmd.circulation) { supportedFanModes += "fanCirculate " } if(cmd.circulation) { supportedFanModes += "circulate " } // "fanCirculate"
state.supportedFanModes = supportedFanModes state.supportedFanModes = supportedFanModes
// No events to be generated, return empty map
return [:]
} }
def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicReport cmd) { def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicReport cmd) {
@@ -412,7 +415,13 @@ def configure() {
delayBetween([ delayBetween([
zwave.thermostatModeV2.thermostatModeSupportedGet().format(), zwave.thermostatModeV2.thermostatModeSupportedGet().format(),
zwave.thermostatFanModeV3.thermostatFanModeSupportedGet().format(), zwave.thermostatFanModeV3.thermostatFanModeSupportedGet().format(),
zwave.associationV1.associationSet(groupingIdentifier:1, nodeId:[zwaveHubNodeId]).format() zwave.associationV1.associationSet(groupingIdentifier:1, nodeId:[zwaveHubNodeId]).format(),
zwave.sensorMultilevelV3.sensorMultilevelGet().format(), // current temperature
zwave.thermostatSetpointV1.thermostatSetpointGet(setpointType: 1).format(),
zwave.thermostatSetpointV1.thermostatSetpointGet(setpointType: 2).format(),
zwave.thermostatModeV2.thermostatModeGet().format(),
zwave.thermostatFanModeV3.thermostatFanModeGet().format(),
zwave.thermostatOperatingStateV1.thermostatOperatingStateGet().format()
], 2300) ], 2300)
} }
@@ -453,11 +462,11 @@ def switchToMode(nextMode) {
def switchFanMode() { def switchFanMode() {
def currentMode = device.currentState("thermostatFanMode")?.value def currentMode = device.currentState("thermostatFanMode")?.value
def lastTriedMode = state.lastTriedFanMode ?: currentMode ?: "off" def lastTriedMode = state.lastTriedFanMode ?: currentMode ?: "off"
def supportedModes = getDataByName("supportedFanModes") ?: "fanAuto fanOn" def supportedModes = getDataByName("supportedFanModes") ?: "auto on" // "fanAuto fanOn"
def modeOrder = ["fanAuto", "fanCirculate", "fanOn"] def modeOrder = ["auto", "circulate", "on"] // "fanAuto", "fanCirculate", "fanOn"
def next = { modeOrder[modeOrder.indexOf(it) + 1] ?: modeOrder[0] } def next = { modeOrder[modeOrder.indexOf(it) + 1] ?: modeOrder[0] }
def nextMode = next(lastTriedMode) def nextMode = next(lastTriedMode)
while (!supportedModes?.contains(nextMode) && nextMode != "fanAuto") { while (!supportedModes?.contains(nextMode) && nextMode != "auto") { // "fanAuto"
nextMode = next(nextMode) nextMode = next(nextMode)
} }
switchToFanMode(nextMode) switchToFanMode(nextMode)
@@ -468,11 +477,11 @@ def switchToFanMode(nextMode) {
if(supportedFanModes && !supportedFanModes.contains(nextMode)) log.warn "thermostat mode '$nextMode' is not supported" if(supportedFanModes && !supportedFanModes.contains(nextMode)) log.warn "thermostat mode '$nextMode' is not supported"
def returnCommand def returnCommand
if (nextMode == "fanAuto") { if (nextMode == "auto") { // "fanAuto"
returnCommand = fanAuto() returnCommand = fanAuto()
} else if (nextMode == "fanOn") { } else if (nextMode == "on") { // "fanOn"
returnCommand = fanOn() returnCommand = fanOn()
} else if (nextMode == "fanCirculate") { } else if (nextMode == "circulate") { // "fanCirculate"
returnCommand = fanCirculate() returnCommand = fanCirculate()
} else { } else {
log.debug("no fan mode '$nextMode'") log.debug("no fan mode '$nextMode'")