Can the temperature setpoint of a thermostat be "read"?

I'm trying to "read" the setpoint of a Virtual Thermostat (which will become a physical thermostat once things are sorted out)

I'm tried a number of permeations in the code, my latest one is shown. Each time the Thermostat Object's "thermostatSetpoint" returns NULL.
Perhaps this cannot be read?


/*
  Test Thermostat Object
*/

definition(
    name: "TEST Thermostat Object",
    namespace: "hubitat", author: "JohnRob",
    description: "TEST Custom Control for A/C in multilevel Home",
    category: "Ctrl function", iconUrl: "", iconX2Url: "")
    
    
preferences {
	page(name: "mainPage")
}

def mainPage() {
	dynamicPage(name: "mainPage", title: " ", install: true, uninstall: true) {
		section {
            input "tempSensor", "capability.temperatureMeasurement", title: "Select Temperature Sensors", submitOnChange: true, required: true, multiple: false 			
			input "thermostatObject", "capability.thermostat", title: "Select Thermostat to Ctrl", submitOnChange: true, required: true, multiple: false
}}}

def installed() {
	initialize()
}

def updated() {
	unsubscribe()
	initialize()
}

def initialize() {
	subscribe(tempSensor, "temperature", tempHandler)
	subscribe(thermostatObject, "thermostatSetpoint", currentSetPtHandler)
}

def tempHandler(evt) {
	tstatSetpoint = thermostatObject.thermostatSetpoint
    log.debug "64 tempHandler() called: ${evt.name} ${evt.value} ${tstatSetpoint} "  // <<<<<<< tstatSetpoint returns null.
}
// --- eof ---


You need to use one of these instead. Attributes (in the Hubitat sense) on a device are not properties on the actual object:

thermostatObject.currentValue("thermostatSetpoint")

or the shortcut equivalent:

thermostatObject.currentThermostatSetpoint

1 Like