Class IpAddonFinder

java.lang.Object
org.openhab.core.config.discovery.addon.BaseAddonFinder
org.openhab.core.config.discovery.addon.ip.IpAddonFinder
All Implemented Interfaces:
AddonFinder

@NonNullByDefault public class IpAddonFinder extends BaseAddonFinder
This is a IpAddonFinder for finding suggested add-ons by sending IP packets to the network and collecting responses. This finder is intended to detect devices on the network which do not announce via UPnP or mDNS. Some devices respond to queries to defined multicast addresses and ports and thus can be detected by sending a single frame on the IP network.

Be aware of possible side effects of sending packets to unknown devices in the network! This is why the IP finder is not intended for large scale network scanning, e.g. using large port or IP ranges.

Configuration

The following parameters can be used to configure frames to be sent to the network:

discovery-parameter values comment
type ipMulticast no other options implemented
destIp destination IP address
destPort destination port
listenPort port to use for listening to responses (optional) privileged ports (<1024) not allowed
request description of request frame as hex bytes separated by spaces (e.g. 0x01 0x02 ...) dynamic replacement of variables $srcIp, $srcPort and $uuid, no others implemented yet
requestPlain description of request frame as plaintext string dynamic replacement of variables $srcIp, $srcPort and $uuid, no others implemented yet; there are five XML special characters which need to be escaped:

 & - &amp;
 < - &lt;
 > - &gt;
 " - &quot;
 ' - &apos;
 
timeoutMs timeout to wait for a answers

dynamic replacement (in request*) value
$srcIp source IP address
$srcPort source port
$uuid String returned by java.util.UUID.randomUUID()

Packets are sent out on every available network interface.

There is currently only one match-property defined: response. It allows a regex match, but currently only ".*" is supported.

Limitations

The IpAddonFinder is still under active development. There are limitations:

  • Currently every returned frame is considered as success, regex matching is not implemented.
  • Frames are sent only on startup (or if an AddonInfoProvider calls setAddonCandidates(List)), no background scanning.
    Author:
    Holger Friedrich - Initial contribution
    API note:
    The IpAddonFinder is still under active development, it has initially been developed to detect KNX installations and will be extended. Configuration parameters and supported features may still change.
    Implementation note:
    On activation, a thread is spawned which handles the detection. Scan runs once, no continuous background scanning.
    • Field Details

    • Constructor Details

      • IpAddonFinder

        public IpAddonFinder()
    • Method Details

      • deactivate

        public void deactivate()
      • setAddonCandidates

        public void setAddonCandidates(List<AddonInfo> candidates)
        Description copied from interface: AddonFinder
        The framework calls this method to provide a list of AddonInfo elements which contain potential candidates that this finder can iterate over in order to detect which ones to return via the getSuggestedAddons() method.
        Specified by:
        setAddonCandidates in interface AddonFinder
        Overrides:
        setAddonCandidates in class BaseAddonFinder
        Parameters:
        candidates - a list of AddonInfo candidates.
      • addAddonService

        protected void addAddonService(AddonService featureService)
      • removeAddonService

        protected void removeAddonService(AddonService featureService)
      • getSuggestedAddons

        public Set<AddonInfo> getSuggestedAddons()
        Description copied from interface: AddonFinder
        The framework calls this method to scan through the candidate list of AddonInfo and return a subset of those that it suggests to be installed.
      • getServiceName

        public String getServiceName()
        Specified by:
        getServiceName in class BaseAddonFinder