Two devices with same IP and port endpoint for hubaction?

I have a device I’m sending messages to via hubaction. In this case, the device controls two different relays. I want to have a button device for each relay. But then each device would be talking to the same IP and port, and just sending different messages. It seems this isn’t possible since the device id needs to be set to the ip and port. I just want to confirm: it is absolutely impossible to have two different devices talking to the same ip address and port, correct?

correct, a smartapp is the better way to do this and create 2 virtual devices relaying their commands through the “connect” smartapp.

Thanks. That sounds good… um, do you have a short and sweet example of something like this? I’ve search the ST docs, but it’s hard to find anything in those… thx!

Plenty of examples out there. Hue, Sonos, Ecobee, etc.

Basics:
Create virtual DTH for each relay, basic capability handling
link capability to “parent.off/on” assuming on/off is the function you are calling in smartapp
Create simple smartapp to connect to device via hubaction, process response from device, UI asks for ip and port.
On Install of smartapp, check if devices are installed, if not, create child devices
create smartapp functions “on and off” for handling the DTH “parent.off/on” requests to send to lan device via hubaction.

Agreed the docs should be better, but hey that’s a long list of things that should be better.

Browse the github repo for SmartThingsCommunity and there are a lot of great examples.

http://www.golfwrx.com/forums/public/style_emoticons/default/cheesy.gif

1 Like