Full dimmer channel

Hello community!

By definition the DimmerItem accepts the following data types and commands:


How is it possible to define a dimmer channel that supports all these commands ??? The channel that I have defined so far, only supports PercentType

Thanks for the help!!


Are you writing a binding?

Hi @rossko57,
Yes, we are currently creating an openHAB binding. We have a Dimmer device, and we want to create a channel that supports all types of commands

You can just check for the type of the incoming command, and handle it as appropriate. Here is a simplified example:

    public void handleCommand(ChannelUID channelUID, Command command) {
        if (channelUID.getId().equals(CHANNEL_LIGHTLEVEL)) {
            if (command instanceof Number) {
                int level = ((Number) command).intValue();
                // Send the percent level to your dimmer
            } else if (command.equals(OnOffType.ON)) {
                // Send on command to your dimmer
            } else if (command.equals(OnOffType.OFF)) {
                // Send off command to your dimmer

For a full example check out the DimmerHandler class in the Lutron binding:

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.