View Full Version : Webserver Serial Example

May 3rd, 2012, 08:40 PM
I've used the Girder console and a Serial.lua to successfully send commands to my Onkyo receiver using the Integra ISCP protocol.

Is there a simple way to modify the “Webserver IR Example” to trigger the Serial commands in my GML?


May 4th, 2012, 10:41 AM
Yes. Triggering any action in Girder from a webpage is easy. There are two files (girder.js and ajax_sendevent.hmtl) that are part of the default Girder install located in the httpd directory.

Just add: <script src="girder.js" type="text/javascript"></script> in the <head> tag of your html and to trigger any event add: onclick="return SendEvent(&quot;THUMBSUP&quot;, &quot;100&quot;);" inside the html tag you want to trigger an event. (You will have to change THUMBSUP and 100 to the event and device number you have setup in Girder as your event.)

This is a basic building block. There are SEVERAL variations on how this can be done, so if you have something in your head let me know...

May 4th, 2012, 05:36 PM
Thanks for your assistance.

I have a couple of basic questions;

Is the Event identified by the GML and the ASCII string that it is setup to send; [my.gml\onkyo\keys\POWER ON\!1PWR01]

Where I am using the Serial Pluggin with asimple lua to set the appropriate parameters, is the device number the Pluggin number (242 for Generic Serial))?

I've been using Girder with IR; using serial and the Webserver is a new world for me.

May 8th, 2012, 06:01 AM
You can right click on an action and choose add event. Once added change the device and event string to match what you have on the webpage and it should fire.

May 10th, 2012, 08:09 AM
Thanks for your assistance Shaun5

Can you please have a look at the simple html attached - hopefully you will be able to see where I'm going wrong - the header and the sendevent

I've checked and both girder.js and ajax_sendevent.html are in the httpd directory

May 10th, 2012, 08:38 AM
I think your page should be working. I'm away from my Girder machine, so I can't test right now. Add a script action in Girder with the folllowing: gir.TriggerEvent( "ON", "242", 0). Run the script action, if it works then there is a problem with your webpage, if it doesn't there is a problem with the event name and/or device number.

May 10th, 2012, 04:31 PM
The script action works fine.

May 10th, 2012, 09:42 PM
You have scr vs. src for the girder.js file, so it isn't loading....

May 14th, 2012, 09:13 AM
I'm still not getting the Event Triggered via the WebServer. The script gir.TriggerEvent( "RCVR OFF", "242") works fine.

I started again from scratch - built it as simple as I think it can be. One button to turn off the Receiver.

The html file and two .png files are attached. I'd appreciate your review - I can't see where it's going wrong.

May 14th, 2012, 09:28 AM
Again, I am away from Girder, but do see your statement: OnClick="return SendEvent("RCVR OFF", "242");" has nested double quotes... should be something likeOnClick='return SendEvent("RCVR OFF", "242");'

May 14th, 2012, 04:48 PM
Thanks. Fixed that but no improvement.

May 17th, 2012, 08:56 PM
You also misspelled javascript: <script src="girder.js" type="text/javascript"></script>.

May 28th, 2012, 08:13 AM
Thanks for all your tutoring - I finally have a working example (attached)

It may not be elegant but it gives me something to build upon.