]> git.basschouten.com Git - openhab-addons.git/commitdiff
[amazondashbutton] fix representation property (#9988)
authorJ-N-K <J-N-K@users.noreply.github.com>
Sat, 30 Jan 2021 19:59:58 +0000 (20:59 +0100)
committerGitHub <noreply@github.com>
Sat, 30 Jan 2021 19:59:58 +0000 (20:59 +0100)
* fix representation property

Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
* address review comments

Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
bundles/org.openhab.binding.amazondashbutton/src/main/java/org/openhab/binding/amazondashbutton/internal/AmazonDashButtonBindingConstants.java
bundles/org.openhab.binding.amazondashbutton/src/main/java/org/openhab/binding/amazondashbutton/internal/discovery/AmazonDashButtonDiscoveryService.java

index 2b904fe5fcd8aa0d3db3935347f7e7e086020cb1..551445a3b499b6befdab3e12fc3cd4a9dd8fe1de 100644 (file)
@@ -33,7 +33,6 @@ public class AmazonDashButtonBindingConstants {
     public static final String PRESS = "press";
 
     // Custom Properties
-    public static final String PROPERTY_MAC_ADDRESS = "macAddress";
     public static final String PROPERTY_NETWORK_INTERFACE_NAME = "pcapNetworkInterfaceName";
     public static final String PROPERTY_PACKET_INTERVAL = "packetInterval";
 }
index 914bc60d04581591a9d0c0d828dcdbae73d6622d..643edb758ef5bf6f7ce7d6bf2282333d1ea85a1b 100644 (file)
@@ -19,8 +19,6 @@ import java.util.Collections;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
 
 import org.openhab.binding.amazondashbutton.internal.capturing.PacketCapturingHandler;
 import org.openhab.binding.amazondashbutton.internal.capturing.PacketCapturingService;
@@ -31,6 +29,7 @@ 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.thing.Thing;
 import org.openhab.core.thing.ThingUID;
 import org.osgi.service.component.annotations.Component;
 import org.pcap4j.core.PcapNetworkInterface;
@@ -63,7 +62,7 @@ public class AmazonDashButtonDiscoveryService extends AbstractDiscoveryService i
      * The Amazon Dash button vendor prefixes
      */
     // @formatter:off
-    private static final Set<String> VENDOR_PREFIXES = Collections.unmodifiableSet(Stream.of(
+    private static final Set<String> VENDOR_PREFIXES = Set.of(
             "F0:D2:F1",
             "88:71:E5",
             "FC:A1:83",
@@ -89,7 +88,7 @@ public class AmazonDashButtonDiscoveryService extends AbstractDiscoveryService i
             "84:D6:D0",
             "34:D2:70",
             "B4:7C:9C"
-        ).collect(Collectors.toSet()));
+        );
     // @formatter:on
 
     /**
@@ -212,8 +211,8 @@ public class AmazonDashButtonDiscoveryService extends AbstractDiscoveryService i
                     // @formatter:off
                     DiscoveryResult discoveryResult = DiscoveryResultBuilder.create(dashButtonThing)
                             .withLabel("Dash Button")
-                            .withRepresentationProperty(macAdressString)
-                            .withProperty(PROPERTY_MAC_ADDRESS, macAdressString)
+                            .withRepresentationProperty(Thing.PROPERTY_MAC_ADDRESS)
+                            .withProperty(Thing.PROPERTY_MAC_ADDRESS, macAdressString)
                             .withProperty(PROPERTY_NETWORK_INTERFACE_NAME, interfaceName)
                             .withProperty(PROPERTY_PACKET_INTERVAL, BigDecimal.valueOf(5000))
                             .build();