Roller shuter stop by press again button and continue both directions

  • Platform information:
    • Hardware: AsusTinker
    • OS: Debian 9
    • Java Runtime Environment: 1.8.0_201
    • openHAB version: 2.5.2 (Build)

Hello,

I’m using roller shutters with shelly 2.5 (shelly binding), and I would like to use my RFBrdige for UP/Close by receiving commands from RF remote.

I have Button “UP” and button “DOWN”, and if UP/DOWN will be pressed again, the shutter should stop. After stop, I would like to press up/down again with remote, but only the other direction is working.

Example (state at begin is closed):
1.) Pressing UP
2.) Pressing UP again (roller shutter will stop)
3.) pressing UP again, nothing happens, but shutter is by 50% (physically).
4.) Pressing DOWN working, pressing again DOWN (roller shutter will stop).
5.) Pressing DOWN again, nothing happens, but shutter is by 75% (physically)

My Code:

 // Shutter

if(RFBridge.state == “07B622” || RFBridge.state == “524FFE”) {
logInfo(“RFBridge”,“Button UP pressed”)
if(Rolladen_Fenster_1.state.toString == “0”) {
logInfo(“Rolladen_Fenster_1”,“STOP”)
Rolladen_Fenster_1.sendCommand(STOP)
Rolladen_Fenster_1.setState(null)
} else {
Rolladen_Fenster_1.sendCommand(UP)
}
logInfo(“Rolladen_Fenster_1”,Rolladen_Fenster_1.state.toString)
}
if(RFBridge.state == “07B624” || RFBridge.state == “524FFC”) {
logInfo(“RFBridge”,“Button DOWN pressed”)
if(Rolladen_Fenster_1.state.toString == “100”) {
logInfo(“Rolladen_Fenster_1”,“STOP”)
Rolladen_Fenster_1.sendCommand(STOP)
Rolladen_Fenster_1.setState(null)
} else {
Rolladen_Fenster_1.sendCommand(DOWN)
}
logInfo(“Rolladen_Fenster_1”,Rolladen_Fenster_1.state.toString )
}

According to https://www.openhab.org/addons/bindings/shelly/ there should be “lastDirection”, how I can access this variable in my rules?,

It’s not a variable, it’s a channel.
You would link the channel to an Item, and use the Item .state in rules.

I think what you really need to know is if the roller is moving though, so you know whether to stop or move when a new command arrives.
Channel “positioning” perhaps.

OK thank you, I will try.

How I can get the information over positioning, if the roller shutter is currently moving?

I have no idea.

The doc that you referred to says that “positioning” is a switch type channel, with the meaning “ON: Roller is positioning/moving”.
Seems clear enough -the roller is moving, or the roller is not moving.

Is it rollerpos channel that you want now? See the doc that you referred to, that suggests that doesn’t get updated unitil it stops moving.

I dont have the channel “positioning”, and the thing-type is shelly25-roller
Any idea?

Likely depends on binding version.

Also, if a binding version introduces new features after you have created a Thing, you would need to delete and rediscover the Thing to get the new features.

Maybe it’s down to device firmware.

After update to 2.5.3 and checked, if latest shelly binding is installed, the positioning channel does not exists. I asked in the shelly binding thread, this channel is not existing (yet).

But I solved it by asking the current power, if power > 0, then stop the roller shutter.
My updated code:

    // Shutter
	if(RFBridge.state == "07B622" || RFBridge.state == "524FFE") {
		logInfo("RFBridge","Button UP pressed")
		val power = Rolladen_Fenster_1_Watt.state as Number
		
		if(power > 0) {
			Rolladen_Fenster_1.sendCommand(STOP)
			logInfo("Rolladen_Fenster_1","STOP!");
		} else {
			Rolladen_Fenster_1.sendCommand(UP)
		}
		logInfo("Rolladen_Fenster_1",Rolladen_Fenster_1_Watt.state.toString)
	}
	if(RFBridge.state == "07B624" || RFBridge.state == "524FFC") {
		logInfo("RFBridge","Button DOWN pressed")
		val power = Rolladen_Fenster_1_Watt.state as Number
		if(power > 0) {
			Rolladen_Fenster_1.sendCommand(STOP)
			logInfo("Rolladen_Fenster_1","STOP!");
		} else {
			Rolladen_Fenster_1.sendCommand(DOWN)
		}
		logInfo("Rolladen_Fenster_1",Rolladen_Fenster_1_Watt.state.toString)
	}
1 Like

Good workaround :smiley:

It’s always a nuisance when docs are ahead of current version, it’s a problem with the way the docs system works with “latest”