Rollershutter item, get the item command state in a rule

a rollershutter item is a for me a “hybird” item. It can be a command or it can be the position.
See here:

Now when I want to know the state of the item, it always gives me the position back like “0” or “100”.


Is there a way to get the command state like “DOWN”, “UP” or “STOP” of a rollershutter item in a rule (blockly)?

Thanky you. BR

No, the state of the item is always 0-100.
Open, stop , close are commands. Commands are different to states.

If you send a command like open or close, than OH will update the item state accordingly.

What you can do is add some mapping, so that 0 is displayed as close and 100 displayed as open (or vice versa)

To be clear, there is no such thing like a “command state”.
An Item can receive a command and it can store a state.
If you are using an Item via the UI, every change will result in a command, sent to the Item.
If using the Item in a rule, you can chose between .sendCommand(<command>) (which will result in a received command for the Item) and .postUpdate(<state>) (which will result in a received update for the Item). The Item won’t keep the command in any way.

But of course you can trigger the rule with the received command trigger and then use the implicit variable receivedCommand which will contain the received command :slight_smile:
If using more than one trigger, the triggeringItemName implicit variable will contain the name of the Item which triggered the rule (as a string).

I’m not sure about how to access those implicit variables in blockly, but for sure there is a way to do so, see

UPDATE: It’s the block openHAB->Run & Process->contextual info->received command (this is a drop down element)

Thanks all.
This is something I was looking for.

Yes, unfortunately this part is missing in the Blockly documentation…