Validate UI command

I would like to use a rule (or any other method) to setup a “Safety” check for someone hitting the wrong button on the UI. I have some motorized blinds that I built and due to how it is physically installed, I have a limit switch on the closing of the blinds but not the open. Therefore the hardware on the blinds could try and keeping opening the blinds even when they are open and ruin the motor or belt. What I would like to do is to have openhab check the position of the blinds and if they are already open don’t allow the open command to be sent otherwise pass the command through.

I have tried this will a rule using received command and sendcommand but that seemed to put me in an infinite loop. I have also tried setting receivedCommand equal to the value but that gives me erros in the logs.

Basically I would like to do something like this:

// Check if ok to open / close blinds
rule "Bedroom Blinds Check"
		Item BedroomBlinds changed
		if (receivedCommand == DOWN) {
			// If command to close and they are open, pass through command
			if ((BedroomBlinds.state as DecimalType) == 0) {
				sendCommand(BedroomBlinds, DOWN)
			// Otherwise, post and error
			else {
				postUpdate(BedroomBlindsError, "Not at beginning")
		else if (receivedCommand == UP) {
			// If command to open and they are open always pass command because of limit switch
			sendCommand(BedroomBlinds, UP)
               else {
			// Always pass STOP commands
                       sendCommand(BedroomBlinds, STOP)

I guess one method would be to use a proxy item that receives the UI command and then passes the actuall command to the blinds, but wondering if I am missing something trivial here.


As the widgets at the UI will always trigger a sendCommand, you have to use a proxy item.

It is hard to tell without seeing the definition of your BedroomBlinds-item, but I assume this item is connected to a binding that communicates directly to whatever type of “blinds controller” you have installed.

If this is the case, I think you best (and only?) option is to introduce a proxy-item (take a look here for an example)

The reason that what you have shown above is not working, is that at the time your current rule triggers on the command, the same command is most likely already being processed by the binding, meaning it is really too late to stop it - unless, of course, you have some kind of “cancel” or “stop” command that you can send.

Thanks to you both. I will use a proxy item. For reference, I am using an MQTT binding to an ESP8266 that I used for the controller in my custom blinds.