[SOLVED] State from Rollershutter

Hello,
probably a stupid question, inside the binding, I can’t update the STOP state
Channel type Rollershutter
I’d like not to use type String

Work

import org.eclipse.smarthome.core.library.types.UpDownType;
updateState(CHANNEL_SHUTTERSTATE, UpDownType.UP);
updateState(CHANNEL_SHUTTERSTATE, UpDownType.DOWN);

Not work

import org.eclipse.smarthome.core.library.types.StopMoveType;
updateState(CHANNEL_SHUTTERSTATE, StopMoveType.STOP);

I wanted to use a rule like this

rule "RollershutterState "
  when
    Item Tapparella_SalaUpDownStop changed
  then
    switch(Tapparella_SalaUpDownStop.state ) {
      case UP: {
		    // bla bla
      }
      case STOP: {
		    // bla bla
      }
      case DOWN: {
		    // bla bla
      }
	}
end

What should I use?

You don’t need to use the imports.

UP / DOWN / STOP are not states. (They are commands)

Thanks for the reply.
I should manage the type string channel and modify the rules.

rule "RollershutterState "
  when
    Item Tapparella_SalaUpDownStop changed
  then
    switch(Tapparella_SalaUpDownStop.state ) {
      case "UP": {
		    // bla bla
      }
      case "STOP": {
		    // bla bla
      }
      case "DOWN": {
		    // bla bla
      }
	}
end

Quite right?

This question is related to this discussion by Massimo, here

/**
 *
 * @author Kai Kreuzer - Initial contribution
 */
@NonNullByDefault
public enum UpDownType implements PrimitiveType, State, Command {
    UP,
    DOWN;
/**
 *
 * @author Kai Kreuzer - Initial contribution
 */
@NonNullByDefault
public enum StopMoveType implements PrimitiveType, Command {
    STOP,
    MOVE;

@hilbrand What do you think?
Missing a State implementation in StopMoveType (public enum StopMoveType) ?

public enum StopMoveType implements PrimitiveType, Command , State {
  • Rules are working with Items, not Channels.
  • A Rollershutter Item has a state of type Number [0 to 100]
  • A Rollershutter Item can get commands (UP,DOWN,STOP, a number [0 to 100])

You won’t need any imports to the rules file:

rule "Rollershutter "
when
    Item Tapparella_SalaUpDownStop received command // we want to react on a command, not a state!
then
    switch(receivedCommand) {
        case UP: {
		    // bla bla
        }
        case STOP: {
		    // bla bla
        }
        case DOWN: {
		    // bla bla
        }
        default : {
		    // in case a number was received as a command
        }
    }
end

Hello,
I badly explained myself.
Please read this discussion, I have to implement a second items in the binding to manage the rules

Okay. Like you said, within your binding you cannot update a channel with state STOP. Because it isn’t a valid openHAB state. That is not an error or omission.

You’ll have to do something else, a Number or String perhaps.

thank you