# SSDP – Simple Service Discovery Protocol

**URL:** <https://discourse.nodered.org/t/ssdp-simple-service-discovery-protocol/74456>\
**Category:** General\
**Created:** [31 January 2023 02:33 UTC](https://discourse.nodered.org/t/ssdp-simple-service-discovery-protocol/74456 "2023-01-31T02:33:58Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![allacmc](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/allacmc/32/73549_2.png) [@allacmc](https://discourse.nodered.org/u/allacmc)\
**Post date:** [31 January 2023 02:33 UTC](https://discourse.nodered.org/t/ssdp-simple-service-discovery-protocol/74456/1 "2023-01-31T02:33:58Z")

</div>

I have a certain need to make sure that the equipment that sends information via MQTT is present or not in my network.

So I would like to know if there is any node that uses the SSDP protocol?

Or if there is any initiative in this direction.

I even found this npm package on the web, but as it has no documentation nor is it available in the palette. I was suspicious.

node-red-contrib-ssdp-discover - npm

> **[node-red-contrib-ssdp-discover](https://www.npmjs.com/package/node-red-contrib-ssdp-discover)**
>
> Node-Red node for detection by Simple Service Discovery Protocol (SSDP). Latest version: 0.0.2, last published: 8 years ago. Start using node-red-contrib-ssdp-discover in your project by running \`npm i node-red-contrib-ssdp-discover\`. There are 2...

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [31 January 2023 10:19 UTC](https://discourse.nodered.org/t/ssdp-simple-service-discovery-protocol/74456/2 "2023-01-31T10:19:01Z")

</div>

Well if you follow that link you see:

 ![Screenshot 2023-01-31 at 5.16.25 AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/f/2fd2e7cb7fb4885c3d30fdd7e750ca61afbc554b.png)  
so I would ignore it.

If you didn't find a node searching the [Flow library](https://flows.nodered.org/) then there isn't one publicly avaliable.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [31 January 2023 10:29 UTC](https://discourse.nodered.org/t/ssdp-simple-service-discovery-protocol/74456/3 "2023-01-31T10:29:03Z")

</div>

Could you use MQTT LWT instead?

---

<div class="post-metadata">

**Author:** ![allacmc](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/allacmc/32/73549_2.png) [@allacmc](https://discourse.nodered.org/u/allacmc)\
**Post date:** [31 January 2023 14:45 UTC](https://discourse.nodered.org/t/ssdp-simple-service-discovery-protocol/74456/4 "2023-01-31T14:45:56Z")

</div>

I have a device on the network that is a Raspberry PI.

This equipment has a little program in python that sends data to the MQTT server.

I would like to know through my system developed in NODE-RED that this equipment is connected to the network.

Of course I'm only going to use this in case it's not sending data to MQTT, because if it's sending data... I don't need to discover it on the network.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [31 January 2023 15:02 UTC](https://discourse.nodered.org/t/ssdp-simple-service-discovery-protocol/74456/5 "2023-01-31T15:02:27Z")

</div>

OK, so you are trying to identify the situation where it is on the network, but not connected to the MQTT broker for some reason. I generally use the ping node for that type of scenario.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [31 January 2023 15:12 UTC](https://discourse.nodered.org/t/ssdp-simple-service-discovery-protocol/74456/6 "2023-01-31T15:12:25Z")

</div>

A NR flow on remote Pies can send a "heartbeat" MQTT message every 10 seconds say.  
A flow on the central NR / mosquitto server sends a notificaton if no message arrives for 20 seconds.

But the MQTT node's "close" and "will" offer the same notifications.  
If I shutdown the remote Pi, my main server gets the "close" message.  
If I just pull the plug, after a timeout period it gets the "will" message.  
Somehow it's hard to trust these messages though so I generally use the heartbeat approach.

Will (LWT) messages are described for Python at [http://www.steves-internet-guide.com/mqtt-last-will-example/](http://www.steves-internet-guide.com/mqtt-last-will-example/)

---

<div class="post-metadata">

**Author:** ![allacmc](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/allacmc/32/73549_2.png) [@allacmc](https://discourse.nodered.org/u/allacmc)\
**Post date:** [31 January 2023 15:20 UTC](https://discourse.nodered.org/t/ssdp-simple-service-discovery-protocol/74456/7 "2023-01-31T15:20:19Z")

</div>

The problem is that the ping node you need to know what the IP of the equipment is.

In this case, I already use the ping node in other situations

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/3/b38b7bab8c7ebe5d07f66ad62ee950a6b07f82d0.png)

---

<div class="post-metadata">

**Author:** ![allacmc](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/allacmc/32/73549_2.png) [@allacmc](https://discourse.nodered.org/u/allacmc)\
**Post date:** [31 January 2023 15:28 UTC](https://discourse.nodered.org/t/ssdp-simple-service-discovery-protocol/74456/8 "2023-01-31T15:28:00Z")

</div>

> [@jbudd](#):
>
> .
> 
> But the MQTT node's "close" and "will" offer the same notifications.

I don't think that's the concept.  
Maybe I didn't explain it right. Or the translator didn't allow me to say what I wanted.

You are focused on MQTT communication.

My problem is not the MQTT.

I need something that tells me there on the NODE-RED Server that there is "Some raspberry PI" on the network.

My equipment at the end that sends information via mqtt

it is not connected directly and it is not a "Reliable" equipment plugged in all the time.

It is a device that plugs and unplugs all the time... through a cable.

---

<div class="post-metadata">

**Author:** ![allacmc](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/allacmc/32/73549_2.png) [@allacmc](https://discourse.nodered.org/u/allacmc)\
**Post date:** [31 January 2023 15:30 UTC](https://discourse.nodered.org/t/ssdp-simple-service-discovery-protocol/74456/9 "2023-01-31T15:30:46Z")

</div>

My raspberry pi sticks to a diver's suit.

Which is connected by a cable... The power and connection is not stable.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/e/dec2c9f1c6b40fd22bc8919ecc9e05c450e347a9.jpeg)

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [31 January 2023 15:51 UTC](https://discourse.nodered.org/t/ssdp-simple-service-discovery-protocol/74456/10 "2023-01-31T15:51:10Z")

</div>

> [@allacmc](#):
>
> You are focused on MQTT communication.
> 
> I need something that tells me there on the NODE-RED Server that there is "Some raspberry PI" on the network.

Perhaps we are indeed suffering from lack of a common language. Apologies if I'm getting confused.

I am not focussed on the MQTT communication, it just happens that MQTT seems to offer what you are seeking.

Here's how it works:

- The birth, close and will messages are all sent _when the underwater device first connects_ to the MQTT broker. So these are all safe in the broker up on dry land.
- If the connection to the submerged device is lost, either the close or will message (depending on how graceful the disconnect was) is passed on to subscribers.

If Node-red receives a message on (for exampe) topic /diver/birth, it knows that there is some Raspberry Pi online.  
If it receives a message on /diver/disconnect or on /diver/broken, it knows that the Raspberry Pi is no longer online.

---

<div class="post-metadata">

**Author:** ![allacmc](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/allacmc/32/73549_2.png) [@allacmc](https://discourse.nodered.org/u/allacmc)\
**Post date:** [31 January 2023 16:16 UTC](https://discourse.nodered.org/t/ssdp-simple-service-discovery-protocol/74456/11 "2023-01-31T16:16:30Z")

</div>

> [@jbudd](#):
>
> If it receives a message on /diver/disconnect or on /diver/broken, it knows that the Raspberry Pi is no longer online.

I have some doubts if this will actually work.

Because the program that sends the information is written in a python program. This program is flawed.

for example:

It's working, remove the network cable and it stops...Put the network cable and it doesn't come back.

Can I have any problem with running python program on raspberry pi

There is another possibility.

If a particular piece of equipment is faulty. Due to physical connection problems, another piece of equipment will probably be installed in its place.

So I need to install an SSDP on the network.

Because I want through the server.

Find out which devices are on the network.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [31 January 2023 16:43 UTC](https://discourse.nodered.org/t/ssdp-simple-service-discovery-protocol/74456/12 "2023-01-31T16:43:17Z")

</div>

Some ways to detect if there is "Some Raspberry Pi" on the network...

1. **sudo nmap -sn 192.168.1.0/24 | awk '/Nmap scan report for/{printf $5;}/MAC Address:/{print "|"substr($0, index($0,$3)) }'**

```auto
192.168.1.1|E8:48:B8:F6:BE:CF (Unknown)
192.168.1.2|B6:FB:E4:63:00:67 (Unknown)
192.168.1.26|B8:27:EB:34:EB:55 (Raspberry Pi Foundation)
192.168.1.28|E4:5F:01:7F:FE:01 (Raspberry Pi Trading)
192.168.1.30|4C:34:88:97:61:75 (Intel Corporate)
192.168.1.41|24:62:AB:25:74:94 (Espressif)
192.168.1.42|24:62:AB:25:65:AA (Espressif)
192.168.1.44|B4:E6:2D:75:D1:74 (Espressif)

```

NB You have to ensure that nmap has an up-to date list including all the MAC address ranges belonging to Raspberry Pi Trading and Raspberry Pi Foundation.

1. Ping the IP address revealed by (1)  
**ping -c 2 192.168.1.28**

> PING 192.168.1.28 (192.168.1.28) 56(84) bytes of data.  
> 64 bytes from 192.168.1.28: icmp\_seq=1 ttl=64 time=370 ms  
> 64 bytes from 192.168.1.28: icmp\_seq=2 ttl=64 time=2.13 ms
> 
> --- 192.168.1.28 ping statistics ---  
> 2 packets transmitted, 2 received, 0% packet loss, time 2ms  
> rtt min/avg/max/mdev = 2.131/186.178/370.225/184.047 ms

1. Ping the hostname. (Needs Apple Bonjour service on the computer sending ping)  
**ping -c 2 CrucialPi.local**

> PING CrucialPi.local (192.168.1.12) 56(84) bytes of data.  
> 64 bytes from 192.168.1.12 (192.168.1.12): icmp\_seq=1 ttl=64 time=2.38 ms  
> 64 bytes from 192.168.1.12 (192.168.1.12): icmp\_seq=2 ttl=64 time=5.03 ms
> 
> --- CrucialPi.local ping statistics ---  
> 2 packets transmitted, 2 received, 0% packet loss, time 2ms  
> rtt min/avg/max/mdev = 2.380/3.702/5.025/1.323 ms

1. MQTT birth, disconnect and will messages from python on the remote device.

2. MQTT birth, disconnect and will messages from Node-red on the remote device (bypassing unreliable python script). The message content could be the IP address to be used for option 2.

3. Heartbeat messages from Node-red on the remote device.

4. No doubt there are many other possibilities.

Note that the Raspberry Pi has a hardware watchdog which can be set up to reboot if the network goes down, thereby resetting your python script

---

<div class="post-metadata">

**Author:** ![allacmc](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/allacmc/32/73549_2.png) [@allacmc](https://discourse.nodered.org/u/allacmc)\
**Post date:** [31 January 2023 16:54 UTC](https://discourse.nodered.org/t/ssdp-simple-service-discovery-protocol/74456/13 "2023-01-31T16:54:16Z")

</div>

> [@jbudd](#):
>
> Note that the Raspberry Pi has a hardware watchdog which can be set up to reboot if the network goes down, thereby resetting your python script

I love the quote above.

I will study how to implement.

How could I run this nMAP command? inside NODE-Rede and display the result on a screen ?

Could the "EXEC" node do that?

Where do I find this watchdog? On the raspberry PI?

I use the DietPI operating system.

---

<div class="post-metadata">

**Author:** ![krambriw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/krambriw/32/5429_2.png) [@krambriw](https://discourse.nodered.org/u/krambriw)\
**Post date:** [3 February 2023 14:39 UTC](https://discourse.nodered.org/t/ssdp-simple-service-discovery-protocol/74456/14 "2023-02-03T14:39:44Z")

</div>

> [@allacmc](#):
>
> It's working, remove the network cable and it stops...Put the network cable and it doesn't come back

Then I think you should revisit your Python code, It is for sure possible to write a Python program that detects network down and then reconnects and continuos when network is back

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [3 February 2023 16:02 UTC](https://discourse.nodered.org/t/ssdp-simple-service-discovery-protocol/74456/15 "2023-02-03T16:02:04Z")

</div>

> [@allacmc](#):
>
> How could I run this nMAP command? inside NODE-Rede and display the result on a screen ?

NMAP is extra software that can be installed at the OS level using `apt`. I run a BASH shell script on a CRON timer that runs nmap and uses its XML output option to create a temporary file and then I call a node-red http-in endpoint to trigger a flow that reads the temporary file and process it in node-red. I can share the script if needed. I use it to keep track of all of the devices that appear on my network.

> [@allacmc](#):
>
> Could the "EXEC" node do that?

The exec node simply runs an OS command. Much as you would at a terminal command line prompt.

> [@allacmc](#):
>
> Where do I find this watchdog? On the raspberry PI?

Much has been written about using Watchdog on the Pi, there are loads of tutorials.

---

<div class="post-metadata">

**Author:** ![Buckskin](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@Buckskin](https://discourse.nodered.org/u/Buckskin)\
**Post date:** [3 February 2023 22:55 UTC](https://discourse.nodered.org/t/ssdp-simple-service-discovery-protocol/74456/16 "2023-02-03T22:55:18Z")

</div>

I have been using your original flow with some success, but I think I read that you have updated it. Any chance of publishing it (I have the nmap script which is also working well already running)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [4 April 2023 22:56 UTC](https://discourse.nodered.org/t/ssdp-simple-service-discovery-protocol/74456/17 "2023-04-04T22:56:16Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
