PDA

View Full Version : HAI Plugin



drs
July 11th, 2006, 11:01 AM
Has anyone had experience with this plugin?
I loaded it in, and connected it to my HAI OmniPro II Controller.
Everything appeared to work fine at first. It loaded all the info, initiated commands, etc. Events were being captured, though I hadnt yet gotten into the Lua scripting necessary to grab events and figure out how to export the data.

Anyway, the major problem is that it loses connection after about 15 minutes or so. I have quit out of Girder 4, and even rebooted the machine. It will always reconnect after restarting, but it repeatedly drops the connection after a short time.

Am I missing something, or this just not yet stable?

Promixis
July 12th, 2006, 11:45 AM
Hi,

It should work fine. Are you running the latest versions of G4 and the HAI plugin? Would you upload the log file from Girder\Userdata\HAI here?

drs
July 15th, 2006, 12:24 PM
I think I solved the first problem.
I do have the latest Girder 4 and HAI Plugin, but I was using a USB-Serial converter.
Once I switched to a physical serial port, it appears to be retaining the connection.

Now the next problem.
To start, I am trying to do 2 relatively simple things: Issue a Command (eg, turn on/off an ALC light (Unit)) and Access an Event (eg, in response to an event, such as a light being turned on/off, access the info (unit, dim level, etc) and pass it along to another program, in particular MainLobby Server).

Beginning with the first (simpler) task, I created an Action to Turn On my ALC Unit #1. Based on the OmniLink protocol manual, I filled in the following fields in the plugin configuration:
COMMAND: 1 (for On)
P1: 0 (since No Dim Level)
P2 low byte 1 (for Unit #1)
P2 high byte 0 (since Unit# less than 128)

The Log Display responded with "treescript OK" and the light did not turn on.
Same with the Off Command (0 instead of 1 in the COMMAND byte).

I must be missing something.
Any ideas?

Also, any info on the 2d task would be helpful.
I'm new to LUA (assuming that is necessary), but just need info to find the variables, if any, created by the HAI event, and then get them to MainLobby Server (I have the MLGirder plugin to MainLobby Server, but only used it so far to send commands to Girder, not to retrieve info, assuming that is possible).

Thanks

drs
July 15th, 2006, 12:39 PM
OK

I forgot about the "Set Unit Condition" action, which makes it easy to turn lights on/off/etc. I still dont understand why my OmniLink command didnt work, however, as this may be useful for more obscure commands not covered in the actions included with the HAI plugin.

Of more immediate concern, however, is the 2d task.
How do I respond to Events (eg, lights going on/off) and access/send Event Info (Unit #, dim level, etc) to MainLobby Server. I dont even see which Variables, if any, are created by the plugin when an HAI event occurs.

Definitely could use some guidance here.

Thanks

Promixis
July 16th, 2006, 03:58 PM
Hi,

I would need to see more detailed output to help with why your command didn't work. You can up the level of logging by typing in the lua console HAI.LogLevel = 0.

All the variables are stored in the HAI table. You should see zones, units, thermostats etc. there.

Are you seeing the events for turning on lights in the logger?

I have not played with ALC so we may need some tweaking to get it where you want it.

drs
July 16th, 2006, 06:50 PM
Well, I figured out part of the problem.
I was seeing the HAI Events in the Logger window, but I didnt know how to respond to them. Then I noticed the Event Device section (Lua: HAI Omni), and that you can drag the Event from the Logger window to create the Event (helped with the syntax).

Anyway, I can now send commands to HAI, and respond to HAI events.
The next step is to figure out how to access the HAI Table you refer to.
I dont see it in the Variables window (just global variables, and not HAI variables ???), and I'm not sure how to access it via Lua.

Just need a little help to figure out how to access this info, and then how to send the data (preferably to ML Server, which I could do via HTTP if I knew how to format such a command from within Lua or one of the Girder plugins).

Thanks

Promixis
July 16th, 2006, 08:50 PM
Make sure you hit the Refresh button to see the HAI table.

from lua, to get zone info, you would use HAI.Zones [zonenumber]

try this from the lua console.

table.print (HAI.Zones)


I do not know anything about ML server but you can send data over tcp/ip using the G4 GIP plugin. That might be easiest.

drs
July 17th, 2006, 10:33 AM
Refresh did the trick (why didnt I think of that?)

Now I just need to experiment a bit with Lua, and the GIP plugin.

Thanks

drs
July 17th, 2006, 11:46 AM
OK
I thought I could figure this out from the Girder and HAI manuals.
But, I'm getting stuck with the table syntax for the HAI table.

I can reference the table generally (eg, table.print (HAI.Units) or table.print (HAI.Units [2]), but I dont really understand the complete structure of the HAI table, or how to reference it. For example, I tried to reference the "Name" field under a particular Unit (eg, table.print (HAI.Units [1.Name]). Of course, that didnt work.

I just need a little guidance as to the HAI table structure, or maybe just basic syntax for referencing tables (multidimensional?) -- or even just a pointer to some sample code accessing these types of tables.

Sorry for the newbie questions.

Rob H
July 17th, 2006, 01:11 PM
You'd refer to the name field using


HAI.Units[1].Name

m1duckett
July 19th, 2006, 04:26 PM
Also, any info on the 2d task would be helpful.
I'm new to LUA (assuming that is necessary), but just need info to find the variables, if any, created by the HAI event, and then get them to MainLobby Server (I have the MLGirder plugin to MainLobby Server, but only used it so far to send commands to Girder, not to retrieve info, assuming that is possible).


The MLServer plugin sends http commands only. MLServer (v2 anyway) has a MLGirder plugin that you would use to send events to Girder. I think (but not sure) that the MLGirder plugin uses the Girder Internet event protocol to send events.

If the info above is correct you want to setup MLServer to send a MLGirder command to Girder. Then in girder you would set up an action to be triggered by the Internet event sent by MLServer.

The MLServer plugin was written to complete the cycle so that commands could be sent back to MainLobby. The MLServer plugin is obfuscated now due to the LUA sockets availabilty.