How to use setBulk on actions

Hi,

Using some examples found here in the forum, mainly posted by @freshcoast , I was trying to run this action on one automation of mine:

alias: Set config parameters
action: zwave_js.invoke_cc_api
data:
  endpoint: "0"
  command_class: "112"
  device_id:
    - 240e70b4e1d8cefa91000592eb4b3e1a
  method_name: setBulk
  parameters:
    - parameter: 1
      value: 0
    - parameter: 2
      value: 3
    - parameter: 3
      value: 1
    - parameter: 12
      value: 1
    - parameter: 14
      value: 3
    - parameter: 16
      value: 30
    - parameter: 17
      value: 18
    - parameter: 18
      value: 0
    - parameter: 19
      value: 0
    - parameter: 22
      value: 10
    - parameter: 23
      value: 2
    - parameter: 24
      value: 0
    - parameter: 25
      value: 0
    - parameter: 26
      value: 0

Unfortunately when running this I get this z-wave error:

Error handling message: Endpoint(node_id=90, index=0) - FailedZWaveCommand: zwave_error: Z-Wave error 322 - Argument validation failed: Expected parameter values to be an Array<import("/home/runner/work/node-zwave-js/node-zwave-js/packages/cc/src/cc/ConfigurationCC").ConfigurationCCAPISetOptions>, got object (ZW0322)

Can anyone assist please?

Thanks in advance,

Not sure which example of mine you’re referring to, but it might be wrong. :sweat_smile: The parameters field of the action is a list of arguments to pass to the Z-Wave JS CC API function. setBulk expects a single argument that is a list of ConfigurationCCAPISetOptions objects, however what you’ve got is 10+ separate arguments that are objects. You just need to wrap all of the arguments into an outer list.

Try this:

alias: Set config parameters
action: zwave_js.invoke_cc_api
data:
  endpoint: "0"
  command_class: "112"
  device_id:
    - 240e70b4e1d8cefa91000592eb4b3e1a
  method_name: setBulk
  parameters:
    - - parameter: 1
        value: 0
      - parameter: 2
        value: 3
      - parameter: 3
        value: 1
      - parameter: 12
        value: 1
      - parameter: 14
        value: 3
      - parameter: 16
        value: 30
      - parameter: 17
        value: 18
      - parameter: 18
        value: 0
      - parameter: 19
        value: 0
      - parameter: 22
        value: 10
      - parameter: 23
        value: 2
      - parameter: 24
        value: 0
      - parameter: 25
        value: 0
      - parameter: 26
        value: 0

Also, for setBulk to be most effective, the device needs to support Configuration CC v4 and the arguments need to be consecutive increasing parameter IDs of the same type and size. Not sure if those parameters are the same size/type, but the gap between 3 and 12 causes this to become 10+ single Set commands, which is not much different from using the normal set_config_parameter service for each one.

1 Like

eheheehh it might indeed :smile:

but fear not, you have now overcome that obstacle anyhow! :rofl:

I have another error at this point, but this one should be easy to solve, it’s quite self-explanatory:

Z-Wave error 322 - Setting a configuration parameter without specifying a value size and format requires it to be defined in a device config file!

On the topic of the parameters not being consecutive… well… I didn’t know that, learned an extra point for that one! Anyway it saves me typing and makes the automation clearer at any rate, even if without performance improvement.

THANKS!

1 Like