package org.openhab.binding.webthing.internal.link;
import java.util.Locale;
+import java.util.Set;
import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.webthing.internal.client.dto.Property;
import org.openhab.core.library.CoreItemFactory;
*/
public static ItemType toItemType(Property propertyMetadata) {
String type = CoreItemFactory.STRING;
- @Nullable
- String tag = null;
+ Set<String> tags = Set.of();
switch (propertyMetadata.typeKeyword) {
case "AlarmProperty":
case "OnOffProperty":
case "PushedProperty":
type = CoreItemFactory.SWITCH;
- tag = "Switchable";
break;
case "CurrentProperty":
case "FrequencyProperty":
type = CoreItemFactory.STRING;
break;
case "BrightnessProperty":
+ type = CoreItemFactory.DIMMER;
+ tags = Set.of("Control", "Light");
+ break;
case "HumidityProperty":
type = CoreItemFactory.DIMMER;
+ tags = Set.of("Measurement", "Humidity");
break;
case "ColorModeProperty":
type = CoreItemFactory.STRING;
- tag = "lighting";
break;
case "ColorProperty":
type = CoreItemFactory.COLOR;
- tag = "Lighting";
+ tags = Set.of("Control", "Light");
break;
case "ColorTemperatureProperty":
type = CoreItemFactory.DIMMER;
- tag = "Lighting";
+ tags = Set.of("Control", "ColorTemperature");
break;
case "OpenProperty":
type = CoreItemFactory.CONTACT;
- tag = "ContactSensor";
+ tags = Set.of("OpenState");
break;
case "TargetTemperatureProperty":
type = CoreItemFactory.NUMBER;
- tag = "TargetTemperature";
+ tags = Set.of("Setpoint", "Temperature");
break;
case "TemperatureProperty":
type = CoreItemFactory.NUMBER;
- tag = "CurrentTemperature";
+ tags = Set.of("Measurement", "Temperature");
break;
case "ThermostatModeProperty":
break;
switch (propertyMetadata.type.toLowerCase(Locale.ENGLISH)) {
case "boolean":
type = CoreItemFactory.SWITCH;
- tag = "Switchable";
break;
case "integer":
case "number":
break;
}
- return new ItemType(type, tag);
+ return new ItemType(type, tags);
}
/**
*/
public static class ItemType {
private final String type;
- private final @Nullable String tag;
+ private final Set<String> tags;
- ItemType(String type, @Nullable String tag) {
+ ItemType(String type, Set<String> tags) {
this.type = type;
- this.tag = tag;
+ this.tags = tags;
}
public String getType() {
return type;
}
- public @Nullable String getTag() {
- return tag;
+ public Set<String> getTags() {
+ return tags;
}
}
}