This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Unable to use the "data16" data type in Zigbee.
#1
Hello,

Device: LM5P2-KDCZ

I'm unable to use the "data16" (0x09) data type in a Lua script.
I'm trying to trigger a Zigbee device using this event-based script. While running the script, I monitor all messages sent to the device using Wireshark.
With this script, I don't see any messages being sent, and I get a "no response" error in the LogicMachine logs.
If I change the data type to "uint16", for example, and run the script again, I can see that a message is sent to the device with Wireshark. However, it does not trigger the expected action, which is understandable since the data type is different.

Code:
local zb = require('applibs.zigbee') local address = '0004740001248162' local manufcode = 4129             local mode = event.getvalue() local res, err = zb.cmdsync('setrawattribute', address, 64513, 0, mode, 'data16', manufcode) if not res then   log('Writting error on contactor (' .. address .. '): ' .. tostring(err)) else   log('Contactor mode: ' .. tostring(mode)) end

Quote:Log :
Event for Mode contacteur (33/1/1) 20.07.2026 08:49:27
* string: Writting error on contactor (0004740001248162): no response

Here, you will find a capture of a message sent using another Zigbee tool. This is the message I would like to send using this script.

Does anyone know how to send a command with the "data16" data type from a Lua script?
If some Zigbee Cluster Library (ZCL) data types are not supported by LogicMachine, is there any documentation available listing the supported data types?
Reply
#2
data16 must sent as a byte array.
Try this, you might need to swap b1 and b2 if the byte order is incorrect:
Code:
local mode = event.getvalue() local b1 = bit.band(bit.rshift(mode, 8), 0xFF) local b2 = bit.band(mode, 0xFF) local data = { b1, b2 } local res, err = zb.cmdsync('setrawattribute', address, 64513, 0, data, 'data16', manufcode)
Reply


Forum Jump: