UI7 Can Device ID Numbers be changed manually?

My UI7 network has crashed 3 times. I had to exclude and re-include my entire network so much that some of my devices are into the 200’s. Maybe I shouldn’t sweat it but it annoys me.

Can anything be done to “clean up” the device count so I show 1-50 or whatever and not have skipped device ID’s taking me up this high?

You can reset to factory defaults and start over!

I do not think you will like that answer … Device IDs are internal identifiers … you can’ change them!

Thanks. I thought that was the case but not sure I want to start all over!

Not trying to flog a dead horse, but why would is it so difficult to do this? shouldn’t there be a master table that says this device id points to this particular device? The reason i want to be able to do this is because i have several of these units and when i create some programming logic i want to create it once and have it work for all the units. it’s kind of a pain to go through and re-assign variables for devices in each of the units. I’m open to suggestions if anyone has them on how to make my code and variables more standard…

I use global variables to hold my scene and device numbers. That way I only have to change the declaration when/if the number changes.

I define the global variables in the LUA startup code. Example:

scnArriveHome=34
modKitchenLight=123

A side advantage to using global variables is that it makes the code far easier to read.

Hope this helps.

I generate a lookup table automatically at startup between device name and id, and thereafter simply refer to devices by name.

See: http://forum.micasaverde.com/index.php/topic,14743.msg111814.html#msg111814

Or combine with this object-oriented approach http://forum.micasaverde.com/index.php/topic,15138.msg115045.html#msg115045

light bulb!

[quote=“akbooer, post:6, topic:189557”]I generate a lookup table automatically at startup between device name and id, and thereafter simply refer to devices by name.

See: http://forum.micasaverde.com/index.php/topic,14743.msg111814.html#msg111814

Or combine with this object-oriented approach http://forum.micasaverde.com/index.php/topic,15138.msg115045.html#msg115045[/quote]

Soooo. i have a file with a bunch of functions that i call at startup via startup code like this:

sebbyCode = require("sebbyLuaCode")

in there i defined the a global variable to hold the device IDs:

DEV = {}

then i fill the variable with the device names per your suggestion:

for i,d in pairs(luup.devices) do DEV[d.description] = i end

i out in some log calls in there so i know the variable DEV is being populated with the devices, but when i go to call that array from the “test lua code”, it tells me it is nill…

02/14/16 8:26:58.180	LuaInterface::StartEngine failed run: 0 [string "sebbyCode.vLog("d vatiable is  ".. DEV["Tem..."]:1: attempt to index global 'DEV' (a nil value) <0x2e6fc680>

is there a special designator for a global variable in Lua? i though just defining it there in my file would make it available globally.

Never mind… i’m a dumbass… it helps if i use the scope i defined for the variable to call it… code should be

sebbyCode.vLog("d vatiable is  ".. sebbyCode.DEV["Temperatures")

Oh good, I was beginning to get worried.

i do have an issue with this that maybe you can help with. I use the iphon locator plugin to figure out who is home so i can control scenes by proximity. when i populate the device table, it looks like it is all going in there no problem. here is a snippet from my log where i load them:

DESCRIPTION: Sonos  ===> DEVICE ID = 67 <0x2b8ba680>
DESCRIPTION: Outdoor Switch  ===> DEVICE ID = 4 <0x2b8ba680>
DESCRIPTION: (*)Seb\'s Super Seis  ===> DEVICE ID = 70 <0x2b8ba680>
DESCRIPTION: (*)Ida\'s six  ===> DEVICE ID = 71 <0x2b8ba680>
DESCRIPTION: Webcam Dropbox Uploa  ===> DEVICE ID = 40 <0x2b8ba680>

when i try to re-call them, they all work great, except for the iphone devices. i believe it’s because they have special character in them. so, how would i go about calling this for those special cases since this does not work:

sebbyCode.DEV["(*)Seb\'s Super Seis"

There really shouldn’t be a need to quote the reverse solid us (backslash). What does the stored string actually look like? Have you tried “Seb’s…” instead of “Seb's” ?