Fix StateDescription deprecations (#9352)
Related to #1408 Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user