mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-25 14:55:55 +01:00
[avmfritz] Exclude other Powerline products from discovery (#11682)
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
This commit is contained in:
parent
35338506ce
commit
7c8a197e17
@ -37,7 +37,7 @@ public class AVMFritzBindingConstants {
|
||||
public static final String BINDING_ID = "avmfritz";
|
||||
public static final String BRIDGE_FRITZBOX = "fritzbox";
|
||||
public static final String BOX_MODEL_NAME = "FRITZ!Box";
|
||||
public static final String POWERLINE_MODEL_NAME = "FRITZ!Powerline";
|
||||
public static final String POWERLINE546E_MODEL_NAME = "FRITZ!Powerline 546E";
|
||||
|
||||
// List of main device types
|
||||
public static final String DEVICE_DECT500 = "FRITZ_DECT_500";
|
||||
@ -48,8 +48,8 @@ public class AVMFritzBindingConstants {
|
||||
public static final String DEVICE_DECT210 = "FRITZ_DECT_210";
|
||||
public static final String DEVICE_DECT200 = "FRITZ_DECT_200";
|
||||
public static final String DEVICE_DECT100 = "FRITZ_DECT_Repeater_100";
|
||||
public static final String DEVICE_PL546E = "FRITZ_Powerline_546E";
|
||||
public static final String DEVICE_PL546E_STANDALONE = "FRITZ_Powerline_546E_Solo";
|
||||
public static final String DEVICE_POWERLINE546E = "FRITZ_Powerline_546E";
|
||||
public static final String DEVICE_POWERLINE546E_STANDALONE = "FRITZ_Powerline_546E_Solo";
|
||||
public static final String DEVICE_COMETDECT = "Comet_DECT";
|
||||
public static final String DEVICE_HAN_FUN_CONTACT = "HAN_FUN_CONTACT";
|
||||
public static final String DEVICE_HAN_FUN_SWITCH = "HAN_FUN_SWITCH";
|
||||
@ -70,9 +70,9 @@ public class AVMFritzBindingConstants {
|
||||
public static final ThingTypeUID DECT210_THING_TYPE = new ThingTypeUID(BINDING_ID, DEVICE_DECT210);
|
||||
public static final ThingTypeUID DECT200_THING_TYPE = new ThingTypeUID(BINDING_ID, DEVICE_DECT200);
|
||||
public static final ThingTypeUID DECT100_THING_TYPE = new ThingTypeUID(BINDING_ID, DEVICE_DECT100);
|
||||
public static final ThingTypeUID PL546E_THING_TYPE = new ThingTypeUID(BINDING_ID, DEVICE_PL546E);
|
||||
public static final ThingTypeUID PL546E_STANDALONE_THING_TYPE = new ThingTypeUID(BINDING_ID,
|
||||
DEVICE_PL546E_STANDALONE);
|
||||
public static final ThingTypeUID POWERLINE546E_THING_TYPE = new ThingTypeUID(BINDING_ID, DEVICE_POWERLINE546E);
|
||||
public static final ThingTypeUID POWERLINE546E_STANDALONE_THING_TYPE = new ThingTypeUID(BINDING_ID,
|
||||
DEVICE_POWERLINE546E_STANDALONE);
|
||||
public static final ThingTypeUID COMETDECT_THING_TYPE = new ThingTypeUID(BINDING_ID, DEVICE_COMETDECT);
|
||||
public static final ThingTypeUID HAN_FUN_CONTACT_THING_TYPE = new ThingTypeUID(BINDING_ID, DEVICE_HAN_FUN_CONTACT);
|
||||
public static final ThingTypeUID HAN_FUN_SWITCH_THING_TYPE = new ThingTypeUID(BINDING_ID, DEVICE_HAN_FUN_SWITCH);
|
||||
@ -176,14 +176,14 @@ public class AVMFritzBindingConstants {
|
||||
COMETDECT_THING_TYPE);
|
||||
|
||||
public static final Set<ThingTypeUID> SUPPORTED_DEVICE_THING_TYPES_UIDS = Set.of(DECT100_THING_TYPE,
|
||||
DECT200_THING_TYPE, DECT210_THING_TYPE, PL546E_THING_TYPE, HAN_FUN_CONTACT_THING_TYPE,
|
||||
DECT200_THING_TYPE, DECT210_THING_TYPE, POWERLINE546E_THING_TYPE, HAN_FUN_CONTACT_THING_TYPE,
|
||||
HAN_FUN_ON_OFF_THING_TYPE, HAN_FUN_BLINDS_THING_TYPE);
|
||||
|
||||
public static final Set<ThingTypeUID> SUPPORTED_GROUP_THING_TYPES_UIDS = Set.of(GROUP_HEATING_THING_TYPE,
|
||||
GROUP_SWITCH_THING_TYPE);
|
||||
|
||||
public static final Set<ThingTypeUID> SUPPORTED_BRIDGE_THING_TYPES_UIDS = Set.of(BRIDGE_THING_TYPE,
|
||||
PL546E_STANDALONE_THING_TYPE);
|
||||
POWERLINE546E_STANDALONE_THING_TYPE);
|
||||
|
||||
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Stream.of(SUPPORTED_LIGHTING_THING_TYPES,
|
||||
SUPPORTED_BUTTON_THING_TYPES_UIDS, SUPPORTED_HEATING_THING_TYPES, SUPPORTED_DEVICE_THING_TYPES_UIDS,
|
||||
|
@ -75,7 +75,7 @@ public class AVMFritzHandlerFactory extends BaseThingHandlerFactory {
|
||||
ThingTypeUID thingTypeUID = thing.getThingTypeUID();
|
||||
if (BRIDGE_THING_TYPE.equals(thingTypeUID)) {
|
||||
return new BoxHandler((Bridge) thing, httpClient, commandDescriptionProvider);
|
||||
} else if (PL546E_STANDALONE_THING_TYPE.equals(thingTypeUID)) {
|
||||
} else if (POWERLINE546E_STANDALONE_THING_TYPE.equals(thingTypeUID)) {
|
||||
return new Powerline546EHandler((Bridge) thing, httpClient, commandDescriptionProvider);
|
||||
} else if (SUPPORTED_LIGHTING_THING_TYPES.contains(thingTypeUID)) {
|
||||
return new AVMFritzColorLightDeviceHandler(thing);
|
||||
|
@ -109,9 +109,9 @@ public class AVMFritzUpnpDiscoveryParticipant implements UpnpDiscoveryParticipan
|
||||
if (modelName.startsWith(BOX_MODEL_NAME)) {
|
||||
logger.debug("discovered on {}", device.getIdentity().getDiscoveredOnLocalAddress());
|
||||
return new ThingUID(BRIDGE_THING_TYPE, id);
|
||||
} else if (modelName.startsWith(POWERLINE_MODEL_NAME)) {
|
||||
} else if (POWERLINE546E_MODEL_NAME.equals(modelName)) {
|
||||
logger.debug("discovered on {}", device.getIdentity().getDiscoveredOnLocalAddress());
|
||||
return new ThingUID(PL546E_STANDALONE_THING_TYPE, id);
|
||||
return new ThingUID(POWERLINE546E_STANDALONE_THING_TYPE, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -225,7 +225,7 @@ public class Powerline546EHandler extends AVMFritzBaseBridgeHandler implements F
|
||||
ThingTypeUID thingTypeUID = new ThingTypeUID(BINDING_ID, getThingTypeId(device).concat("_Solo"));
|
||||
String ipAddress = getConfigAs(AVMFritzBoxConfiguration.class).ipAddress;
|
||||
|
||||
if (PL546E_STANDALONE_THING_TYPE.equals(thingTypeUID)) {
|
||||
if (POWERLINE546E_STANDALONE_THING_TYPE.equals(thingTypeUID)) {
|
||||
String thingName = "fritz.powerline".equals(ipAddress) ? ipAddress
|
||||
: ipAddress.replaceAll(INVALID_PATTERN, "_");
|
||||
return new ThingUID(thingTypeUID, thingName);
|
||||
|
@ -98,7 +98,7 @@ public class AVMFritzDiscoveryServiceOSGiTest extends AVMFritzThingHandlerOSGiTe
|
||||
assertTrue(discovery.getSupportedThingTypes().contains(DECT400_THING_TYPE));
|
||||
assertTrue(discovery.getSupportedThingTypes().contains(DECT440_THING_TYPE));
|
||||
assertTrue(discovery.getSupportedThingTypes().contains(DECT500_THING_TYPE));
|
||||
assertTrue(discovery.getSupportedThingTypes().contains(PL546E_THING_TYPE));
|
||||
assertTrue(discovery.getSupportedThingTypes().contains(POWERLINE546E_THING_TYPE));
|
||||
assertTrue(discovery.getSupportedThingTypes().contains(COMETDECT_THING_TYPE));
|
||||
assertTrue(discovery.getSupportedThingTypes().contains(HAN_FUN_CONTACT_THING_TYPE));
|
||||
assertTrue(discovery.getSupportedThingTypes().contains(HAN_FUN_SWITCH_THING_TYPE));
|
||||
@ -508,7 +508,7 @@ public class AVMFritzDiscoveryServiceOSGiTest extends AVMFritzThingHandlerOSGiTe
|
||||
|
||||
assertEquals(DiscoveryResultFlag.NEW, discoveryResult.getFlag());
|
||||
assertEquals(new ThingUID("avmfritz:FRITZ_Powerline_546E:1:5C_49_79_F0_A3_84"), discoveryResult.getThingUID());
|
||||
assertEquals(PL546E_THING_TYPE, discoveryResult.getThingTypeUID());
|
||||
assertEquals(POWERLINE546E_THING_TYPE, discoveryResult.getThingTypeUID());
|
||||
assertEquals(BRIGE_THING_ID, discoveryResult.getBridgeUID());
|
||||
assertEquals("5C:49:79:F0:A3:84", discoveryResult.getProperties().get(CONFIG_AIN));
|
||||
assertEquals("AVM", discoveryResult.getProperties().get(PROPERTY_VENDOR));
|
||||
|
Loading…
Reference in New Issue
Block a user