diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/discovery/GatewayDiscoveryParticipant.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/discovery/GatewayDiscoveryParticipant.java index a2d5e51a17868..070fa5725b980 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/discovery/GatewayDiscoveryParticipant.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/discovery/GatewayDiscoveryParticipant.java @@ -22,16 +22,13 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.binding.hdpowerview.internal.config.HDPowerViewHubConfiguration; -import org.openhab.binding.hdpowerview.internal.exceptions.HubException; import org.openhab.core.config.discovery.DiscoveryResult; import org.openhab.core.config.discovery.DiscoveryResultBuilder; import org.openhab.core.config.discovery.mdns.MDNSDiscoveryParticipant; import org.openhab.core.thing.Thing; import org.openhab.core.thing.ThingTypeUID; import org.openhab.core.thing.ThingUID; -import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; -import org.osgi.service.component.annotations.Reference; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -46,13 +43,6 @@ public class GatewayDiscoveryParticipant implements MDNSDiscoveryParticipant { private final Logger logger = LoggerFactory.getLogger(GatewayDiscoveryParticipant.class); - private final HDPowerviewPropertyGetter propertyGetter; - - @Activate - public GatewayDiscoveryParticipant(@Reference HDPowerviewPropertyGetter propertyGetter) { - this.propertyGetter = propertyGetter; - } - @Override public @Nullable DiscoveryResult createResult(ServiceInfo service) { ThingUID thingUID = getThingUID(service); @@ -86,11 +76,11 @@ public Set getSupportedThingTypeUIDs() { public @Nullable ThingUID getThingUID(ServiceInfo service) { String host = getIpV4Address(service); if (host != null) { - try { - String serial = propertyGetter.getSerialNumberApiV3(host); + String serial = service.getPropertyString("sn"); + if (serial != null) { return new ThingUID(THING_TYPE_GATEWAY, serial); - } catch (HubException e) { - logger.debug("Error discovering gateway", e); + } else { + logger.debug("Error discovering gateway 'missing serial number'"); } } return null;