We have moved at community.getvera.com

Author Topic: Complete list of device #s and node IDs  (Read 11918 times)

Offline RichardTSchaefer

  • Community Beta
  • Master Member
  • ******
  • Posts: 10091
  • Karma: +764/-143
Re: Complete list of device #s and node IDs
« Reply #15 on: March 20, 2017, 09:59:34 am »
Just add the code from:
http://forum.micasaverde.com/index.php/topic,15010.msg291964.html#msg291964
As the LUA code for a manually triggered scene (available from the Scene Editor: "Also, execute the following Luup code:")

Then  run the scene ... you should be able to access the files from the browser:
http://Your.Vera.IP.Address/devlist.txt

Offline icare

  • Jr. Member
  • **
  • Posts: 86
  • Karma: +0/-0
Re: Complete list of device #s and node IDs
« Reply #16 on: October 13, 2017, 06:18:40 am »
Is there a way to revise the following code such that the device list is sorted on device number?

local file = io.open("/www/devlist.txt", "w")
file:write("[DeviceNo / id] device names on " .. os.date() .. "\n")
for deviceNo,d in pairs(luup.devices) do
file:write(string.format('[%03d / %s] %s \n', deviceNo, d.id, d.description))
end
file:close()

Offline akbooer

  • Beta Testers
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: Complete list of device #s and node IDs
« Reply #17 on: October 13, 2017, 06:09:47 pm »
Is there a way to revise the following code such that the device list is sorted on device number?

Yes, of course.

Code: [Select]
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()
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline icare

  • Jr. Member
  • **
  • Posts: 86
  • Karma: +0/-0
Re: Complete list of device #s and node IDs
« Reply #18 on: October 14, 2017, 02:36:48 am »
 Top, thanks a lot!

Offline Spanners

  • Sr. Member
  • ****
  • Posts: 265
  • Karma: +16/-5
Re: Complete list of device #s and node IDs
« Reply #19 on: October 21, 2017, 09:32:30 pm »
Does anyone have a version that lists the Z-wave node ID? I think it's altid when you look in the advanced properties.

I'm trying to find the source of some nonce encryption related errors in my luaupnp log, but it's referring to the Z-wave ID.

Offline akbooer

  • Beta Testers
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: Complete list of device #s and node IDs
« Reply #20 on: October 22, 2017, 04:28:32 am »
This code does just that... the altid is called ID in the luup.devices structure.  Just another inconsistency in the Vera Luup saga...
« Last Edit: February 16, 2018, 05:03:38 pm by akbooer »
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline geekydaddy

  • Newbie
  • *
  • Posts: 10
  • Karma: +1/-0
Re: Complete list of device #s and node IDs
« Reply #21 on: February 16, 2018, 04:41:49 pm »
How about an HTML version of the file:

Code: [Select]
local file = io.open("/www/devlist.html", "w")
file:write("<html>")
file:write("<head>")
file:write("<style>")
file:write("body {background-color: linen;} table,td,th {border: 1px solid black;} table {width:100%;}")
file:write("</style>")

file:write("</head>")
file:write("<body>")

file:write("<table><caption>" .. os.date() .. "</caption>")
file:write("<thead><tr><th colspan='3'>Device</th><th rowspan='2'>Watts</th><th rowspan='2'>kWh</th></tr>")
file:write("<tr><th>No</th><th>ID</th><th>Name</th></tr></thead>")
file:write("<tbody>")

local id = "%03d</td><td>%s"
local info = "<td>%-20s</td><td>%-32s</td><td>%8s</td><td>%8s</td>"
local sid = "urn:micasaverde-com:serviceId:EnergyMetering1"
for deviceNo,d in pairs(luup.devices) do
    if d.id ~= "" then
        local W   = luup.variable_get (sid, "Watts", deviceNo)
        local kWh = luup.variable_get (sid, "KWH", deviceNo)
        local ids = id: format (deviceNo, d.id)
file:write("<tr>")
        file:write (info: format(ids, d.description, W or '', kWh or ''))
file:write("</tr>")
end
end

file:write("<tbody>")
file:write("</table>")
file:write("</body>")
file:write("</html>")

file:close()

then just go to http://Your.Vera.IP.Address/devlist.html

Offline mpress

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
Re: Complete list of device #s and node IDs
« Reply #22 on: January 22, 2019, 09:11:56 am »
 Your solution to the device list issue is much appreciated.  However, one issue I still have is that some devices create a host of "phantom" child devices when installed, and they often remain even when the parent is unpaired.  Would it be possible to modify the code to show the parent ID of any child devices as well?