Did you fix the BACnet local device issue? You would do that on the /system_settings.shtm page in the BACnet Local Devices section. They should not have the same device ID.
I believe DiagramCtrl is your code, yes? That array where you are taking an index of an then assessing the .value of something that is undefined, have you tried to examine how that array got populated? It's generally not sustainable for us to log into customer systems to troubleshoot customer code for free, but if you want to email the credentials to firstname.lastname@example.org we may choose to look without making any guarantees implied or otherwise.
I suggest focusing on why the array you think has things in it does not. And fixing the BACnet local device IDs to be different. It doesn't sound like it's an issue with our code, since you can fetch the values from the tools we provided to get the data. It's in the array you've built that the issue is, it seems.