mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-27 07:41:39 +01:00
[km200] Cleanup semantic tags (#12573)
Related to #12262 Signed-off-by: Laurent Garnier <lg.hc@free.fr>
This commit is contained in:
parent
36fcdb9dd4
commit
da9c34b13c
@ -21,7 +21,6 @@ import java.net.URISyntaxException;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
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
|
* Choose a category for a channel
|
||||||
*/
|
*/
|
||||||
@ -188,7 +170,6 @@ public class KM200ThingHandler extends BaseThingHandler {
|
|||||||
channelType = ChannelTypeBuilder.state(channelTypeUID, label, itemType) //
|
channelType = ChannelTypeBuilder.state(channelTypeUID, label, itemType) //
|
||||||
.withDescription(description) //
|
.withDescription(description) //
|
||||||
.withCategory(checkCategory(unitOfMeasure, category, state.isReadOnly())) //
|
.withCategory(checkCategory(unitOfMeasure, category, state.isReadOnly())) //
|
||||||
.withTags(checkTags(unitOfMeasure, state.isReadOnly())) //
|
|
||||||
.withStateDescriptionFragment(state) //
|
.withStateDescriptionFragment(state) //
|
||||||
.withConfigDescriptionURI(configDescriptionUriChannel).build();
|
.withConfigDescriptionURI(configDescriptionUriChannel).build();
|
||||||
} catch (URISyntaxException ex) {
|
} catch (URISyntaxException ex) {
|
||||||
@ -196,8 +177,7 @@ public class KM200ThingHandler extends BaseThingHandler {
|
|||||||
CONFIG_DESCRIPTION_URI_CHANNEL);
|
CONFIG_DESCRIPTION_URI_CHANNEL);
|
||||||
channelType = ChannelTypeBuilder.state(channelTypeUID, label, itemType) //
|
channelType = ChannelTypeBuilder.state(channelTypeUID, label, itemType) //
|
||||||
.withDescription(description) //
|
.withDescription(description) //
|
||||||
.withCategory(checkCategory(unitOfMeasure, category, state.isReadOnly())) //
|
.withCategory(checkCategory(unitOfMeasure, category, state.isReadOnly())).build();
|
||||||
.withTags(checkTags(unitOfMeasure, state.isReadOnly())).build();
|
|
||||||
}
|
}
|
||||||
channelTypeProvider.addChannelType(channelType);
|
channelTypeProvider.addChannelType(channelType);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user