On an older thread “akbooer” was kind enough to provide the code to produce a device list sorted by device number as follows:
local file = io.open("/www/devlist.txt", "w")
file:write("[DeviceNo / id] device names on " .. os.date() .. "\n")
local idx = {}
for deviceNo in pairs(luup.devices) do
idx[#idx+1] = deviceNo
end
table.sort (idx)
for _,deviceNo in ipairs(idx) do
d = luup.devices[deviceNo]
file:write(string.format('[%03d / %s] %s \n', deviceNo, d.id, d.description))
end
file:close()
Would anyone be able to modify the code to provide the Device ID of both the device as well as its “parent” if any?
local file = io.open("/www/devlist.txt", "w")
file:write("[DeviceNo / id / parent] device names on " .. os.date() .. "\n")
local idx = {}
for deviceNo in pairs(luup.devices) do
idx[#idx+1] = deviceNo
end
table.sort (idx)
for _,deviceNo in ipairs(idx) do
d = luup.devices[deviceNo]
file:write(string.format('[%03d / %s / %s] %s \n', deviceNo, d.device_num_parent, d.id, d.description))
end
file:close()
I am starting from scratch. I can somewhat follow the code, but how do I implement it with my Vera Plus? Do I copy and paste? Paste where? Any guidance on where and how to run code on the Vera Plus? I’m not looking for hand holding, but am looking for some kind of resource to help me run routines like the one above. luup? lua? I don’t know the difference???