diff --git a/bundles/org.openhab.binding.airparif/src/main/java/org/openhab/binding/airparif/internal/discovery/AirParifDiscoveryService.java b/bundles/org.openhab.binding.airparif/src/main/java/org/openhab/binding/airparif/internal/discovery/AirParifDiscoveryService.java index 61741ff9f7b..c479d6abe47 100755 --- a/bundles/org.openhab.binding.airparif/src/main/java/org/openhab/binding/airparif/internal/discovery/AirParifDiscoveryService.java +++ b/bundles/org.openhab.binding.airparif/src/main/java/org/openhab/binding/airparif/internal/discovery/AirParifDiscoveryService.java @@ -12,9 +12,10 @@ */ package org.openhab.binding.airparif.internal.discovery; -import static org.openhab.binding.airparif.internal.AirParifBindingConstants.*; +import static org.openhab.binding.airparif.internal.AirParifBindingConstants.LOCATION_THING_TYPE; import java.util.List; +import java.util.Set; import org.eclipse.jdt.annotation.NonNullByDefault; import org.openhab.binding.airparif.internal.config.LocationConfiguration; @@ -43,13 +44,12 @@ public class AirParifDiscoveryService extends AbstractThingHandlerDiscoveryServi private static final int DISCOVER_TIMEOUT_SECONDS = 2; private final Logger logger = LoggerFactory.getLogger(AirParifDiscoveryService.class); - private final DepartmentDbService dbService; + private final DepartmentDbService dbService = new DepartmentDbService(); private @NonNullByDefault({}) LocationProvider locationProvider; public AirParifDiscoveryService() { - super(AirParifBridgeHandler.class, SUPPORTED_THING_TYPES_UIDS, DISCOVER_TIMEOUT_SECONDS); - dbService = new DepartmentDbService(); + super(AirParifBridgeHandler.class, Set.of(LOCATION_THING_TYPE), DISCOVER_TIMEOUT_SECONDS); } @Reference(unbind = "-") @@ -77,7 +77,7 @@ public class AirParifDiscoveryService extends AbstractThingHandlerDiscoveryServi if (!candidates.isEmpty()) { candidates.forEach(dep -> thingDiscovered( DiscoveryResultBuilder.create(new ThingUID(LOCATION_THING_TYPE, bridgeUID, dep.id()))// - .withLabel("Location Report: %s".formatted(dep.name())) // + .withLabel("Air Quality Report: %s".formatted(dep.name())) // .withProperty(LocationConfiguration.DEPARTMENT, dep.id()) // .withProperty(LocationConfiguration.LOCATION, serverLocation.toFullString())// .withRepresentationProperty(LocationConfiguration.DEPARTMENT) // diff --git a/bundles/org.openhab.binding.airparif/src/main/java/org/openhab/binding/airparif/internal/handler/AirParifBridgeHandler.java b/bundles/org.openhab.binding.airparif/src/main/java/org/openhab/binding/airparif/internal/handler/AirParifBridgeHandler.java index efdc27e31be..8f92c27cc61 100755 --- a/bundles/org.openhab.binding.airparif/src/main/java/org/openhab/binding/airparif/internal/handler/AirParifBridgeHandler.java +++ b/bundles/org.openhab.binding.airparif/src/main/java/org/openhab/binding/airparif/internal/handler/AirParifBridgeHandler.java @@ -24,6 +24,7 @@ import java.time.Duration; import java.time.LocalDateTime; import java.time.ZonedDateTime; import java.time.temporal.ChronoUnit; +import java.util.Collection; import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -60,6 +61,7 @@ import org.openhab.binding.airparif.internal.api.PollenAlertLevel; import org.openhab.binding.airparif.internal.api.Pollutant; import org.openhab.binding.airparif.internal.config.BridgeConfiguration; import org.openhab.binding.airparif.internal.deserialization.AirParifDeserializer; +import org.openhab.binding.airparif.internal.discovery.AirParifDiscoveryService; import org.openhab.core.library.types.DateTimeType; import org.openhab.core.library.types.StringType; import org.openhab.core.thing.Bridge; @@ -70,6 +72,7 @@ import org.openhab.core.thing.ThingStatus; import org.openhab.core.thing.ThingStatusDetail; import org.openhab.core.thing.ThingUID; import org.openhab.core.thing.binding.BaseBridgeHandler; +import org.openhab.core.thing.binding.ThingHandlerService; import org.openhab.core.types.Command; import org.openhab.core.types.State; import org.openhab.core.types.UnDefType; @@ -330,4 +333,9 @@ public class AirParifBridgeHandler extends BaseBridgeHandler implements HandlerU public Map> getJobs() { return jobs; } + + @Override + public Collection> getServices() { + return Set.of(AirParifDiscoveryService.class); + } }