Since the lack of home/away mode in Thermostat seems a sticking point here, as well as with my Sinope thermostats, is there a possibility you could add a home/away mode as part of the standard Thermostat function? I wonder how many thermostat apis directly support a home/away mode.
Specifically, the updated drivers for Sinope’s newer zwave thermostat api refers to it as occupancy, with modes occupy and unoccupy. Seems odd terminology.
//-- Occupancy -------------------------------------------------------------------------------------------
def occupancySts() {
["unoccupy", "occupy"]
}
def getOccupancyMap() {
[
"00": "unoccupy",
"01": "occupy"
]
}
def setOccupancyStatus() {
traceEvent(settings.logFilter, "setOccupancyStatus>switching occupancy status", settings.trace)
def currentStatus = device.currentState("occupancyStatus")?.value
traceEvent(settings.logFilter, "setOccupancyStatus>Occupancy :$currentStatus", settings.trace)
def statusOrder = occupancySts()
def index = statusOrder.indexOf(currentStatus)
traceEvent(settings.logFilter, "setOccupancyStatus>Index = $index", settings.trace)
def next = (index >= 0 && index < (statusOrder.size() - 1)) ? statusOrder[index + 1] : statusOrder[0]
traceEvent(settings.logFilter, "setOccupancyStatus>switching occupancy from $currentStatus to $next", settings.trace)
"$next" ()
}
void away() {
unoccupy()
}
void unoccupy() {
traceEvent(settings.logFilter, "unoccupy>Set unoccupy", settings.trace)
sendEvent(name: "occupancyStatus", value: "unoccupy", displayed: true)
sendEvent(name: "presence", value: "non present", displayed: true)
state?.previousOccupyTemp = device.currentValue("heatingSetpoint")
def cmds = []
cmds += zigbee.writeAttribute(0x0201, 0x0400, 0x30, 0x00, [mfgCode: 0x119C])
cmds += zigbee.readAttribute(0x0201, 0x0002)
cmds += zigbee.readAttribute(0x0201, 0x0014)
sendZigbeeCommands(cmds)
def scale = state?.scale
def heatingSetpointRangeLow
try {
heatingSetpointRangeLow = device.latestValue("heatingSetpointRangeLow")
} catch (any) {
traceEvent(settings.logFilter, "unoccupy>not able to get heatingSetpointRangeLow ($heatingSetpointRangeLow),using default value",
settings.trace, get_LOG_WARN())
}
heatingSetpointRangeLow = (heatingSetpointRangeLow) ?: (scale == 'C') ? 10.0 : 50
sendEvent(name: "thermostatSetpoint", value: heatingSetpointRangeLow, unit: scale, displayed: true)
sendEvent(name: "heatingSetpoint", value: heatingSetpointRangeLow, unit: scale, displayed: true)
}
void present() {
occupy()
}
void occupy() {
def scale = state?.scale
traceEvent(settings.logFilter, "occupy>Set occupy", settings.trace)
sendEvent(name: "occupancyStatus", value: "occupy", displayed: true)
sendEvent(name: "presence", value: "present", displayed: true)
def cmds = []
cmds += zigbee.writeAttribute(0x0201, 0x0400, 0x30, 0x01, [mfgCode: 0x119C])
cmds += zigbee.readAttribute(0x0201, 0x0002)
cmds += zigbee.readAttribute(0x0201, 0x0012)
sendZigbeeCommands(cmds)
def temp = (state?.previousOccupyTemp) ? state ?.previousOccupyTemp : (scale == 'C') ? 20.0 : 70
sendEvent(name: "thermostatSetpoint", value: temp, unit: scale, displayed: true)
sendEvent(name: "heatingSetpoint", value: temp, unit: scale, displayed: true)
}