Sending secure commands

Really hoping someone can help me out on what I need to do to issue secure commands. I know it’s connected secure from the raw description in the IDE.

Below is a snippet of code I threw in just to trigger some things. The first result << line is line 107.

preferences {
	input "checkConfig", "bool", title: "Check Parms", description: "On/Off", required: false, defaultValue: false

}

def updated() {

def result = []
			result << response(secure(zwave.configurationV1.configurationSet(parameterNumber: 1, size: 1, configurationValue: 0)))
			result << "delay 1000"
			result << response(secure(zwave.configurationV1.configurationGet(parameterNumber: 1).format()))
	return result

}

And my secure routine is standard:

private secure(physicalgraph.zwave.Command cmd) {
zwave.securityV1.securityMessageEncapsulation().encapsulate(cmd).format()
}

The parameter just takes 0 or 1, so it should work like this. But, when I try it as above, I get this message:
error org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object ‘0’ with class ‘java.lang.Integer’ to class ‘java.util.List’ @ line 107
If I use the preferences value, like below, it just gets ignored but I get no error.

	result << response(secure(zwave.configurationV1.configurationSet(parameterNumber: 1, size: 1, configurationValue: [checkConfig == true ? 1 : 0])))

To make matters worse, the simple get command I’m trying to isue gives me this message:

error groovy.lang.MissingMethodException: No signature of method: script148451431164587999064.secure() is applicable for argument types: (java.lang.String) values: [700501]
Possible solutions: remove(java.lang.String), section(java.lang.String), state(java.lang.String), section(), every(), render(java.util.Map) @ line 109

For the life of me I can’t figure out or understand why I can’t just get this basic part to work.

The first configurationGet you posted shouldn’t have “.format()”. Not sure if that’s your problem, but it will most likely cause an exception.

FYI, when posting code to the forum, select it and use the “< />” toolbar button to format it so that it doesn’t take up so much space and is easier to read.

Sorry about the code. I didn’t know actually - it sort of was doing it automatically for me.

As far as the get…after removing the format(), I don’t get an error any more! I get nothing. :frowning: It just gets ignored.