Curtains automation by illuminance

I’m having some troubles with writing rules for curtains automation. I have an outdoor sensors and an item showing me the level of illuminance.

I want curtains to close everytime the illuminance is under 10 lx.

Here’s my code:

if ((OutLum.state < 10) {
  if (Curt_N.state == 0) {
    Curt_Open.sendCommand(OFF)
    Curt_Close.sendCommand(ON)
  }
}

I believe the issue is with comparison of luminocity, but I’ve tried a lot of diffrent options. such as “(gOutLum.state as QuantityType).toBigDecimal > 20)” for example and it didn’t work.

I’m not good at coding at all and that is my very first project, I couldn’t have fined enything like that on the forum, so I hope someone faced such problem ir at least know how to solve it.

Could you share more details on your items etc.?

I do something similar, turning on lights (indoor) based on lux and my rule just checks for lux >= value, example (ECMA):

var lux = itemRegistry.getItem("livingroom_motionsensor_2_illuminance").getState ();

if (lux <= 95) {...

See for example -