RunLua failed - no clue

I have some scenes to control my shades (Somfy RTS with Telis 4). So I have to simulate the channel change by switching on and of a specific amount of times.

This works but I wanted to optimize a little bit and now the code doesn’t work anymore. But I have absolutely no clue why. I didn’t even change anything where the error occurs.

Please find the code attached.

Thanks for any help, this issue was eating up hours already…

Did you perform a replace operation? Most of your names seem to have a space in them - just before Open.

In fact I did, but only for better understanding (English).

I corrected it in the first attachment.

Is it your intention to set this device with an empty string?

luup.call_action(“urn:upnp-org:serviceId:SwitchPower1”,“SetTarget”,{ newTargetValue=“” },263)

Yes the problem was, that I couldn’t trigger with its state otherwise if it was already on. So if choose UP but the shades have been closed by the scene “Close All Shades”, it wouldn’t trigger.

However I tested it separately and it worked.

In functions reset_channel_on_Open and channel_on_Open, you have an argument that you test and decrement. If the value was > 0, you call a different function and don’t include the argument. I cannot believe that is what you intended…

Yes, that’s true. I replaced all the variables with global ones. I hope it works now.
Although I’m not sure - wouldn’t a local variable be sufficient?

Testing…

Although I'm not sure - wouldn't a local variable be sufficient?
A local variable is fine but you need to pass it with the loop [b]luup.call_delay(...)[/b] otherwise the callback will get nil on the second pass.

Hm thanks for your help!

I use global variables without passing it. As far as I understand it this should be no problem.

At first I reset the variable and work with it during the scene. After this I don’t use it anymore, unless I restart the scene and overwrite it with the initial value.

In the end it works now. Just some issues with the timing to iron out.