Get current position of Rollershutter

I’m trying to do some automatic positionning with my rollershutters. This is an example script to make it dark (I have two shutters, each a different direction, therefore I have to turn one of them over at the end to have it closed for the sun):

rule "sonnenschutz"
    when
		Item SONNENSCHUTZ received command ON
	then
	    logInfo("test", JALOUSIE_LINKS.state)
        sendCommand(JALOUSIE_LINKS, "DOWN")
        sendCommand(JALOUSIE_RECHTS, "DOWN")
        Thread::sleep(80000)
        sendCommand(JALOUSIE_LINKS, "UP")
        Thread::sleep(2000)
        sendCommand(JALOUSIE_LINKS, "STOP")
	end

Currently I’m just waiting the maximum possible time to close completely (80 seconds) and then turn the one over. I would like to obtain to current position at the start and then only wait for the necessary amount of time to finish the procedure as quickly as possible.

Unfortunately (I already introduced the logInfo statement in my rule) I’m always getting NULL when trying to acquire the current state:

2017-07-14 22:46:57.494 [ERROR] [.script.engine.ScriptExecutionThread] - Rule 'sonnenschutz': An error occured during the script execution: Could not invoke method: org.eclipse.smarthome.model.script.actions.LogAction.logInfo(java.lang.String,java.lang.String,java.lang.Object[]) on instance: null

Any idea why this could happen?

I’m currently running on OpenHAB 2.0 and the rollershutters are Homematic shutters - reporting their current state. If necessary here my items configuration:

Rollershutter JALOUSIE_LINKS "Jalousie Links [%d %%]" {channel="homematic:HM-LC-Bl1PBU-FM:ccu:NEQ0056156:1#LEVEL"}
Rollershutter JALOUSIE_RECHTS "Jalousie Rechts [%d %%]" {channel="homematic:HM-LC-Bl1PBU-FM:ccu:NEQ0055733:1#LEVEL"}

Can you try:

	    logInfo("test", JALOUSIE_LINKS.state.toString)

also: how is the state reported for the JALOUSIE_LINKS item from the openHAB console (ssh openhab@localhost -p 8101 with password habopen)

items list |grep -i JALOUSIE

or from the REST API: http://<OH2_IP>:8080/rest/items/JALOUSIE_LINKS/state

Additional recommendation: use item.sendCommand(command) instead of sendCommand(item, "command")

rule "sonnenschutz"
    when
		Item SONNENSCHUTZ received command ON
	then
	    logInfo("test", JALOUSIE_LINKS.state.toString)
        JALOUSIE_LINKS.sendCommand(DOWN)
        JALOUSIE_RECHTS.sendCommand(DOWN)
        Thread::sleep(80000)
        JALOUSIE_LINKS.sendCommand(UP)
        Thread::sleep(2000)
        JALOUSIE_LINKS.sendCommand(STOP)
	end

These Homematic rollershutters don’t support percent values? JALOUSIE_LINKS.sendCommand(80)