[km200] Fix item type for dynamic channel type (#12732)
* [km200] Fix item type for dynamic channel type Related to #12712 Signed-off-by: Laurent Garnier <lg.hc@free.fr>
This commit is contained in:
parent
6c2363d524
commit
bab8e98796
@ -153,13 +153,10 @@ public class KM200ThingHandler extends BaseThingHandler {
|
|||||||
Channel newChannel = null;
|
Channel newChannel = null;
|
||||||
ChannelType channelType = null;
|
ChannelType channelType = null;
|
||||||
Map<String, String> chProperties = new HashMap<>();
|
Map<String, String> chProperties = new HashMap<>();
|
||||||
String itemType = "";
|
|
||||||
String category = null;
|
String category = null;
|
||||||
if (CoreItemFactory.NUMBER.equals(type)) {
|
if (CoreItemFactory.NUMBER.equals(type)) {
|
||||||
itemType = "NumberType";
|
|
||||||
category = "Number";
|
category = "Number";
|
||||||
} else if (CoreItemFactory.STRING.equals(type)) {
|
} else if (CoreItemFactory.STRING.equals(type)) {
|
||||||
itemType = "StringType";
|
|
||||||
category = "Text";
|
category = "Text";
|
||||||
} else {
|
} else {
|
||||||
logger.info("Channeltype {} not supported", type);
|
logger.info("Channeltype {} not supported", type);
|
||||||
@ -167,7 +164,7 @@ public class KM200ThingHandler extends BaseThingHandler {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
configDescriptionUriChannel = new URI(CONFIG_DESCRIPTION_URI_CHANNEL);
|
configDescriptionUriChannel = new URI(CONFIG_DESCRIPTION_URI_CHANNEL);
|
||||||
channelType = ChannelTypeBuilder.state(channelTypeUID, label, itemType) //
|
channelType = ChannelTypeBuilder.state(channelTypeUID, label, type) //
|
||||||
.withDescription(description) //
|
.withDescription(description) //
|
||||||
.withCategory(checkCategory(unitOfMeasure, category, state.isReadOnly())) //
|
.withCategory(checkCategory(unitOfMeasure, category, state.isReadOnly())) //
|
||||||
.withStateDescriptionFragment(state) //
|
.withStateDescriptionFragment(state) //
|
||||||
@ -175,7 +172,7 @@ public class KM200ThingHandler extends BaseThingHandler {
|
|||||||
} catch (URISyntaxException ex) {
|
} catch (URISyntaxException ex) {
|
||||||
logger.warn("Can't create ConfigDescription URI '{}', ConfigDescription for channels not avilable!",
|
logger.warn("Can't create ConfigDescription URI '{}', ConfigDescription for channels not avilable!",
|
||||||
CONFIG_DESCRIPTION_URI_CHANNEL);
|
CONFIG_DESCRIPTION_URI_CHANNEL);
|
||||||
channelType = ChannelTypeBuilder.state(channelTypeUID, label, itemType) //
|
channelType = ChannelTypeBuilder.state(channelTypeUID, label, type) //
|
||||||
.withDescription(description) //
|
.withDescription(description) //
|
||||||
.withCategory(checkCategory(unitOfMeasure, category, state.isReadOnly())).build();
|
.withCategory(checkCategory(unitOfMeasure, category, state.isReadOnly())).build();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user