[amazondashbutton] fix representation property (#9988)

* 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>
This commit is contained in:
J-N-K 2021-01-30 20:59:58 +01:00 committed by GitHub
parent f58df8fd25
commit f1aec07181
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 7 deletions

View File

@ -33,7 +33,6 @@ public class AmazonDashButtonBindingConstants {
public static final String PRESS = "press"; public static final String PRESS = "press";
// Custom Properties // Custom Properties
public static final String PROPERTY_MAC_ADDRESS = "macAddress";
public static final String PROPERTY_NETWORK_INTERFACE_NAME = "pcapNetworkInterfaceName"; public static final String PROPERTY_NETWORK_INTERFACE_NAME = "pcapNetworkInterfaceName";
public static final String PROPERTY_PACKET_INTERVAL = "packetInterval"; public static final String PROPERTY_PACKET_INTERVAL = "packetInterval";
} }

View File

@ -19,8 +19,6 @@ import java.util.Collections;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; 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.PacketCapturingHandler;
import org.openhab.binding.amazondashbutton.internal.capturing.PacketCapturingService; 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.DiscoveryResult;
import org.openhab.core.config.discovery.DiscoveryResultBuilder; import org.openhab.core.config.discovery.DiscoveryResultBuilder;
import org.openhab.core.config.discovery.DiscoveryService; import org.openhab.core.config.discovery.DiscoveryService;
import org.openhab.core.thing.Thing;
import org.openhab.core.thing.ThingUID; import org.openhab.core.thing.ThingUID;
import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Component;
import org.pcap4j.core.PcapNetworkInterface; import org.pcap4j.core.PcapNetworkInterface;
@ -63,7 +62,7 @@ public class AmazonDashButtonDiscoveryService extends AbstractDiscoveryService i
* The Amazon Dash button vendor prefixes * The Amazon Dash button vendor prefixes
*/ */
// @formatter:off // @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", "F0:D2:F1",
"88:71:E5", "88:71:E5",
"FC:A1:83", "FC:A1:83",
@ -89,7 +88,7 @@ public class AmazonDashButtonDiscoveryService extends AbstractDiscoveryService i
"84:D6:D0", "84:D6:D0",
"34:D2:70", "34:D2:70",
"B4:7C:9C" "B4:7C:9C"
).collect(Collectors.toSet())); );
// @formatter:on // @formatter:on
/** /**
@ -212,8 +211,8 @@ public class AmazonDashButtonDiscoveryService extends AbstractDiscoveryService i
// @formatter:off // @formatter:off
DiscoveryResult discoveryResult = DiscoveryResultBuilder.create(dashButtonThing) DiscoveryResult discoveryResult = DiscoveryResultBuilder.create(dashButtonThing)
.withLabel("Dash Button") .withLabel("Dash Button")
.withRepresentationProperty(macAdressString) .withRepresentationProperty(Thing.PROPERTY_MAC_ADDRESS)
.withProperty(PROPERTY_MAC_ADDRESS, macAdressString) .withProperty(Thing.PROPERTY_MAC_ADDRESS, macAdressString)
.withProperty(PROPERTY_NETWORK_INTERFACE_NAME, interfaceName) .withProperty(PROPERTY_NETWORK_INTERFACE_NAME, interfaceName)
.withProperty(PROPERTY_PACKET_INTERVAL, BigDecimal.valueOf(5000)) .withProperty(PROPERTY_PACKET_INTERVAL, BigDecimal.valueOf(5000))
.build(); .build();