Home » Android » java – Performing a UPNP scan is not returning the Philips Hue Bridge

java – Performing a UPNP scan is not returning the Philips Hue Bridge

Posted by: admin May 14, 2020 Leave a comment


I am trying to implement my own UpNP scan, it is mostly working, and to prove that it’s not me I have a windows program that allows you to send packets and see what response comes back.

I am sending a packet to on port 1900 and I am sending the following data:

Man: "ssdp:discover"
MX: 10
ST: ssdp:all

Just for further info, in my Java code (Android) I have the following but I get the same response as the packet tester application:

            byte[] sendData = new byte[1024];
            //byte[] receiveData = new byte[1024];
            byte[] receiveData;
            String mSearch = "M-SEARCH * HTTP/1.1\r\nHost:\r\nMan: \"ssdp:discover\"\r\nMX: 10\r\nST: ssdp:all\r\n\r\n";
            sendData = mSearch.getBytes();

            DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, InetAddress.getByName(""), 1900);

            DatagramSocket clientSocket = new DatagramSocket();

            while (keepGoing)
                receiveData = new byte[1024];
                receivePacket = new DatagramPacket(receiveData, receiveData.length);

                String response = new String(receivePacket.getData());

                if (response == null || response.length() == 0)
                    keepGoing = false;

            return true;
        catch (UnknownHostException ex)
            Log.e("MainActivity", "Unknown Host Exception: " + ex.toString());
        catch (SocketException ex)
            Log.e("MainActivity", "Socket Exception: " + ex.toString());
        catch (IOException ex)
            Log.e("MainActivity", "IO Exception: " + ex.toString());
        return false;

I am getting some devices come back, such as my smart TV, router and NAS but the Philips Hue bridge is never returned in the reply.

Does the Philips Hue Bridge implement UpNP differently? All I can see is what response they send back now anything about what is needed to find it.

How to&Answers:

Although Philips site notes it supports UPnP, I do not know if it is true or not.

I would try scanning the entire network and testing IP by IP. Yes, I know, this is not which the standard says, but reality is insane sometimes.

This discovery is already implemented out there this way.

I programmed a network search in the past (looking for a Raspberry PI) and the best method I can use was matching MAC addresses with my known address start. Luckily, Philips publish their MAC addresses range.


I was also struggling with this behavior. After some trial and error, I realized that the Hue Bridge does not seem to understand the " around the ssdp:discover value. These quotation marks are also not present in the IETF draft: https://tools.ietf.org/html/draft-cai-ssdp-v1-03

Following request was successful for me:

ST: ssdp:all
MX: 3
MAN: ssdp:discover

This is the response I got:

HTTP/1.1 200 OK
EXT:CACHE-CONTROL: max-age=100
LOCATION: http://192.168.xxx.xxx:80/description.xml
SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/1.16.0
hue-bridgeid: 001788FFFE29D301
ST: urn:schemas-upnp-org:device:basic:1
USN: uuid:2f402f80-da50-11e1-9b23-00178829d301