[matter] Remove pattern from state options (#19644)

Removes the "withPattern" option from dynamic state builders where it was not intended to be used for numeric values that map to String labels.

Signed-off-by: Dan Cunningham <dan@digitaldan.com>
This commit is contained in:
Dan Cunningham
2025-11-10 22:11:37 +01:00
committed by GitHub
parent ffabe64982
commit ab43d12e44
6 changed files with 12 additions and 12 deletions
@@ -60,8 +60,8 @@ public class AirQualityConverter extends GenericConverter<AirQualityCluster> {
options.add(new StateOption(e.getValue().toString(), e.getLabel()));
}
StateDescription stateDescription = StateDescriptionFragmentBuilder.create().withPattern("%d")
.withOptions(options).build().toStateDescription();
StateDescription stateDescription = StateDescriptionFragmentBuilder.create().withOptions(options).build()
.toStateDescription();
return Collections.singletonMap(channel, stateDescription);
}
@@ -114,8 +114,8 @@ public class FanControlConverter extends GenericConverter<FanControlCluster> {
break;
}
StateDescription stateDescriptionMode = StateDescriptionFragmentBuilder.create().withPattern("%d")
.withOptions(modeOptions).build().toStateDescription();
StateDescription stateDescriptionMode = StateDescriptionFragmentBuilder.create().withOptions(modeOptions)
.build().toStateDescription();
channels.put(modeChannel, stateDescriptionMode);
}
@@ -59,8 +59,8 @@ public class ModeSelectConverter extends GenericConverter<ModeSelectCluster> {
initializingCluster.supportedModes
.forEach(mode -> modeOptions.add(new StateOption(mode.mode.toString(), mode.label)));
StateDescription stateDescriptionMode = StateDescriptionFragmentBuilder.create().withPattern("%d")
.withOptions(modeOptions).build().toStateDescription();
StateDescription stateDescriptionMode = StateDescriptionFragmentBuilder.create().withOptions(modeOptions)
.build().toStateDescription();
return Collections.singletonMap(channel, stateDescriptionMode);
}
@@ -73,8 +73,8 @@ public class PowerSourceConverter extends GenericConverter<PowerSourceCluster> {
for (BatChargeLevelEnum mode : BatChargeLevelEnum.values()) {
options.add(new StateOption(mode.getValue().toString(), mode.getLabel()));
}
StateDescription stateDescription = StateDescriptionFragmentBuilder.create().withPattern("%d")
.withOptions(options).build().toStateDescription();
StateDescription stateDescription = StateDescriptionFragmentBuilder.create().withOptions(options)
.build().toStateDescription();
channels.put(channel, stateDescription);
}
}
@@ -90,8 +90,8 @@ public class SwitchConverter extends GenericConverter<SwitchCluster> {
options.add(new StateOption(String.valueOf(i), "Position " + i));
}
StateDescription stateDescriptionMode = StateDescriptionFragmentBuilder.create().withPattern("%d")
.withOptions(options).build().toStateDescription();
StateDescription stateDescriptionMode = StateDescriptionFragmentBuilder.create().withOptions(options).build()
.toStateDescription();
map.put(channel, stateDescriptionMode);
@@ -87,8 +87,8 @@ public class ThermostatConverter extends GenericConverter<ThermostatCluster> {
modeOptions.add(new StateOption(ThermostatCluster.SystemModeEnum.SLEEP.getValue().toString(),
ThermostatCluster.SystemModeEnum.SLEEP.getLabel()));
StateDescription stateDescriptionMode = StateDescriptionFragmentBuilder.create().withPattern("%d")
.withOptions(modeOptions).build().toStateDescription();
StateDescription stateDescriptionMode = StateDescriptionFragmentBuilder.create().withOptions(modeOptions)
.build().toStateDescription();
channels.put(channel, stateDescriptionMode);
if (!initializingCluster.featureMap.localTemperatureNotExposed) {