Feature Request: Improving Logcat

Of course, logcat is our goto when writing/debugging devices or drivers. Here are some suggestions to improve the tool.

  1. Improve messages when a Z-wave event received. A message stating “received event with handler unnamed” is confusing at best. Is there a way to name a handler so that the message is more meaningful?
2023-04-10T15:21:33.535205190+00:00 TRACE Z-Wave Leviton 4-Button Scene Test  Received event with handler unnamed
2023-04-10T15:21:33.536173190+00:00 INFO Z-Wave Leviton 4-Button Scene Test  <ZwaveDevice: 17ec5cb1-25a0-4923-8fa7-f5b6c95521d6 [4B] (Leviton 4 Button Switch)> received Z-Wave command: {args={dimming_duration="default", scene_id=2}, cmd_class="SCENE_ACTIVATION", cmd_id="SET", dst_channels={}, encap="NONE", payload="\x02\xFF", src_channel=0, version=1}
2023-04-10T15:21:33.588520523+00:00 TRACE Z-Wave Leviton 4-Button Scene Test  Found ZwaveDispatcher handler in Z-Wave Leviton 4-Button Scene Controller
2023-04-10T15:21:33.589512857+00:00 TRACE Z-Wave Leviton 4-Button Scene Test  ------ Received Scene_Activation

  1. Inaccurate statement about using default dispatchers. Frequently get the following when a driver is first deployed.
ZwaveDispatcher: Z-Wave Leviton 4-Button Scene Controller
  default_handlers:
    BASIC:
      SET
      REPORT
    MANUFACTURER_PROPRIETARY:
      0
    MANUFACTURER_SPECIFIC:
      GET
      REPORT
    SWITCH_BINARY:
      REPORT
    SWITCH_MULTILEVEL:
      START_LEVEL_CHANGE
      STOP_LEVEL_CHANGE
      REPORT
    SCENE_ACTIVATION:
      SET
    SCENE_ACTUATOR_CONF:
      GET
      REPORT
    SCENE_CONTROLLER_CONF:
      GET
      REPORT
    ASSOCIATION:
      GROUPINGS_REPORT
      REPORT
  child_dispatchers:


when, in fact, I have overridden the default handlers in my code:

local driver_template = {
  NAME = "Leviton VRCS4",
  zwave_handlers = {
    [cc.BASIC] = {
      [Basic.SET] = basic_set_handler,
      [Basic.REPORT] = basic_report_handler
      },
    [cc.SWITCH_BINARY] = {
      [SwitchBinary.REPORT] = switch_binary_report_handler
    },
    [cc.ASSOCIATION] = {
    --  [Association.Groupings_REPORT] = association_handler
      [0x06] = association_groupings_report_handler,
      [Association.REPORT] = association_report_handler
    },
    [cc.SCENE_CONTROLLER_CONF] = {
      [SceneControllerConf.REPORT] = scene_controller_handler,
      [SceneControllerConf.GET] = scene_controller_handler
    }, 
    [cc.SCENE_ACTUATOR_CONF] = {
      [SceneActuatorConf.GET] = scene_actuator_conf_get_handler,
      [SceneActuatorConf.REPORT] = scene_actuator_conf_report_handler
    },
    [cc.SCENE_ACTIVATION] = {
      [SceneActivation.SET] = scene_activation_handler
    },
    [cc.SWITCH_MULTILEVEL] = {
 
      [SwitchMultilevel.START_LEVEL_CHANGE] = switch_multilevel_start_handler,
      [SwitchMultilevel.STOP_LEVEL_CHANGE] = switch_multilevel_stop_handler
      },
  [cc.MANUFACTURER_PROPRIETARY] = {
    [0x00] = proprietary_handler
    },
 [cc.MANUFACTURER_SPECIFIC] = {
 --     -- GET
      [0x04] = proprietary_handler,
 --     -- REPORT
      [0x05] = proprietary_handler
      }
  },
    supported_capabilities = {
    capabilities.switch,
    capabilities.switchLevel,
    capabilities.refresh
    },
    capability_handlers = {
    [capabilities.switch.ID] = {
      [capabilities.switch.commands.on.NAME] = capability_handle_on,
      [capabilities.switch.commands.off.NAME] = capability_handle_off,
      },
    [capabilities.switchLevel.ID] = {
      [capabilities.switchLevel.commands.setLevel.NAME] = capability_switch_level_set
      }
    },
    lifecycle_handlers = {
    init = init_driver_handler,
    added = device_added,
    infoChanged = device_info_changed

  },
  can_handle = can_handle_LEVITON_VRCS4,

}

--[[
  The default handlers take care of the Command Classes and the translation to capability events 
  for most devices, but you can still define custom handlers to override them.
]]--

defaults.register_for_default_handlers(driver_template, driver_template.supported_capabilities)
local buttonSwitch = ZwaveDriver("Z-Wave Leviton 4-Button Scene Controller", driver_template)
buttonSwitch:run()

It would be good if logging would state that default handlers have been overridden!

  1. And, of course, adding logging for the Rules API!

Thanks

Henry

Hi, @harobinson

I’ll share your comments with the corresponding team.
I’ll just remove point #3 in this post since getting the logs for the Rules API is a separate thing from the drivers logcat which is only for Edge drivers. The Rules team is already aware of that request as I mentioned in your other post here: My wish list for the Rules API