Syntax for "error" and "fallback" fields

Background: I am trying to track down an event from an unnamed handler. It looks like I can get the information by registering the error field. I don’t understand the required syntax for adding the error field to the zwave_handler table.

The documentation states: In addition there are 2 extra keys that can be added to the zwave_handlers table. The fallback and error fields can be set to be used as the special handlers for the [Dispatchers]"

What is the correct syntax to specify the error field and am I correct that this would result in my being able to get the event information to construct the handler?

Thanks

Hi, @harobinson

I’m linking this here: ZWave Handler for ManufacturerProprietary Command Class - #3 by harobinson as I think it’s related.

Can you share the log of the incoming message that you’re trying to handle, please? You should receive the Z-Wave message and it should appear in the logs despite not being handled yet.
In the meantime, I’ll ask the team for more info about those fields and the handler for that CC, maybe it behaves differently than others I’ve seen.

error and fallback just need to point to functions, and would get similar parameters to the other zwave handlers.

local function error_handler(driver, device, cmd)
...
end

and in your template:

zwave_handlers = {
    error = error_handler
 }

Here is the log that is generated. No ZWAVE message in log other than the comment.

2023-01-03T18:36:49.728731806+00:00 TRACE Z-Wave Leviton 4-Button Scene Controller  Received event with handler unnamed
2023-01-03T18:36:49.913798139+00:00 INFO Z-Wave Leviton 4-Button Scene Controller  <ZwaveDevice: 4e5febe7-adcc-4cbc-b4eb-0c21a001b19c [32] (Leviton 4 Button Switch)> received Z-Wave command: {args={dimming_duration="default", scene_id=1}, cmd_class="SCENE_ACTIVATION", cmd_id="SET", dst_channels={}, encap="NONE", payload="\x01\xFF", src_channel=0, version=1}
2023-01-03T18:36:49.974413806+00:00 TRACE Z-Wave Leviton 4-Button Scene Controller  Found ZwaveDispatcher handler in Z-Wave Leviton 4-Button Scene Controller
2023-01-03T18:36:49.998242139+00:00 DEBUG Z-Wave Leviton 4-Button Scene Controller  Leviton 4 Button Switch device thread event handled
2023-01-03T18:36:50.027209139+00:00 TRACE Z-Wave Leviton 4-Button Scene Controller  Received event with handler unnamed
2023-01-03T18:36:50.062154806+00:00 INFO Z-Wave Leviton 4-Button Scene Controller  <ZwaveDevice: 4e5febe7-adcc-4cbc-b4eb-0c21a001b19c [32] (Leviton 4 Button Switch)> received Z-Wave command: {args={dimming_duration="default", scene_id=1}, cmd_class="SCENE_ACTIVATION", cmd_id="SET", dst_channels={}, encap="NONE", payload="\x01\xFF", src_channel=0, version=1}
2023-01-03T18:36:50.137267139+00:00 TRACE Z-Wave Leviton 4-Button Scene Controller  Found ZwaveDispatcher handler in Z-Wave Leviton 4-Button Scene Controller
2023-01-03T18:36:50.170119139+00:00 DEBUG Z-Wave Leviton 4-Button Scene Controller  Leviton 4 Button Switch device thread event handled
2023-01-03T18:36:50.185533806+00:00 TRACE Z-Wave Leviton 4-Button Scene Controller  Received event with handler unnamed
2023-01-03T18:36:50.207081139+00:00 INFO Z-Wave Leviton 4-Button Scene Controller  <ZwaveDevice: 4e5febe7-adcc-4cbc-b4eb-0c21a001b19c [32] (Leviton 4 Button Switch)> received Z-Wave command: {args={dimming_duration="default", scene_id=1}, cmd_class="SCENE_ACTIVATION", cmd_id="SET", dst_channels={}, encap="NONE", payload="\x01\xFF", src_channel=0, version=1}
2023-01-03T18:36:50.247053473+00:00 TRACE Z-Wave Leviton 4-Button Scene Controller  Found ZwaveDispatcher handler in Z-Wave Leviton 4-Button Scene Controller
2023-01-03T18:36:50.252635806+00:00 DEBUG Z-Wave Leviton 4-Button Scene Controller  Leviton 4 Button Switch device thread event handled
2023-01-03T18:36:50.259696473+00:00 TRACE Z-Wave Leviton 4-Button Scene Controller  Received event with handler unnamed
2023-01-03T18:36:50.297091806+00:00 INFO Z-Wave Leviton 4-Button Scene Controller  <ZwaveDevice: 4e5febe7-adcc-4cbc-b4eb-0c21a001b19c [32] (Leviton 4 Button Switch)> received Z-Wave command: {args={dimming_duration="default", scene_id=1}, cmd_class="SCENE_ACTIVATION", cmd_id="SET", dst_channels={}, encap="NONE", payload="\x01\xFF", src_channel=0, version=1}
2023-01-03T18:36:50.338286806+00:00 TRACE Z-Wave Leviton 4-Button Scene Controller  Found ZwaveDispatcher handler in Z-Wave Leviton 4-Button Scene Controller
2023-01-03T18:36:50.358538806+00:00 DEBUG Z-Wave Leviton 4-Button Scene Controller  Leviton 4 Button Switch device thread event handled

Thanks for the help.

This doesn’t work with the latest firmware (atleast in the main driver, in the sub-driver I don’t see an exception but it doesn’t work).

2023-04-24T23:29:02.753019326+00:00 FATAL Universal Enhanced Z-Wave Lock  runtime error: [string "st/zwave/driver.lua"]:131: zwave handler registrations must be of form [cmd_class] = { [cmd_id] = callback } or { [cmd_class] = { [cmd_id] = { callback, callback, ... } }
stack traceback:
        [C]: in function 'assert'
        [string "st/zwave/driver.lua"]:131: in upvalue 'validate_cmd_callbacks'
        [string "st/zwave/driver.lua"]:239: in local 'ZwaveDriver'
        [string "init.lua"]:200: in main chunk
Traceback:
stack traceback:
        [C]: in function 'assert'
        [string "st/zwave/driver.lua"]:131: in upvalue 'validate_cmd_callbacks'
        [string "st/zwave/driver.lua"]:239: in local 'ZwaveDriver'
        [string "init.lua"]:200: in main chunk

I never got the error_handler to fire for my use cases and abandoned that effort. So I can’t say if I would be getting the same error message that @RBoy now has.

  1. I still have “handler unnamed” in my log messages. I don’t think it’s related to the error_handler but would always be good to understand how one could mark a handler.
  1. I would get err=“unsupported command” when I issued a “MANUFACTURER_PROPRIETARY” command. I have surmised that the hub was complaining about a message that it didn’t recognize but the device did. I tried to use the error_handler to see if this would fire but it didn’t.

In summary, I never found anything that would fire off that error_handler and so I abandoned it.