Test on Roller Shutter state is not working using UP and DOWN

In items I have

Rollershutter Rolladen 

a test rule

sendCommand(Rolladen, DOWN)
if (Rolladen.state == DOWN) logInfo("Rolladen","Down is ok") else logInfo("Rolladen","Not Down")

the log file shows

04:25:15.536 [INFO ] [ipse.smarthome.model.script.Rolladen] - Not Down

It seems that with Rolladen one cannot test the state but has to use a numerical value in case of DOWN 100 so the rule is working when writing

if (Rolladen.state == 100) logInfo("Rolladen","Down is ok") else logInfo("Rolladen","Not Down")

It seems that the parameter DOWN and UP is not processed correctly in if statements

Hello Martin,

is your rollershutter moving when your rule is executed?
If not, try

Rolladen.sendCommand(DOWN)

in your rule.

Maybe the problem is, that the rollershutter item is holding the shutter position as numerical value (closed percentage) as state and is using UP and DOWN just for commands…

Couldn’t find the answer within the openhab documentation but the answer could be find within the source code…

Andreas

No this is not the reason because in the test I am using a virtual roller shutter.

Rollershutter Items have a percentage state, that is to say they can take a value 0 to 100

[quote=“Marty56, post:1, topic:24565”]
sendCommand(Rolladen, DOWN)
if (Rolladen.state == …[/quote]
In general, that won’t work well. The state will not instantly change in response to a command.

True.
But even if you add Tread::sleep(delay) and delay is a couple of seconds, it does not work.

which “it” doesn’t work? As you have discovered, a Rollershutter state is a numeric percentage.

It is much the same as a Dimmer Item

As you can see from my workaround I am aware that the rullershutter.state is a numerical item.
But it would be required to translate “DOWN” in the related numerical value in the if statement.

This would help to have consistency.

DOWN is a command.
It would be valid for example to have a Rollershutter at 25% and command it DOWN.
Shortly, it begins moving down, should state DOWN be true?
After a while it would be at 35%, that is more down that it was, would state DOWN be true?
Or at 75%, is that DOWN? You might not think so, but someone else might.

In a rules file, you can define named constants to do what you want

val Number RollerDOWN = 100

rule "blah"
       ....
if (Rolladen.state == RollerDOWN)  { ...

best to avoid using same name though.

1 Like

Thanks for your support.
I am already using your proposed workaround but honestly I do not like it.
But maybe we have already discussed enough about this minor issue.