Rules / functions / scripts: best approach

The UNDEF thing is binding related. I’m using a Bticino binding which should “map” the roller shutter timing and then manage a % based aperture (i.e. 60%) instead of using UP/DOWN/STOP commands, so (since it seems I can’t make it work properly), every time I give a command it first sets to 0 or 100 if I give UP or DOWN command (0=totally open, 100= totally closed) starting and ending from an UNDEF position (since the binding doesn’t know the roller shutter actual position).

I’ve also noticed a weird behavior with the expire binding: it seems to store in my gateway to rollershutters the expire time so, when I use physical commands (without passing from OpenHAB), the roller shutter still opens for the time I gave in the item.
Given that, I can’t use this method.

I’m now looking deeper into this: Design Pattern: Separation of Behaviors
I think I’ll try creating a “rules chain” where the rule “scenario” switch ON some (proxy) items (one for each roller shutter) that fires other rules with UP/sleep/STOP commands inside.