Author Topic: Change Device ID  (Read 1029 times)

Offline jlind

  • Full Member
  • ***
  • Posts: 197
  • Karma: +7/-5
Change Device ID
« on: August 23, 2017, 09:37:15 am »
Hi,
This is an odd question I know, but is it possible to change the device ID for a device on my Vera?  I actually want to lower the device ID to a value that no longer currently exists on my Vera.

Unfortunately, my Vera interfaces with another software, that I didn't write, that only allows device ID's up to 255.  I'm unsure of how long it will take to fix the other software so I was curious about a possible workaround.

Thanks!

VeraLite/VeraPlus with UI7, Multiple GE switches, GE Outlets, Aeon Smart Switches, Minimote, GE Portable outlets  Apps: (Pentair Autelis Plugin, Weather Underground, Honeywell WiFi Thermo, System Monitor, AlternateUI)

Offline RichardTSchaefer

  • Master Member
  • *******
  • Posts: 9633
  • Karma: +733/-136
    • RTS Services Plugins
Re: Change Device ID
« Reply #1 on: August 25, 2017, 07:04:22 pm »
The only way to do this is to:
1) Backup  your Vera in case you hose it!
2) Shutdown the LuaUPnP process.
3) Decompress the user_data.json.lzo
4) Edit user_data.json
5) Compress user_data.json
6) Power Cycle your Vera.
7) You may have to fix any scenes and or PLEG devices that reference this device.

All of these steps past step 1, require considerable Unix knowledge, and an understanding of json syntax. I will not provide any more details. If you hose the user_data.json file, you can brick your controller.
 

Offline mcv.bogdanf

  • Steering Box Fanclub
  • Administrator
  • Full Member
  • *****
  • Posts: 173
  • Karma: +7/-0
  • Did you change the oil ?
Re: Change Device ID
« Reply #2 on: August 26, 2017, 08:30:48 pm »
You can use the following code in the 'Test Luup Code' section (Apps - Develop Apps):

luup.attr_set("id","desired_id",current_id)

Replace the desired_id with the new ID and current_id with the id at present

Offline akbooer

  • Master Member
  • *******
  • Posts: 5188
  • Karma: +226/-67
  • "Less is more"
Re: Change Device ID
« Reply #3 on: August 27, 2017, 06:14:19 am »
Well, that's a revelation!



...however, I do note that after doing so, the luup.devices structure is NOT updated, and, of course, any running plugins which scan this for device numbers will be completely screwed up.  A reload would certainly be desirable...



...also, if using AltUI, you can simply implement this by directly editing the device attribute "id".
« Last Edit: August 27, 2017, 06:52:31 am by akbooer »
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P.
Razberry, MySensors Arduino, HomeWave, AltUI, DataYours, openLuup, ZWay, ZeroBrane Studio.

Offline michelhamelin

  • Full Member
  • ***
  • Posts: 119
  • Karma: +2/-0
Re: Change Device ID
« Reply #4 on: August 27, 2017, 10:09:49 am »
I think it is a good ideas when a device failed, re-include device and after switch device ID and delete failed device.
Nothing to change in Lua or scenes.

You can use the following code in the 'Test Luup Code' section (Apps - Develop Apps):

luup.attr_set("id","desired_id",current_id)

Replace the desired_id with the new ID and current_id with the id at present

Online rafale77

  • Hero Member
  • *****
  • Posts: 699
  • Karma: +35/-20
Re: Change Device ID
« Reply #5 on: August 27, 2017, 12:22:45 pm »
Strongly suggest mcv to implement this function in the UI... well at least I know how to do it now.
I suppose it does not change the next incremental device id of a new device though.
127 zwave nodes, 8 zigbee nodes, 256 devices, 17 apps, 128 scenes on a Vera Plus linked with Echo and HomeKit through bridges

Offline jlind

  • Full Member
  • ***
  • Posts: 197
  • Karma: +7/-5
Re: Change Device ID
« Reply #6 on: August 29, 2017, 09:41:51 am »
I used the luup.attr_set command and it worked as expected.  Everything is good now.  Thanks everyone for the response!
VeraLite/VeraPlus with UI7, Multiple GE switches, GE Outlets, Aeon Smart Switches, Minimote, GE Portable outlets  Apps: (Pentair Autelis Plugin, Weather Underground, Honeywell WiFi Thermo, System Monitor, AlternateUI)

Offline kwieto

  • Full Member
  • ***
  • Posts: 150
  • Karma: +4/-5
Re: Change Device ID
« Reply #7 on: September 01, 2017, 04:19:55 am »
What about changing parent ID?
If I change Id of a master device, where i.e. 2 or more child devices are, will they follow the master?

Offline akbooer

  • Master Member
  • *******
  • Posts: 5188
  • Karma: +226/-67
  • "Less is more"
Re: Change Device ID
« Reply #8 on: September 01, 2017, 05:15:39 am »
Good point.  Probably, almost definitely, not.  Although duplicates with the right parent may be created on the next reload.

The fact is that fiddling with device numbers is risky and, frankly, I don't really see why you'd do it, with the possible exception noted by @michelhamelin to avoid scene code changes.
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P.
Razberry, MySensors Arduino, HomeWave, AltUI, DataYours, openLuup, ZWay, ZeroBrane Studio.

Offline kwieto

  • Full Member
  • ***
  • Posts: 150
  • Karma: +4/-5
Re: Change Device ID
« Reply #9 on: September 01, 2017, 05:36:55 am »
Sometimes it is needed to exclude and include again a device when its configuration changes (i.e. attaching a new sensor). Changing device ID seems to be more simple than digging into the scenes where it is used and modify them.

Another topic is that I have some troubles with Netatmo Plugin, when from time to time some of the devices are recreated with new ID, with no apparent reason.
Fortunately in this case changing device ID should be enough, as parent ID stays the same.


Offline Mai Pensato

  • Full Member
  • ***
  • Posts: 180
  • Karma: +3/-1
Re: Change Device ID
« Reply #10 on: September 02, 2017, 02:59:29 pm »
Question: if you exclude a device, say ID 150 and include it again with new device-ID 201 and then change the device ID from 201 back to 150. So the device nr with the highest ID is then 200.  What if you then include a new device: will it get ID 201 or 202 ?

Offline akbooer

  • Master Member
  • *******
  • Posts: 5188
  • Karma: +226/-67
  • "Less is more"
Re: Change Device ID
« Reply #11 on: September 02, 2017, 03:16:25 pm »
Easy to try, but I would guess 202, since there is an independent variable in the user_data which holds the next device number.
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P.
Razberry, MySensors Arduino, HomeWave, AltUI, DataYours, openLuup, ZWay, ZeroBrane Studio.

Offline Cor

  • Hero Member
  • *****
  • Posts: 1108
  • Karma: +4/-4
Re: Change Device ID
« Reply #12 on: September 19, 2017, 03:44:13 am »
Someone pointed me to this thread.

I Need to change a Fibaro double relais which is used in some PLEG and scenes:
Parent: #49
E1: #54
E2: #55

How should I use this code for the new relais? , it will be replaced by a double relais from Qubino.
First delete the old fibaro?
Than This code for all 3 (new) devices?
Quote
luup.attr_set("id","desired_id",current_id)

Replace the desired_id with the new ID and current_id with the id at present

Many thanks,
Cor

Offline Cor

  • Hero Member
  • *****
  • Posts: 1108
  • Karma: +4/-4
Re: Change Device ID
« Reply #13 on: September 21, 2017, 02:06:13 pm »
No one has some more insights in this?

Thanks,
Cor

Offline shward1

  • Full Member
  • ***
  • Posts: 112
  • Karma: +4/-0
Re: Change Device ID
« Reply #14 on: September 21, 2017, 04:52:24 pm »
This is the procedure I used for a similar device -
  • Change ID on parent device
  • Via Advanced/Command do a reconfigure of the parent device
  • Change ID of child devices
  • Update each scene and PLEG so they use new device IDs