Rollershutter.state gives error

I’m sort of a beginner with programming but getting better every day. Still some things confuse me so much!

i have a rollershutter item:

Rollershutter BedroomCurtainMotorControl <blinds> { channel="mihome:curtain:abcxxxxx:curtainControl" }

the item works perfectly when sending commands like UP or DOWN.

I want to get its current state, 0% or 100% etc to perform certain actions in my rules.
But using something as simple as

if (BedroomCurtainMotorControl.state < 30) {   do something  }

or even just a logInfo

logInfo("INFO", BedroomCurtainMotorControl.state)

gives me a javascript error:

[ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Mijia & Aqara round Wireless Switch': An error occurred 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

all examples i see here on the forum on rollershutter rules use this rollershutter.state in their rules…
I’m probably missing some very basic thing here.
i can convert the state to string and get for example “0” or “100” but that cant be the way to use it, right?

in Paper UI the shutter’s state is displayed as expected: “position” 0% etc

This give an error. logInfo needs a string. So try this: logInfo("INFO", BedroomCurtainMotorControl.state.toString)

If it then give again a null error, then there is probably no feedback.

and how do i need to format

if (BedroomCurtainMotorControl.state < 30) {   do something  }

to work? it’s probably because its a percenttype? how do i convert it to a usable value?

strange thing is that on any other example i see here, the state value is not converted into anything else when used in if statements

As Number is usually good
(myItem.state as Number)

awesome, thanks. learning everyday