[km200] Cleanup semantic tags (#12573)

Related to #12262

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
This commit is contained in:
lolodomo 2022-04-04 23:45:55 +02:00 committed by GitHub
parent 36fcdb9dd4
commit da9c34b13c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,7 +21,6 @@ import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -108,23 +107,6 @@ public class KM200ThingHandler extends BaseThingHandler {
}
}
/**
* Choose a tag for a channel
*/
Set<String> checkTags(String unitOfMeasure, @Nullable Boolean readOnly) {
Set<String> tags = new HashSet<>();
if (unitOfMeasure.indexOf("°C") == 0 || unitOfMeasure.indexOf("K") == 0) {
if (null != readOnly) {
if (readOnly) {
tags.add("CurrentTemperature");
} else {
tags.add("TargetTemperature");
}
}
}
return tags;
}
/**
* Choose a category for a channel
*/
@ -188,7 +170,6 @@ public class KM200ThingHandler extends BaseThingHandler {
channelType = ChannelTypeBuilder.state(channelTypeUID, label, itemType) //
.withDescription(description) //
.withCategory(checkCategory(unitOfMeasure, category, state.isReadOnly())) //
.withTags(checkTags(unitOfMeasure, state.isReadOnly())) //
.withStateDescriptionFragment(state) //
.withConfigDescriptionURI(configDescriptionUriChannel).build();
} catch (URISyntaxException ex) {
@ -196,8 +177,7 @@ public class KM200ThingHandler extends BaseThingHandler {
CONFIG_DESCRIPTION_URI_CHANNEL);
channelType = ChannelTypeBuilder.state(channelTypeUID, label, itemType) //
.withDescription(description) //
.withCategory(checkCategory(unitOfMeasure, category, state.isReadOnly())) //
.withTags(checkTags(unitOfMeasure, state.isReadOnly())).build();
.withCategory(checkCategory(unitOfMeasure, category, state.isReadOnly())).build();
}
channelTypeProvider.addChannelType(channelType);