mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-02-04 03:14:07 +01:00
[amazonechocontrol] fix smarthome device naming (#10084)
* fix smarthome device naming * toString Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
This commit is contained in:
parent
7269cbfbf5
commit
b65e932650
@ -14,14 +14,10 @@ package org.openhab.binding.amazonechocontrol.internal.discovery;
|
|||||||
|
|
||||||
import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.*;
|
import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.*;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Hashtable;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
@ -180,7 +176,17 @@ public class SmartHomeDevicesDiscovery extends AbstractDiscoveryService {
|
|||||||
List<JsonSmartHomeDeviceAlias> aliases = shd.aliases;
|
List<JsonSmartHomeDeviceAlias> aliases = shd.aliases;
|
||||||
if ("Amazon".equals(shd.manufacturerName) && driverIdentity != null
|
if ("Amazon".equals(shd.manufacturerName) && driverIdentity != null
|
||||||
&& "SonarCloudService".equals(driverIdentity.identifier)) {
|
&& "SonarCloudService".equals(driverIdentity.identifier)) {
|
||||||
deviceName = "Alexa Guard on " + shd.friendlyName;
|
List<@Nullable String> interfaces = shd.getCapabilities().stream().map(c -> c.interfaceName)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (interfaces.contains("Alexa.AcousticEventSensor")) {
|
||||||
|
deviceName = "Alexa Guard on " + shd.friendlyName;
|
||||||
|
} else if (interfaces.contains("Alexa.ColorController")) {
|
||||||
|
deviceName = "Alexa Color Controller on " + shd.friendlyName;
|
||||||
|
} else if (interfaces.contains("Alexa.PowerController")) {
|
||||||
|
deviceName = "Alexa Plug on " + shd.friendlyName;
|
||||||
|
} else {
|
||||||
|
deviceName = "Unknown Device on " + shd.friendlyName;
|
||||||
|
}
|
||||||
} else if ("Amazon".equals(shd.manufacturerName) && driverIdentity != null
|
} else if ("Amazon".equals(shd.manufacturerName) && driverIdentity != null
|
||||||
&& "OnGuardSmartHomeBridgeService".equals(driverIdentity.identifier)) {
|
&& "OnGuardSmartHomeBridgeService".equals(driverIdentity.identifier)) {
|
||||||
deviceName = "Alexa Guard";
|
deviceName = "Alexa Guard";
|
||||||
|
@ -29,15 +29,32 @@ public class JsonSmartHomeCapabilities {
|
|||||||
public @Nullable String version;
|
public @Nullable String version;
|
||||||
public @Nullable String interfaceName;
|
public @Nullable String interfaceName;
|
||||||
public @Nullable Properties properties;
|
public @Nullable Properties properties;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "SmartHomeCapability{" + "capabilityType='" + capabilityType + '\'' + ", type='" + type + '\''
|
||||||
|
+ ", version='" + version + '\'' + ", interfaceName='" + interfaceName + '\'' + ", properties="
|
||||||
|
+ properties + '}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Properties {
|
public static class Properties {
|
||||||
public @Nullable List<Property> supported;
|
public @Nullable List<Property> supported;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Properties{" + "supported=" + supported + '}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Property {
|
public static class Property {
|
||||||
public @Nullable String name;
|
public @Nullable String name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "JsonSmartHomeCapabilities{" + "capabilites=" + capabilites + '}';
|
||||||
|
}
|
||||||
|
|
||||||
public @Nullable List<SmartHomeCapability> capabilites;
|
public @Nullable List<SmartHomeCapability> capabilites;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user