Device Handler:
/**
* Rheem Econet HVAC
*
* Copyright 2017 Justin Huff
*
* 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.
*
* Last Updated : 2017-01-04
*
* Based on https://github.com/copy-ninja/SmartThings_RheemEcoNet
*/
metadata {
definition (name: "Rheem Econet HVAC", namespace: "jjhuff", author: "Justin Huff") {
capability "Actuator"
capability "Thermostat"
capability "Sensor"
capability "Polling"
capability "Refresh"
capability "Relative Humidity Measurement"
capability "Temperature Measurement"
capability "Thermostat Cooling Setpoint"
capability "Thermostat Fan Mode"
capability "Thermostat Heating Setpoint"
capability "Thermostat Mode"
capability "Thermostat Operating State"
capability "Thermostat Setpoint"
command "heatLevelUp"
command "heatLevelDown"
command "coolLevelUp"
command "coolLevelDown"
command "updateDeviceData", ["string"]
command "thermostatOperatingState", ["string"]
command "setFollowingSchedule"
command "setCancelSchedule"
command "setFanAuto"
command "setFanLow"
command "setFanMedium"
command "setFanHigh"
attribute "thermostatOperatingState", "string"
attribute "alert", "string"
}
simulator { }
tiles(scale: 2) {
multiAttributeTile(name:"tempSummary", type:"thermostat", width:6, height:4) {
tileAttribute("device.temperature", key: "PRIMARY_CONTROL") {
attributeState("default", label:'${currentValue}°'/*, unit:"dF", defaultState: true*/
)
}
/*tileAttribute("device.temperature", key: "VALUE_CONTROL") {
attributeState("default", action: "setTemperature")
}*/
tileAttribute("device.humidity", key: "SECONDARY_CONTROL") {
attributeState("default", label:'${currentValue}%', unit:"%")
}
tileAttribute("device.thermostatOperatingState", key: "OPERATING_STATE") {
attributeState("idle", backgroundColor:"#44b621")
attributeState("heating", backgroundColor:"#ffa81e")
attributeState("cooling", backgroundColor:"#269bd2")
}
tileAttribute("device.thermostatMode", key: "THERMOSTAT_MODE") {
attributeState("Off", label:'${name}')
attributeState("Heating", label:'${name}')
attributeState("Cooling", label:'${name}')
attributeState("Auto", label:'${name}')
attributeState("Fan Only", label:'${name}')
attributeState("Emergency Heat", label:'${name}')
}
tileAttribute("device.heatingSetpoint", key: "HEATING_SETPOINT") {
attributeState("default", label:'${currentValue}', unit:"dF")
}
tileAttribute("device.coolingSetpoint", key: "COOLING_SETPOINT") {
attributeState("default", label:'${currentValue}', unit:"dF")
}
} // End multiAttributeTile
valueTile("heatingSetpoint", "device.heatingSetpoint", inactiveLabel: false, width: 2, height: 2) {
state("heatingSetpoint", label:'${currentValue}°', backgroundColor:"#d04e00"
)
}
valueTile("coolingSetpoint", "device.coolingSetpoint", inactiveLabel: false, width: 2, height: 2) {
state("coolingSetpoint", label:'${currentValue}°', backgroundColor:"#1e9cbb"
)
}
standardTile("heatLevelUp", "device.switch", canChangeIcon: false, decoration: "flat" ) {
state("heatLevelUp", action:"heatLevelUp", label:"Heat", icon:"st.thermostat.thermostat-up")
}
standardTile("heatLevelDown", "device.switch", canChangeIcon: false, decoration: "flat") {
state("heatLevelDown", action:"heatLevelDown", label:"Heat",icon:"st.thermostat.thermostat-down")
}
standardTile("coolLevelUp", "device.switch", canChangeIcon: false, decoration: "flat" ) {
state("coolLevelUp", action:"coolLevelUp", label:"Cool", icon:"st.thermostat.thermostat-up")
}
standardTile("coolLevelDown", "device.switch", canChangeIcon: false, decoration: "flat") {
state("coolLevelDown", action:"coolLevelDown", label:"Cool", icon:"st.thermostat.thermostat-down")
}
standardTile("switch", "device.switch", canChangeIcon: false, decoration: "flat" ) {
state "on", label: 'On', action: "switch.off",
icon: "st.switches.switch.on", backgroundColor: "#79b821"
state("off", label: 'Off', action: "switch.on",
icon: "st.switches.switch.off", backgroundColor: "#ffffff")
}
standardTile("refresh", "device.switch", decoration: "flat", width: 2, height: 2) {
state("default", action:"refresh.refresh", icon:"st.secondary.refresh")
}
standardTile("mode", "device.thermostatMode", inactiveLabel:true, decoration: "flat", width: 2, height: 2) {
//state "default", label:'[Mode]'
state "Off", label:'', icon:"st.thermostat.heating-cooling-off", action:"thermostat.Heating"//, nextState: "updating", backgroundColor:"#FFFFFF"
state "Heating", label:'', icon:"st.thermostat.heat", action:"thermostat.Cooling"//, nextState: "updating", backgroundColor:"#FFCC99"
state "Cooling", label:'', icon:"st.thermostat.cool", action:"thermostat.Auto"//, nextState: "updating", backgroundColor:"#99CCFF"
state "Auto", label:'', icon:"st.thermostat.auto", action:"thermostat.Fan Only"//, nextState: "updating", backgroundColor:"#99FF99"
state "Fan Only", label:'', icon:"st.thermostat.fan-on", action:"thermostat.Off"//, nextState: "updating", backgroundColor:"#99FF99"
state "Emergency Heat", label:'', icon:"st.thermostat.emergency-heat", action:"thermostat.Off"//, backgroundColor:"#FFCC99"
state "updating", label:"Working", icon: "st.secondary.secondary"
}
valueTile("fanSpeed", "device.fanSpeed", inactiveLabel: false, decoration: "flat", width: 2, height: 1) {
state("default", label:'fanspeed: ${currentValue}'//, icon: "st.thermostat.fan-off"
)
}
valueTile("outdoorTemperature", "device.outdoorTemperature", inactiveLabel: false, width: 1, height: 1) {
state("outdoorTemperature", label:'${currentValue}°',icon: "st.Outdoor.outdoor21"
)
}
standardTile("alert", "device.alert", decoration: "flat", inactiveLabel: false) {
state "true", label: 'Alert!', icon: "st.alarm.water.wet"
state "false", label: 'No Alert', icon: "st.alarm.water.dry"
}
standardTile("iconTile", "device.temperature", decoration: "flat", width: 2, height: 2, canChangeIcon: true) {
state "default", label:'${currentValue}°', icon: "st.Weather.weather2", backgroundColor: "#79B821"
}
standardTile("operatingState", "device.thermostatOperatingState", inactiveLabel:false, decoration:"flat", width: 2, height: 1) {
state "heating", label:'${currentValue}', action:"polling.poll"
state "cooling", label:'${currentValue}', action:"polling.poll"
state "idle", label:'${currentValue}', action:"polling.poll"
}
standardTile("State", "device.inUse", inactiveLabel:false, decoration:"flat", width: 2, height: 1) {
state "off", label:'${currentValue}'
state "on", label:'${currentValue}'
}
standardTile("isFollowingSchedule", "device.isFollowingSchedule", inactiveLabel: false, decoration:"flat", width: 2, height: 1) {
state "Following Schedule", label:'${currentValue}', action:"setCancelSchedule"
state "Resume Schedule", label:'${currentValue}', action:"setFollowingSchedule"
}
standardTile("thermostatFanMode", "device.thermostatFanMode", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
state "Auto", icon: "st.thermostat.fan-auto", action:"setFanLow"
state "Low", label:'Low', icon: "st.thermostat.fan-on", action:"setFanMedium"
//state "Med.Lo", label:'M-Low', icon: "st.thermostat.fan-on", action:"setFanMedium"
state "Medium", label:'Med', icon: "st.thermostat.fan-on", action:"setFanHigh"
//state "Med.Hi", label:'M-High', icon: "st.thermostat.fan-on", action:"setFanHigh"
state "High", label:'High', icon: "st.thermostat.fan-on", action:"setFanAuto"
}
main (["iconTile"])
details(["tempSummary", "outdoorTemperature", "operatingState", "isFollowingSchedule", "alert", "coolLevelUp", "coolingSetpoint", "heatingSetpoint", "heatLevelUp", "coolLevelDown", "heatLevelDown",
"mode", "thermostatFanMode", "refresh", "fanSpeed"
])
}
}
def parse(String description) { }
def refresh() {
log.debug "refresh"
parent.refresh()
poll()
}
def setFanAuto() {
sendEvent(name: "thermostatFanMode", value: "Auto")
parent.setFanMode(this.device, "Auto")
}
def setFanLow() {
sendEvent(name: "thermostatFanMode", value: "Low")
parent.setFanMode(this.device, "Low")
}
def setFanMedium() {
sendEvent(name: "thermostatFanMode", value: "Medium")
parent.setFanMode(this.device, "Medium")
}
def setFanHigh() {
sendEvent(name: "thermostatFanMode", value: "High")
parent.setFanMode(this.device, "High")
}
def setHeatingSetpoint(Number heatSetPoint) {
sendEvent(name: "heatingSetpoint", value: heatSetPoint, unit: "F")
parent.setHeatSetPoint(this.device, heatSetPoint)
}
def setCoolingSetpoint(Number coolSetPoint) {
sendEvent(name: "coolingSetpoint", value: coolSetPoint, unit: "F")
parent.setCoolSetPoint(this.device, coolSetPoint)
}
def heatLevelUp() {
def heatSetPoint = device.currentValue("heatingSetpoint")
heatSetPoint = heatSetPoint + 1
setHeatingSetpoint(heatSetPoint)
}
def heatLevelDown() {
def heatSetPoint = device.currentValue("heatingSetpoint")
heatSetPoint = heatSetPoint - 1
setHeatingSetpoint(heatSetPoint)
}
def coolLevelUp() {
def coolSetPoint = device.currentValue("coolingSetpoint")
coolSetPoint = coolSetPoint + 1
setCoolingSetpoint(coolSetPoint)
}
def coolLevelDown() {
def coolSetPoint = device.currentValue("coolingSetpoint")
coolSetPoint = coolSetPoint - 1
setCoolingSetpoint(coolSetPoint)
}
def setFollowingSchedule() {
parent.setFollowSchedule(this.device, true)
sendEvent(name: "isFollowingSchedule", value: "Following Schedule")
}
def setCancelSchedule() {
parent.setFollowSchedule(this.device, false)
sendEvent(name: "isFollowingSchedule", value: "Resume Schedule")
}
def poll() {
log.info "Polling..."
def active = device.currentValue("inUse")
def modes = device.currentValue("thermostatMode")
if (active == "off") {
sendEvent(name: "thermostatOperatingState", value: "idle")
}
else if (modes == "Cooling") {
sendEvent(name: "thermostatOperatingState", value: "cooling")
}
else if (modes == "Auto") {
sendEvent(name: "thermostatOperatingState", value: "auto")
}
else if (modes == "Fan Only") {
sendEvent(name: "thermostatOperatingState", value: "fan only")
}
else { sendEvent(name: "thermostatOperatingState", value: "heating")
}
}
def updateDeviceData(data) {
sendEvent(name: "heatingSetpoint", value: data.heatSetPoint, unit: "F")
sendEvent(name: "minHeatSetPoint", value: data.minHeatSetPoint, unit: "F")
sendEvent(name: "maxHeatSetPoint", value: data.maxHeatSetPoint, unit: "F")
sendEvent(name: "coolingSetpoint", value: data.coolSetPoint, unit: "F")
sendEvent(name: "minCoolSetPoint", value: data.minCoolSetPoint, unit: "F")
sendEvent(name: "maxCoolSetPoint", value: data.maxCoolSetPoint, unit: "F")
sendEvent(name: "switch", value: data.isEnabled ? "on" : "off")
sendEvent(name: "humidity", value: (String.format("%3.0f",data.indoorHumidityPercentage)), unit: "%")
sendEvent(name: "temperature", value: data.indoorTemperature, unit: "F")
sendEvent(name: "outdoorTemperature", value: data.outdoorTemperature, unit: "F")
sendEvent(name: "thermostatMode", value: data.mode)
sendEvent(name: "thermostatFanMode", value: data.fanMode)
sendEvent(name: "fanSpeed", value: data.fanSpeed)
sendEvent(name: "inUse", value: data.inUse ? "on" : "off")
sendEvent(name: "alert", value: data.hasCriticalAlert ? "true" : "false")
sendEvent(name: "isFollowingSchedule", value: data.isFollowingSchedule ? "Following Schedule" : "Resume Schedule")
}