Jalousies controlled by sun elevation

I want to controll my jalousies dependent of the sun elevation

I tried it with this script:

var Number sollWinkel = new Float (Wetter_Elevation.state.toString) var Number sollState = Math::round(new Float (((sollWinkel*8)/11-5.454545454).toString)) var ItemList = Lamellen?.members.filter( x | x.state != 100 && x.name != "Lamelle_OG_Buero_Loggia") ItemList.forEach[ item | item.sendCommand(sollState) ]

But in the forEach-function are variables not allowed?!?

I don’t have a solution for this specific problem, but an alternative approach you might think about:

In the German forum I found this solution:
the astro binding provides elevation and azimuth, you could try to use those values in a rule:

I would recommend to save the var sollstate as a (proxy) item, just define the Item

Number sollstate "Beschattung [%d%%]"

and use

sollstate.postUpdate(Math::round(new Float (((sollWinkel*8)/11-5.454545454).toString)))


item.sendCommand(sollstate.state as DecimalType)

to replace the var.

It works with a proxy-Item - but not as Decimal-Type.

Instead I tried it with
item.sendCommand(new Integer (Lamelle_Soll.state.toString))
and it works!