zackyp
March 17th, 2008, 02:58 PM
Hi,
I'm new around here and new to the technology and to Girder as well, so please pardon me if this is a stupid question.
I'm trying to control Girder from web pages, using javascript, AJAX and LUA.
I've managed to write a simple implementation that pops up the Windows task bar baloon by posting a GET command, which in turn calls the following LUA code (lhtml file):
<%
webserver:SetGZIP(false)
webserver:SetHeader("Cache-Control: no-cache, must-revalidate")
webserver:SetHeader("Expires: Fri, 30 Oct 1998 14:19:41 GMT")
local table = webserver:GetCGI()
if ( gir ) then
gir.ShowBalloonHint(table['title'], table['content'], 1, 2, table['event_text'])
gir.cm11.AllLightsOn("A1")
end
%>
While this works fine, what I really want to do is activate CM11 (X-11) devices from a web interface. I found the following commands in the ref guide:
cm11.On([house], [device])
cm11.Off([house], [device])
cm11.AllUnitsOff([house])
cm11.AllLightsOff([house])
cm11.AllLightsOn([house])
cm11.Dim([house], [device], [dim])
cm11.Bright([house], [device], [dim])
cm11.DeviceStatus([house], [device]) -- Status response is a Girder Event
My question is how can I reference those calls from my LUA code (lhtml) file?
Furthermore, I would like to interrogate the various lighting devices using the cm11.DeviceStatus command. How can that be done - i.e. how can I return the interrogated value (i.e. Off/On/Unknown) to the web pages so that I could reflect the status in the GUI?
Thanks in advance!
Zac.
I'm new around here and new to the technology and to Girder as well, so please pardon me if this is a stupid question.
I'm trying to control Girder from web pages, using javascript, AJAX and LUA.
I've managed to write a simple implementation that pops up the Windows task bar baloon by posting a GET command, which in turn calls the following LUA code (lhtml file):
<%
webserver:SetGZIP(false)
webserver:SetHeader("Cache-Control: no-cache, must-revalidate")
webserver:SetHeader("Expires: Fri, 30 Oct 1998 14:19:41 GMT")
local table = webserver:GetCGI()
if ( gir ) then
gir.ShowBalloonHint(table['title'], table['content'], 1, 2, table['event_text'])
gir.cm11.AllLightsOn("A1")
end
%>
While this works fine, what I really want to do is activate CM11 (X-11) devices from a web interface. I found the following commands in the ref guide:
cm11.On([house], [device])
cm11.Off([house], [device])
cm11.AllUnitsOff([house])
cm11.AllLightsOff([house])
cm11.AllLightsOn([house])
cm11.Dim([house], [device], [dim])
cm11.Bright([house], [device], [dim])
cm11.DeviceStatus([house], [device]) -- Status response is a Girder Event
My question is how can I reference those calls from my LUA code (lhtml) file?
Furthermore, I would like to interrogate the various lighting devices using the cm11.DeviceStatus command. How can that be done - i.e. how can I return the interrogated value (i.e. Off/On/Unknown) to the web pages so that I could reflect the status in the GUI?
Thanks in advance!
Zac.