]> git.basschouten.com Git - openhab-addons.git/commitdiff
[openthermgateway] warning log if trying to create a legacy Thing type (#12585)
authorAndrew Fiddian-Green <software@whitebear.ch>
Thu, 7 Apr 2022 18:21:59 +0000 (19:21 +0100)
committerGitHub <noreply@github.com>
Thu, 7 Apr 2022 18:21:59 +0000 (20:21 +0200)
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
bundles/org.openhab.binding.openthermgateway/src/main/java/org/openhab/binding/openthermgateway/internal/OpenThermGatewayBindingConstants.java
bundles/org.openhab.binding.openthermgateway/src/main/java/org/openhab/binding/openthermgateway/internal/OpenThermGatewayHandlerFactory.java

index d33667c79c743c52d7df784900f238707b1fddf2..c3a40d97e79b248feb6c835c1aa653824fe64193 100644 (file)
@@ -35,9 +35,10 @@ public class OpenThermGatewayBindingConstants {
     public static final ThingTypeUID BOILER_THING_TYPE_UID = new ThingTypeUID(BINDING_ID, "boiler");
     public static final ThingTypeUID VENTILATION_HEATRECOVERY_THING_TYPE_UID = new ThingTypeUID(BINDING_ID,
             "ventilationheatrecovery");
+    public static final ThingTypeUID LEGACY_THING_TYPE_UID = new ThingTypeUID(BINDING_ID, "otgw");
 
     public static final Set<ThingTypeUID> SUPPORTED_THING_TYPE_UIDS = Set.of(OPENTHERM_GATEWAY_THING_TYPE_UID,
-            BOILER_THING_TYPE_UID, VENTILATION_HEATRECOVERY_THING_TYPE_UID);
+            BOILER_THING_TYPE_UID, VENTILATION_HEATRECOVERY_THING_TYPE_UID, LEGACY_THING_TYPE_UID);
 
     // List of id's for writeable channels
     public static final String CHANNEL_SEND_COMMAND = "sendcommand";
index 9374572dca2dc0f4530341f3b486e004759c2c30..59cf7b9eac9c03d8a2b066893797c6b3ac97bfa2 100644 (file)
@@ -24,6 +24,8 @@ import org.openhab.core.thing.binding.BaseThingHandlerFactory;
 import org.openhab.core.thing.binding.ThingHandler;
 import org.openhab.core.thing.binding.ThingHandlerFactory;
 import org.osgi.service.component.annotations.Component;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * The {@link OpenThermGatewayHandlerFactory} is responsible for creating things and thing
@@ -34,6 +36,7 @@ import org.osgi.service.component.annotations.Component;
 @Component(service = ThingHandlerFactory.class, configurationPid = "binding.openthermgateway")
 @NonNullByDefault
 public class OpenThermGatewayHandlerFactory extends BaseThingHandlerFactory {
+    private final Logger logger = LoggerFactory.getLogger(OpenThermGatewayHandlerFactory.class);
 
     @Override
     public boolean supportsThingType(ThingTypeUID thingTypeUID) {
@@ -50,6 +53,10 @@ public class OpenThermGatewayHandlerFactory extends BaseThingHandlerFactory {
             return new BoilerHandler(thing);
         } else if (thingTypeUID.equals(OpenThermGatewayBindingConstants.VENTILATION_HEATRECOVERY_THING_TYPE_UID)) {
             return new VentilationHeatRecoveryHandler(thing);
+        } else if (thingTypeUID.equals(OpenThermGatewayBindingConstants.LEGACY_THING_TYPE_UID)) {
+            logger.warn(
+                    "Thing type {} is no longer supported by the OpenThermGateway binding. You need to create new Things according to the documentation.",
+                    thingTypeUID);
         }
 
         return null;