supportedFanSpeeds in 2.2.6

Has anyone figured out how to use the new supportedFanSpeeds attribute in 2.2.6 for the FanControl capability? It's defined as having type JSON_OBJECT, and a simple JSON array of the supported speed names from among Hubitat's possibilities is the only thing that would make sense to me. So, that would give you something like:

List<String> fanSpeedList = ["low", "medium", "high", "auto", "off"]
groovy.json.JsonBuilder fanSpeedsJSON = new groovy.json.JsonBuilder(fanSpeedList)
sendEvent(name: "supportedFanSpeeds", value: fanSpeedsJSON)

This seems to work, in that the attribute value gets populated. However, it does not have any effect: the "Set Speed" command on the device page still shows all options (not sure if this was ever really intended to change that, though), and a Dashboard tile still shows all of them too (do I remember that this was part of the reason for introducing this?).

So, I guess that leaves two possibilities: I'm doing it wrong, or 2.2.6 is a "transitional" release that introduces the capability changes but doesn't make use of them yet. I'm used to the former being the case, but given similar changes in 2.2.6 that also haven't been made use of yet, I'm guessing it might be the latter this time. :slight_smile: Anyone know for sure? (Guessing staff would have to comment on this since I see no other documentation than the above, but if anyone happens to have figured something out regardles...)

If you want the enum list in the device setSpeed command to reflect the values in your custom supportedFanSpeeds you will need to override the capability setSpeed command in the driver via something like:

command "setSpeed", [[name: "Fan speed*",type:"ENUM", description:"Fan speed to set", constraints: getFanLevel.collect {k,v -> k}]]

where getFanLevel in this case is:

import groovy.transform.Field
@Field Map getFanLevel = [
	"low": 25
	,"medium": 50
	,"medium-high": 75
	,"high": 100
	,"on" : 100
	,"off": 0
]
1 Like

Thanks! Is a JSON array still the correct format for the fanSpeedList attribute itself, or does that also need to be a name/number map? I might override the command in my driver to avoid confusion (should anyone besides me use it...), but I'm also just curious what the new attribute is supposed to do since right now it doesn't appear to have any effect (aside from, I suppose, being there and something apps could read and adjust their behavior if needed?).

3 Likes

yes, that is the intent

I think the intent was for this to be actual formatted json, however these are actually just simple lists created as such:

sendEvent(name: "supportedThermostatModes", value: ["off", "heat", "cool", "auto", "emergency heat", "locked out", "fan", "dry"])
1 Like

Download the Hubitat app