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
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
},
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 ?
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.
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:
However, I can see it does support the same function from the firmware source code.