[Edge Driver Development] [ZWAVE] Calling default handler from custom handler

Hi !

Is there a way to pass the received cmd back to the default handler? I have registered a custom handler for SENSOR_MULTILEVEL as following. The device supports both temperature and illumination. What I need to modify is only the illumination, when I receive the report of Temperature, I would like to leave it to the default handler. But I couldn’t find out how to pass it back to the default handler.

psuedo code below:

local function sensor_multilevel_report_handler(self, device, cmd)
if cmd.args.sensor_type == 3 then
– handle illumination stuff here
else
– WOULD LIKE TO PASS TO THE DEFAULT HANDER HERE…
end

end

[cc.SENSOR_MULTILEVEL] = {
[SensorMultilevel.REPORT] = sensor_multilevel_report_handler
},

Thanks,

Hi @brandicast

You could do this and it must works

local TemperatureDefaults = require "st.zwave.defaults.temperatureMeasurement"

local function sensor_multilevel_report_handler(self, device, cmd)
  if cmd.args.sensor_type == 3 then
  -- handle illumination stuff here
  else
  -- WOULD LIKE TO PASS TO THE DEFAULT HANDER HERE…
  TemperatureDefaults.zwave_handlers[cc.SENSOR_MULTILEVEL][SensorMultilevel.REPORT](self, device, cmd)
  end

end

[cc.SENSOR_MULTILEVEL] = {
[SensorMultilevel.REPORT] = sensor_multilevel_report_handler
},
1 Like

Hi ! Thanks for the tips. May I know where to find the documentation listing the default handlers? I tried to dig out from the official site but couldn’t find any.

And instead of passing the specific TemperatureDefaults, is there a even more general default handler for sensor multilevel report? Assuming the sensor supports more than just 2 capabilities ?

Thanks,

Hi,

In this link you can download firmware lua libraries.

It is essential to be able to develop something

And this is the edge zigbee capabilities defaults documentation

https://developer.smartthings.com/docs/edge-device-drivers/zigbee/defaults.html

2 Likes

Got it ! Thanks for the help !!

I did glance thru the documents just didn’t find out what you mentioned about.

The link you provided last was for ZigBee devices while I am onto ZWave, that’s why I skipped that part. Will give it a try if it works the same as ZigBee API.

Didn’t expect the firmware “lua_libs-api_v6_49X.tar.gz” is in the Release link though. This really helps a lot.

Cheers,

It is the complete documentation, you can also browse the defaults zawe
https://developer.smartthings.com/docs/edge-device-drivers/zwave/defaults.html

1 Like

Yes, I am aware of that. I read that too. It’s just that unlike zigbee, the document for zwave has not much information about the API. It has limited description as following:

1698898539330

However, I can see it does support the same function from the firmware source code.

Thanks,

1 Like