Help with Hex string

HI Everyone,

I really need some help, I receive this hex string and have tried everything to process it on my plugin
02 00 00 10 DF E0 C6 C8 D2 C7 CB DC DE CF DA CB F1
02 is the header, 00 reserve, 00 normally zone but not for this command, 10 is the command for volume, DF is the volume for zone 1 and that carries like E0=Z2, C6=Z3 and etc.

How do i receive this? I have tried the following,
local data = string.format(‘%02X’, string.byte(lul_data))

-- Build full hex strings
if (data == HTD_cmd_start) then
  bufferString = buffer .. " " .. data
  luup.log("Received full buffer from controller via serial " .. bufferString) 
elseif (data == HTD_cmd_start) then
  buffer = data
else
  buffer = buffer .. " " .. data
end
-- Generate array from buffer
if (bufferString ~= nil) then
  Array = {}
  local x = 1
  for i in string.gmatch(bufferString, "%S+") do
    Array[x] = i
    x = x + 1
  end
end
  -- Parse hex strings
if (#Array == 3) then  
  if (Array[3] == "10") then

    -- Convert to decimal, range 0..100, and return volume status
    value = tonumber(Array[4], 16) * 2
    zonedev = zone_ID[tonumber(Array[3]) + 1]
    luup.variable_set("urn:micasaverde-com:serviceId:Volume1", "Volume", value, zonedev)
	luup.variable_set("urn:micasaverde-com:serviceId:InputSelection1", "DiscreteinputTV", DiscreteinputTV, value)
    luup.log("Volume for zone " .. tonumber(Array[1]) + 1 .. " is " .. (value or "Not Available"))
    bufferString = ""
  end

But it doesn’t work

Hi,

I have this same issue. Have you figure out how to receive it and process later on?

Not quite sure what problem your code is solving, but a simple way to parse the string and convert it to decimals is shown in this code snippet:

local s = "02 00 00 10 DF E0 C6 C8 D2 C7 CB DC DE CF DA CB F1"

for x in s:gmatch "%x+" do
  local n = tonumber (x, 16)
  print (x, n)
end

which would produce the following output:

02	2
00	0
00	0
10	16
DF	223
E0	224
C6	198
C8	200
D2	210
C7	199
CB	203
DC	220
DE	222
CF	207
DA	218
CB	203
F1	241