The first step in integrating a new device with your application or controller is to discover the device on the network. SSDP is a standard protocol for LAN device discovery and is used to discover the device's IP address and HTTP port.
Each Konnected device uses a different HTTP port to run the embedded web server used for initial setup and configuration. Use SSDP to discover the IP address and HTTP port.
There are many SSDP client libraries for many different programming languages freely available on GitHub and elsewhere online.
Konnected devices will to a
M-SEARCH request with a ST header of
In response to the M-SEARCH, Konnected will identify itself with the following ST header:
The M-SEARCH response also contains a LOCATION header that specifies the local address to access XML metadata about the device. Most SSDP libraries will fetch this metadata automatically, as well as add metadata such as the device's MAC address.
After successful LAN discovery, your application should register the discovered device in its internal state. The device is best identified by its MAC address or
serialNumber field in the XML metadata. These values will not change.
Your application should persist the IP address and HTTP port of the device for subsequent configuration.
Handling IP address changes
Devices on the network may change internal IP addresses from time to time as DHCP leases renew or devices are disconnected and re-connected. Your application should repeat the SSDP discovery protocol periodically to update the devices' IP address in your internal application state in case it changes.
The HTTP port is fixed per-device and will never change.
Manual IP Configuration
In some cases, SSDP cannot be used or automatic discovery is undesirable. In this case you can assign an internal IP address using your router or DHCP server, and your application can allow the installer or end-user to manually specify an IP address.
To discover the HTTP port, you can do a port scan of the device. It will respond to HTTP requests on a randomized port between 8000 and 17999.