Fix StateDescription deprecations (#9352)

Related to #1408

Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
Wouter Born
2020-12-13 08:53:16 +01:00
committed by GitHub
parent 863606e311
commit 8f53e320dc
12 changed files with 59 additions and 51 deletions

View File

@@ -83,16 +83,14 @@ public class SmartMeterChannelTypeProvider implements ChannelTypeProvider, Meter
stateDescriptionBuilder = ChannelTypeBuilder
.state(new ChannelTypeUID(SmartMeterBindingConstants.BINDING_ID, obisChannelId), obis,
CoreItemFactory.NUMBER + ":" + dimension)
.withStateDescription(StateDescriptionFragmentBuilder.create().withReadOnly(true)
.withPattern("%.2f %unit%").build().toStateDescription())
.withStateDescriptionFragment(StateDescriptionFragmentBuilder.create().withReadOnly(true)
.withPattern("%.2f %unit%").build())
.withConfigDescriptionURI(URI.create(SmartMeterBindingConstants.CHANNEL_TYPE_METERREADER_OBIS));
} else {
stateDescriptionBuilder = ChannelTypeBuilder
.state(new ChannelTypeUID(SmartMeterBindingConstants.BINDING_ID, obisChannelId), obis,
CoreItemFactory.STRING)
.withStateDescription(
StateDescriptionFragmentBuilder.create().withReadOnly(true).build().toStateDescription());
.withStateDescriptionFragment(StateDescriptionFragmentBuilder.create().withReadOnly(true).build());
}
return stateDescriptionBuilder.build();
}