I want to write a simple av command to implement my device ,but it cannot work ,here is my code
private List avCommands ( byte seq , List val )
{[
zwave.simpleavcontrolv1.SimpleAvControlSet (
sequenceNumber : sql,
commands : val ,
)
]}
void ZAvControl(avchannel, avbutton) {
debugLog( "ZAvControl: (${ SET_TV[avbutton] })" )
Random random = new Random();
// create a random number
byte sequence = (byte)random.nextInt();
List<hubitat.zwave.Command> cmds=
String hexString = device.deviceNetworkId
Integer ep = Integer.parseInt(hexString, 16);
Integer val = (Integer)SET_TV[avbutton]
Short[] codeBytes = parseRemoteCode(val)
cmds.add(zwave.multiChannelV4.multiChannelCmdEncap(
destinationEndPoint : avchannel.toInteger(),
sourceEndPoint : ep
).encapsulate(avCommands(sequence, [val]))
)
sendToDevice(cmds)
}
and this is the error log errorgroovy.lang.MissingPropertyException: No such property: simpleavcontrolv1 for class: hubitat.zwave.Zwave Possible solutions: simpleAvControlV1 on line 506 (method ZAvControl)
According to Z-Wave Classes | Hubitat Documentation
class hubitat.zwave.commands.simpleavcontrolv1.SimpleAvControlSet {
List commands
Integer itemId
Short keyAttributes
Short sequenceNumber
List getPayload()
String format()
I don't know why it is error .
This is very urgent , anyone who can help ?
Thanks, it so kind of you .
using zwave.simpleAvControlV1.SimpleAvControlSet works ok . But my script still cannot work. Can you help to fix ?
dev:2072024-07-25 12:03:07.101 AMerrorgroovy.lang.MissingMethodException: No signature of method: user_driver_yong_Remotec_ZXT_800_738.avCommands() is applicable for argument types: (java.lang.Integer, java.util.ArrayList) values: [5, [[0, 39]]] on line 539 (method ZAvControl)
private List avCommands ( Short seq , List val )
{[
zwave.simpleAvControlV1.SimpleAvControlSet (
sequenceNumber : seq,
commands :val ,
)
]}
void ZAvControl(avchannel, avbutton) {
debugLog( "ZAvControl: (${ SET_TV[avbutton] })" )
Random random = new Random();
// random value
Integer sequence = random.nextInt(20);
List<hubitat.zwave.Command> cmds=
String hexString = device.deviceNetworkId
Short ep =(Short) Integer.parseInt(hexString, 16);
I don't know. But your code is very hard to read without proper formatting. A separate link (e.g., a GitHub gist) or formatting your code in your post will help a lot:
That being said:
This error again tells you what the problem is. (Groovy doesn't always give you helpful errors, but you're two out of two so far.) As it says, you're providing two arguments, and Integer and a List. Your method is defind to take a Short and a List:
I don't know how your device actually works, and I'm not familiar with these Z-Wave command classes, so my ability to help beyond this point may be limited.
simple av command is simpleAvControlV1
2.please notice the position of parameter ,if the position of parameter change it cannot work . for example , it is commands and itemId , if change itemId and then commands , it is error . Here is my works code :