PDA

View Full Version : Girder not triggering Lua script



freezer
February 3rd, 2012, 07:08 AM
Continuing to work on my web implementation - I use the ajax_sendevent to trigger a Lua function that sends a serial cmd to my Yamaha receiver. Everything has worked fine until now; I have two commands for muting (Audio.Z1MuteOn and Audio.Z1MuteOff); the sequence is as follows from the log -

1. From webserver; ajax_sendevent Audio.Z1MuteOn
2. Girder finds the event in the GML and triggers RXV2500:Z1MuteOn()
3. Lua sends serial cmd to Yamaha receiver and system is Muted
4. From webserver; ajaxreq command sent twice to get value of RXV2500_Mainvol
-- up to this point, everything is working as expected....then I wait a period of time --
5. From webserver; ajax_sendevent Audio.Z1MuteOff
6. Girder sees the request, but does not trigger RXV2500:Z1MuteOff()
7. Resend ajax_sendevent Audio.Z1MuteOn
8. Girder sees the request, but does not trigger RXV2500:Z1MuteOn()
9. From webserver; ajax_sendevent Audio.Z1MuteOff
10. Girder sees the request, and this time triggers RXV2500:Z1MuteOff()
11. Lua sends serial cmd to Yamaha receiver and system no longer muted

Also, from the girder console I can manually send Audio.Z1MuteOn and Audio.Z1MuteOff in sequence without any problems.....

This appears to be a problem between Girder and Lua (?) Or a timing problem (?)....or just some dumb coding problem (?)

Any advice on how to debug the problem ? ....thxs

Ron
February 3rd, 2012, 07:16 AM
What is the full version of girder including build number you are running?

freezer
February 3rd, 2012, 07:24 AM
Ron: my Girder Version is 5.0.8, build 542 ; suspect you are going to tell me to update....

Ron
February 3rd, 2012, 07:40 AM
No that should be fine. Though upgrading the 5.014b might help. Can you attach the GML?

freezer
February 3rd, 2012, 07:48 AM
Thxs, GML (and updated Lua script) attached -

6369

6370

Ron
February 3rd, 2012, 08:22 AM
You have a state count of two on the Z1-Mute Off action. This means one out of ever 2 events is skipped. So set state count to 1 and see if that help you.

freezer
February 3rd, 2012, 08:53 AM
Ron - that was it!! Thxs very much for your quick response & guidance....so, it was a dumb coding problem ;)

Now on to a few more changes and then I hope to have a new version of my website implementation for posting later this weekend...