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

@@ -41,7 +41,7 @@ import org.openhab.core.thing.type.ChannelTypeBuilder;
import org.openhab.core.thing.type.ChannelTypeUID;
import org.openhab.core.types.Command;
import org.openhab.core.types.RefreshType;
import org.openhab.core.types.StateDescription;
import org.openhab.core.types.StateDescriptionFragmentBuilder;
import org.openhab.core.types.StateOption;
import org.openhab.core.types.UnDefType;
import org.slf4j.Logger;
@@ -187,7 +187,8 @@ public class HarmonyDeviceHandler extends BaseThingHandler {
ChannelType channelType = ChannelTypeBuilder.state(channelTypeUID, "Send Button Press", "String")
.withDescription("Send a button press to device " + getThing().getLabel())
.withStateDescription(new StateDescription(null, null, null, null, false, states)).build();
.withStateDescriptionFragment(StateDescriptionFragmentBuilder.create().withOptions(states).build())
.build();
factory.addChannelType(channelType);

View File

@@ -50,7 +50,7 @@ import org.openhab.core.thing.type.ChannelTypeBuilder;
import org.openhab.core.thing.type.ChannelTypeUID;
import org.openhab.core.types.Command;
import org.openhab.core.types.RefreshType;
import org.openhab.core.types.StateDescription;
import org.openhab.core.types.StateDescriptionFragmentBuilder;
import org.openhab.core.types.StateOption;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -382,7 +382,9 @@ public class HarmonyHubHandler extends BaseBridgeHandler implements HarmonyClien
ChannelType channelType = ChannelTypeBuilder.state(channelTypeUID, "Current Activity", "String")
.withDescription("Current activity for " + getThing().getLabel())
.withStateDescription(new StateDescription(null, null, null, "%s", false, states)).build();
.withStateDescriptionFragment(StateDescriptionFragmentBuilder.create().withPattern("%s")
.withReadOnly(false).withOptions(states).build())
.build();
factory.addChannelType(channelType);