LogicMachine Forum
Unable to use the "data16" data type in Zigbee. - Printable Version

+- LogicMachine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Unable to use the "data16" data type in Zigbee. (/showthread.php?tid=6514)



Unable to use the "data16" data type in Zigbee. - Samuel - 20.07.2026

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?


RE: Unable to use the "data16" data type in Zigbee. - admin - 20.07.2026

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)