[tradfri] use serial as discovery representation property instead of host (#12389)

Signed-off-by: Stefan Triller <github@stefantriller.de>
This commit is contained in:
Stefan Triller 2022-02-28 18:53:16 +01:00 committed by GitHub
parent 166e4ec1b6
commit dd687435ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -93,7 +93,7 @@ public class TradfriDiscoveryParticipant implements MDNSDiscoveryParticipant {
properties.put(PROPERTY_FIRMWARE_VERSION, fwVersion); properties.put(PROPERTY_FIRMWARE_VERSION, fwVersion);
} }
return DiscoveryResultBuilder.create(thingUID).withProperties(properties) return DiscoveryResultBuilder.create(thingUID).withProperties(properties)
.withLabel("@text/discovery.gateway.label").withRepresentationProperty(GATEWAY_CONFIG_HOST) .withLabel("@text/discovery.gateway.label").withRepresentationProperty(PROPERTY_SERIAL_NUMBER)
.build(); .build();
} else { } else {
logger.warn("Discovered Tradfri gateway doesn't have an IP address: {}", service); logger.warn("Discovered Tradfri gateway doesn't have an IP address: {}", service);

View File

@ -8,7 +8,7 @@
<label>TRÅDFRI Gateway</label> <label>TRÅDFRI Gateway</label>
<description>IKEA TRÅDFRI IP Gateway</description> <description>IKEA TRÅDFRI IP Gateway</description>
<representation-property>host</representation-property> <representation-property>serialNumber</representation-property>
<config-description-ref uri="bridge-type:tradfri:gateway"/> <config-description-ref uri="bridge-type:tradfri:gateway"/>
</bridge-type> </bridge-type>

View File

@ -114,7 +114,7 @@ public class TradfriDiscoveryParticipantOSGITest extends JavaOSGiTest {
assertThat(result.getProperties().get(Thing.PROPERTY_VENDOR), is("IKEA of Sweden")); assertThat(result.getProperties().get(Thing.PROPERTY_VENDOR), is("IKEA of Sweden"));
assertThat(result.getProperties().get(GATEWAY_CONFIG_HOST), is("192.168.0.5")); assertThat(result.getProperties().get(GATEWAY_CONFIG_HOST), is("192.168.0.5"));
assertThat(result.getProperties().get(GATEWAY_CONFIG_PORT), is(1234)); assertThat(result.getProperties().get(GATEWAY_CONFIG_PORT), is(1234));
assertThat(result.getRepresentationProperty(), is(GATEWAY_CONFIG_HOST)); assertThat(result.getRepresentationProperty(), is(Thing.PROPERTY_SERIAL_NUMBER));
} }
@Test @Test