Problems with parse using a single TCP/IP gateway and a single port

I am writing a device type for devices which connect using an old gateway. There are about 200 devices with 10 different device types which run through a single gateway. The gateway has HTTP access and I can address each device via URL to the IP address and port.

I do not want an application or a single device for all 200 devices, but would like to address each device as a separate element in SmartThings.

I have successfully create a device type for one of the types of devices. When I create a single device (deviceA), based on the device type, everything works well.

When I add a second device (deviceB), there seems to be a problem with the parse routine.

What I am seeing in the log files is that when the deviceB GET is sent, the response for that GET is showing up in the parse routine of deviceA.

I have unique DeviceNetworkID strings for DeviceA and DeviceB. Why is the response for deviceB showing up in deviceA?

Is there a HEADER field that controls this?

HTTP responses are dispatched to devices based on their device network ID (DNI), which is IPADDR:PORT in hex notation. You cannot have two devices with the same DNI. Thus you cannot have more than one device talking to the same host on the same port. This is the architectural limitation. The only way to solve it is using the service manager app that implements custom dispatch logic.

2 Likes

Right… And @NeuralMonk’s requirement for distinct Device Instances in SmartThings is then handled with Child Devices.

Workd fine. That’s how Hue (and others) are implemented.

Okay, so I thought I had solved that issue by modifying the DNI to be IPADDR:PORT:DEVICECODE in hex. However, it seems that the DNI only looks at the first IPADDR:PORT regardless of any additional element.

Is my assumption correct?

Thank you for the pointer, will look at that path. Seems it has to be an Application which creates these.

1 Like