]> git.basschouten.com Git - openhab-addons.git/commitdiff
[danfossairunit] Unify thing labels (#14577)
authorJacob Laursen <jacob-github@vindvejr.dk>
Sun, 12 Mar 2023 16:33:28 +0000 (17:33 +0100)
committerGitHub <noreply@github.com>
Sun, 12 Mar 2023 16:33:28 +0000 (17:33 +0100)
* Unify thing labels
* Specify connection type

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
bundles/org.openhab.binding.danfossairunit/src/main/java/org/openhab/binding/danfossairunit/internal/discovery/DanfossAirUnitDiscoveryService.java
bundles/org.openhab.binding.danfossairunit/src/main/resources/OH-INF/addon/addon.xml
bundles/org.openhab.binding.danfossairunit/src/main/resources/OH-INF/i18n/danfossairunit.properties

index 8c0f910cac5a1bd048cffdc7d099084b9467138a..38cd6be8a8eab8b494a2c73fe1e30bd8d170af10 100644 (file)
@@ -33,9 +33,13 @@ import org.openhab.core.config.discovery.AbstractDiscoveryService;
 import org.openhab.core.config.discovery.DiscoveryResult;
 import org.openhab.core.config.discovery.DiscoveryResultBuilder;
 import org.openhab.core.config.discovery.DiscoveryService;
+import org.openhab.core.i18n.LocaleProvider;
+import org.openhab.core.i18n.TranslationProvider;
 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;
 
@@ -56,8 +60,12 @@ public class DanfossAirUnitDiscoveryService extends AbstractDiscoveryService {
 
     private final Logger logger = LoggerFactory.getLogger(DanfossAirUnitDiscoveryService.class);
 
-    public DanfossAirUnitDiscoveryService() {
+    @Activate
+    public DanfossAirUnitDiscoveryService(@Reference TranslationProvider i18nProvider,
+            @Reference LocaleProvider localeProvider) {
         super(SUPPORTED_THING_TYPES_UIDS, TIMEOUT_IN_SECONDS, true);
+        this.i18nProvider = i18nProvider;
+        this.localeProvider = localeProvider;
     }
 
     @Override
@@ -134,7 +142,7 @@ public class DanfossAirUnitDiscoveryService extends AbstractDiscoveryService {
                 ThingUID uid = new ThingUID(THING_TYPE_AIRUNIT, String.valueOf(receivePacket.getAddress().hashCode()));
 
                 DiscoveryResult result = DiscoveryResultBuilder.create(uid).withRepresentationProperty("host")
-                        .withProperties(properties).withLabel("Danfoss HRV").build();
+                        .withProperties(properties).withLabel("@text/discovery.danfossairunit.label").build();
                 thingDiscovered(result);
 
                 logger.debug("Thing discovered '{}'", result);
index 49cbd952ce4577a0bb9ce4396fc127b669e7c737..c46c2c2e1d3f26c67df45b28b8fe931de943cbc7 100644 (file)
@@ -6,5 +6,6 @@
        <type>binding</type>
        <name>DanfossAirUnit Binding</name>
        <description>This is the binding for DanfossAirUnit.</description>
+       <connection>local</connection>
 
 </addon:addon>
index 73a0e755c8b18ca904f7c98fbccb434872ea90f8..63c29ea9d908f177806e02f4cca220fcbea8180f 100644 (file)
@@ -78,6 +78,10 @@ channel-type.danfossairunit.switch.label = Something that can be turned on or of
 channel-type.danfossairunit.temperature.label = Temperature
 channel-type.danfossairunit.temperature.description = Current temperature
 
+# discovery result
+
+discovery.danfossairunit.label = Danfoss Air Unit
+
 # thing status descriptions
 
 offline.connection-not-initialized = Air unit connection not initialized.