So as a disclosure here, I basically was programming this blind last night since I can't seem to find any documentation on what calls I can actually make with a hubitat driver (I only stumbled across device.updateSetting after poking around some sample code on the hubitat github hxxps://github.com/hubitat/HubitatPublic/blob/master/examples/drivers/GenericZigbeeRGBWBulb.groovy) and more importantly, I have not programmed anything in forever, much less in a language I never heard of till HE (Groovy)
So my top question is simply: Where do I find a full list of existing functions within hubitat that I can call with my driver?
My next question is more complex, I have an existing driver for my GE Z-Wave Plus Motion Switch that lets me set the occupation mode as a preference, however I want my rule engine to set occupation mode by time of day (but I can't edit preferences via RE, I need to make a command apparently)
So I make my command:
metadata {
definition (name: "GE Z-Wave Plus Motion Switch", namespace: "Botched1", author: "Jason Bottjen") {
command "Vacancy"
}
preferences {
input "paramOperationMode", "enum", title: "Operating Mode", description: "Occupancy: Automatically turn on and off the light with motion\nVacancy: Manually turn on, automatically turn off light with no motion.", options: ["1" : "Manual", "2" : "Vacancy", "3" : "Occupancy (default)"], required: false, displayDuringSetup: true
}
def Vacancy() {
if (logEnable) log.debug("Vacancy")
def cmds = []
cmds << zwave.configurationV2.configurationSet(scaledConfigurationValue: paramOperationMode.toInteger(), parameterNumber: 3, size: 1).format()
cmds << zwave.configurationV2.configurationGet(parameterNumber: 3).format()
delayBetween(cmds,1000)
}
This works exactly as expected, however the driver has functionality to verify the device has the right settings, and if I left my function as-is every 3000 seconds it would override the setting I chose. so I want to update the device preferences so I try to add a line to my function to do just that:
device.updateSetting("paramOperationMode",[value:"\"2\" : \"Vacancy\"", type:"text"])
Now, I have tried many things here to match the preferences " input "paramOperationMode", "enum" with no success. I have tried values of 2, Vacancy, the above combined, types of text (based off a forum thread I cant find now) and type enum.
Currently this will clear whatever setting is in the update setting field as it defaults to the "Click to set" after I execute, which implies some form of success, but I can't seem to take that last step to actually have to set to the vacancy setting.
Any help is appreciated.