luup.job.??? How to use it?

Hello all together,

I’ve invested in some xbee and arduino equipment and now I’m trying to “marry” them with vera.
Due to the fact that I don’t know when data arrives from the serial interface (where arduino is connected to)
I guess using jobs would be the best way to handle it, doesn’t it?

But where can I learn from how to work with jobs? The wiki is… well… a little too less. I guess the Paradox Alarm Plugin could help, but I can’t find the source.

Long story short: Every hint on how to use luup.jobs is welcome.

best regards,
Ted

Ted,
If you’re getting async data from the Arduino Board then look at the [tt]I_GC100.xml[/tt] and it’s [tt][/tt] block.

You dont need [tt]luup.job[/tt] for that.

Instead, the [tt][/tt] block of Lua will get called each time data is “ready” to be read in, and you then use the [tt]luup.io[/tt] Package methods to read it in.

Depending upon the device and interaction, you sometimes also use the [tt]luup.io[/tt] Package methods during [tt]startup()[/tt] to read the current/initial state.

Again, [tt]I_GC100.xml[/tt] is your friend here, and contains most of the examples needed, both for bootstrap and for on-going async read.

After installation of your code, and creation of a Device from it, you then need to “Attach” it to the relevant Serial Port, and do the “Serial Port Configuration” stuff on it to get the Baud Rate (etc) correct.

If your FTDI Serial to the Arduino isn’t recognised correctly, follow the sticky on Serial Ports to get it there. Either way, publish the results in the Serial page, so people know it works (or not):

http://wiki.micasaverde.com/index.php/Serial_Supported_Hardware

Good luck, the Arduino/Boarduino’s are tempting :wink:

AFAIK you can hook up XBee directly to Vera with that little adapter and FTDI USB cable

Yeap, that’s possible also and cuts out the middle man. If your going that route though, you might as well buy a fully assembled USB-Zigbee cable to avoid the connectors in the middle (it’s cheaper also)

Sooo many toys, so little time :wink:

Ah, so true! :slight_smile:

Thanks for your quick response guys!

The [tt][/tt] event is exactly what I was looking for. The FTDI worked instantaneously (I already tried, even without an application ;))
Now I got a lot to read to get the xbee working. Hopefully I can implement the functions in API mode, so it could maybe, someday, somehow interoperate with other zigbee devices from third party vendors. (… just daydreaming …)

best regards,
Ted

I’m sure you know that, but just in case - just one kind of XBee modules is Zigbee compatible. Others implement the same underlying protocol with no Zigbee support, they are cheaper and often used by DIY guys as serial radio modems.
My issue with them is cost, $25 per mudule plus other parts… connecting over wifi costs less and usually more versatile solution…

Well I bought the zigbee ones, just with an eye on already existing zigbee devices, to give me at least the potential opportunity to use them with vera.