[problem/question] default ENUMs in drivers (thermostat)

Hi all,

This morning I upgraded to version 2.3.4.117 and a custom Thermostat driver stopped working in my dashboards.
Perhaps my understanding is incorrect.

I created a minimal driver:

metadata {
    definition(name: "ThermostatTester", namespace: "a", author: "a") {
        capability "Thermostat"
    }
    preferences {
    }
}

When I add it to a dashboard and select mode (or fanmode), an error is thrown in the javascript console

SyntaxError: Unexpected token 'a', "auto,cool,"... is not valid JSON
    at JSON.parse (<anonymous>)
    at a.supportedThermostatModes (app.js?t=2.3.3:1:209170)
    at nr.get (chunk-vendors.js?t=2.3.3:7:30684)
    at nr.evaluate (chunk-vendors.js?t=2.3.3:7:31685)
    at a.supportedThermostatModes (chunk-vendors.js?t=2.3.3:7:33378)
    at a.vi (app.js?t=2.3.3:1:205695)
    at t._render (chunk-vendors.js?t=2.3.3:7:23733)
    at a.r (chunk-vendors.js?t=2.3.3:7:27824)
    at nr.get (chunk-vendors.js?t=2.3.3:7:30684)
    at nr.run (chunk-vendors.js?t=2.3.3:7:31417)

I thought that there were sane defaults for enums (e.g. supportedThermostatModes)? Am I mistaken, do I have to implement them all?

Yes, there are no defaults for supportedThermostatModes, or an attribute name beginning with supported..

1 Like

@mike.maxwell Great, thank you for a quick response!

I noticed where things are working different than before (been long ago that I wrote that driver):

metadata {
    definition(name: "ThermostatTester", namespace: "a", author: "a") {
        capability "Thermostat"
        capability "Configuration"
    }
    preferences {
    }

}

def configure() {
    sendEvent(name: "supportedThermostatModes", value: '["auto", "heat"]')
}

I previously passed in a list as value of sendEvent, that has to be changed to a (json) string now. That used to work.

(I am wonder what the "auto,cool," is doing in the stack trace)

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.