What Happened to deviceNetworkId?

It used to be possible to set deviceNetworkId in the device handler programmatically like this:

device.deviceNetworkId = 'C0A80165:0050'

A lot of custom TCP/IP devices relied on this functionality, including WiFi thermostats, network cameras, VLC Things, etc. Then, at some point during infamous infrastructure upgrade, this stopped working, i.e. I can write to device.deviceNetworkId and read it back and it appears correct, but the actual deviceNetworkId value as displayed in the IDE does not change and HTTP responses are not routed to the device handler.

Can someone from ST engineering comment on this please?

This was reported this morning. I have not received a status yet, but I will update as soon as I do.

I reported too. I will update at soon as I get some info. Thanks for the heads up!

@ben @urman Any thoughts? This explains why everything I have been trying to do isn’t working.

Thanks @geko for confirming this and getting the ball rolling on a fix.

One step closer to getting the cameras working again…

@pstuart

Our engineers are investigating and I believe that they know what the issue is. I’ll update this thread when there’s more information.

Any progress on this? Thanks.

@geko @juano2310 @wackware @pstuart

This issue should be fixed as of an hour ago.

Thanks for your patience guys.

Tyler, you are the man!
Happy New Year!

Works for me! Thanks a lot for taking care of this.

Well… Here we are, 6 month later… Having the same issue again :frowning:

deviceNetworkId cannot be changed.

When I change IP address in VLC Thing, I regenerate and set new deviceNetworkId and read it back correctly:

10:34:50 AM PDT: trace setNetworkId(192.168.1.118, 8080)
10:34:50 AM PDT: trace deviceNetworkId: C0A80176:1F90

However, it never changes on the Hub page in the IDE:

VLC Thing C0A80182:1F90

… and reading it back few seconds later returns the old value:

10:35:00 AM PDT: trace deviceNetworkId: C0A80182:1F90

Needless to say, it’s disappointing to see the old bugs creeping back again :angry:

I just tried to reproduce your issue with my roomba devicetype, and i am unable to. I can change ipaddress and/or port and my deviceNetworkId changes with it.
Here is a link to my code, to see how i handle it. see ipSetup(). Let me know if you need more help debugging your issue.
https://raw.githubusercontent.com/sidjohn1/smartthings/master/ThinkingCleaner.groovy

Quick note here, DNI shouldn’t change! You shouldn’t be using IP address as DNI instead you should use something unique that doesn’t change like MAC address.

Changing DNI only generates instability and this has been the problem with HUE, Wemo, etc.

We are switching to MAC address in all this devices to improve stability and reliability.

If that didn’t convince you :slight_smile: the function to change DNI is device.setDeviceNetworkId("${newDNI}")

VLC Thing does the same thing and it’s been working just fine for a very long time:

device.deviceNetworkId = "${hexIp}:${hexPort}"

See https://raw.githubusercontent.com/statusbits/smartthings/master/vlc_thing/vlc_thing.groovy

Now it’s totally not working. I uninstalled and re-install the device. I gave it a ‘fake’ network ID ‘12345’ when adding a new device and it’s still showing ‘12345’ in the IDE after I configured it with the real IP address and TCP port.

11:26:26 AM PDT: info VLC Thing. Version 1.2.0 (06/28/2015). Copyright © 2014 Statusbits.com
11:26:26 AM PDT: trace VLC Thing updated with settings: [‘confIpAddr’:‘192.168.1.118’, ‘confTcpPort’:8080, ‘confPassword’:’*******’]
11:26:26 AM PDT: trace setNetworkId(192.168.1.118, 8080)
11:26:26 AM PDT: trace deviceNetworkId: C0A80176:1F90

Now, after refresh:

11:38:16 AM PDT: trace refresh()
11:38:16 AM PDT: trace deviceNetworkId: 12345

Is there a way to grab the MAC address and populate automatically DeviceNetworkId, or does that require the user to look it up and type it in correctly?

Yes they are doing the samething, but i’m doing it differently. Try the code below and see if it doesnt work for you.

private String setNetworkId(ipaddr, port) {
def hexIp
def hexPort
LOG(“setNetworkId(${ipaddr}, ${port})”)

hexIp = ipaddr.tokenize('.').collect {
    String.format('%02X', it.toInteger())
}.join()

hexPort = String.format('%04X', port.toInteger())
device.deviceNetworkId = "${hexIp}:${hexPort}"

}

That depends on how you discover the device. For LAN devices we use UPNP to discover and then we can request the value. If you are hard coding you might need to type it manually.
You can also create a unique DNI but I strongly recommend not to change the value.
If you need to store IP and port you should use something else like a data value.

Appreciate the tip, but it’s not working either. Same behavior: when reading back the value immediately after setting, it returns the correct value, but reading it again from a different command handler (e.g. refresh), returns the old value. This is exactly the same issue that was reported in Dec. 2014 and was ‘fixed’ in January.

Tried it. Makes no difference whatsoever, which is expected

Thanks for the heads up. I will escalate this ASAP but please consider using static DNI. You should be able to store the IP in a data value and request it from there.

Thank you!. However I don’t quite understand how ‘static DNI’ is supposed to work. Currently, deviceNetworkId for LAN devices is in the <HEX_IP>:<HEX_PORT> format. This is used for routing IP responses back to the device. I cannot just use a random number can I? So the network ID is not known when I create a new device in the IDE, but I need to input some network ID just to be able to add a device.

Also, with regards to using MAC address as a network ID, wouldn’t it mean that you can only have one Smart Device per MAC address? Currently, I can have multiple devices running on the same host, as long as they have different TCP ports.

P.S.
I contacted support:

[SmartThings Support] Support request #112933: Device unable to set its device network Id (DNI)