Custom SSDP not discoverable?

So I’m using Node, and the node-ssdp library with the following code:

var SSDP = require('node-ssdp').Server;
var server = new SSDP({
  location: require('ip').address() + '/desc.xml',
  sourcePort: 1900,
  ssdpTtl: 3,
});

server.addUSN('urn:ghesp-com:device:stcm:1');

server.on('advertise-alive', function(headers){
  console.log('advertise-alive');
  console.log(headers);
})

server.on('advertise-bye', function(headers){
  console.log('advertise-bye');
  console.log(headers);
})

server.start(function(){
  console.log('Starting..')
});

I can see that the server is working and advertising:

{ HOST: '239.255.255.250:1900',
  NT: 'urn:ghesp:device:STCM:1',
  NTS: 'ssdp:alive',
  USN: 'uuid:f40c2981-7329-40b7-8b04-27f187aecfb5::urn:ghesp:device:STCM:1',
  LOCATION: 'http://192.168.1.123:10293/upnp/desc.html',
  'CACHE-CONTROL': 'max-age=1800',
  SERVER: 'node.js/9.2.0 UPnP/1.1 node-ssdp/3.2.5' }

If I use the UPnP Tools for Windows, I can see the M-SEARCH for the above, and then the NOTIFY response back so I know my server is working.

I’m using the example Generic UPnP SmartApp from here:
http://docs.smartthings.com/en/latest/cloud-and-lan-connected-device-types-developers-guide/building-lan-connected-device-types/building-the-service-manager.html

However I cannot get my device to show up in this. Any ideas?

Hi
I’m doing a similar thing here, I have a windows app I wrote that listens for ssdp M-SEARCH
I have tested it from other windows machines on the LAN, works great.
I can’t get the SmartApp to broadcast to it, I can get responses form most other devices on my LAN. My code SmartApp is very similar to the Generic UPnP SmartApp
Finds all the routers, gateways all on port 1900 as per specs
Cloud to hub seems to be doing something else.
Hoping someone can help

Processing language code running on windows - set to multicast, receiving SSDP traffic

import hypermedia.net.*;

UDP udpTXR; // define the UDP object
String multicastIP = “239.255.255.250”; // multicast address 239.255.255.250
int remotePort = 1900; // the destination port
String buffer;

void setup() {
udpTXR = new UDP(this, remotePort, multicastIP);
udpTXR.loopback( false ); // turn off loopback
udpTXR.listen( true );
}

void draw() {
}

void receive( byte[] data, String sendIP, int portRX ) {
//println(“Received from:”+sendIP+":"+portRX);
String buffer = new String(data);
println(trim(buffer));
println();
}

As verified by what the SmartApp is seeing or by debugging your Windows app?

If you know that the SSDP M-SEARCH request is being sent out by SmartThings, received by other devices, and the M-SEARCH responses are being received by SmartThings from the other devices, I would start by checking what the Windows app is actually seeing. Is it receiving the M-SEARCH requests? If so, then I would check to make sure it is sending out responses that can be captured with other SSDP sniffing tools.

I’ve found that SmartThings is quite particular about the format of SSDP messages it receives.

(FWIW, I helped @ghesp debug his initial SSDP issues)

–Edit–
Can you confirm what it is you are trying to accomplish? Are you trying to get SmartThings to see your Windows device/app? Or are you trying to get your Windows device/app to find SmartThings on the network?

Based on your second post, it looks like you are listening for any UDP multicast traffic received on port 1900. I’m assuming this is your first step in setting up a Windows app that will listen for M-SEARCH requests and then be able to respond to them?

Hi Joshua
I have it working now, M-Search from the cloud thru the hub to my windows device.
My app is now seeing all traffic and replying as required.
It was a multicast issue on my end.
Wow - that’s an eye opener, so much ssdp traffic already on my LAN
Working on Verification & Inclusion now.

Thanks

1 Like