import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
+import java.util.Comparator;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
for (String value : state.jsonResponse.effects) {
fxOptions.add(new StateOption(Integer.toString(counter++), value));
}
+ if (handler.config.sortEffects) {
+ fxOptions.sort(Comparator.comparing(o -> o.getValue().equals("0") ? "" : o.getLabel()));
+ }
handler.stateDescriptionProvider.setStateOptions(new ChannelUID(handler.getThing().getUID(), CHANNEL_FX),
fxOptions);
}
for (String value : state.jsonResponse.palettes) {
palleteOptions.add(new StateOption(Integer.toString(counter++), value));
}
+ if (handler.config.sortPalettes) {
+ palleteOptions.sort(Comparator.comparing(o -> o.getValue().equals("0") ? "" : o.getLabel()));
+ }
handler.stateDescriptionProvider.setStateOptions(new ChannelUID(handler.getThing().getUID(), CHANNEL_PALETTES),
palleteOptions);
}
</description>
<default>0</default>
</parameter>
+ <parameter name="sortEffects" type="boolean">
+ <label>Sort Effects</label>
+ <description>If set, will sort the state options of the effects channel alphabetically while keeping the first
+ option (Solid) at the top.</description>
+ <default>false</default>
+ </parameter>
+ <parameter name="sortPalettes" type="boolean">
+ <label>Sort Palettes</label>
+ <description>If set, will sort the state options of the palettes channel alphabetically while keeping the first
+ option (Default) at the top.</description>
+ <default>false</default>
+ </parameter>
</config-description>
</thing-type>