command-line example

Hi. I’d like to control things from the Unix command line and write my logic in PERL or shell scripts (running out of cron). Can anyone post an example of doing so? I’m running a vera3. Everything appears to be very oriented towards using the GUI.

Are you planning on running this from Vera or on another computer? Vera does not have perl installed as it is a large library. Lua is the scripting language used in Vera.

  • Garrett

On the Vera3 itself. I could even use csh/sed/awk instead of PERL. I really would just like to know the command-line to turn a light on/off without using the UI.

[tt]http://wiki.micasaverde.com/index.php/Luup_Requests#action[/tt]

@Ap15e: I’ve seen those but they’re all through an HTTP interface. I’m actually looking for a Unix command line set that doesn’t require mediation by an http daemon. Does that make sense?

Maybe a better question would be the following: how do I write directly to the Zwave device driver on the vera3? I’m assuming that the kernel hook is in the /dev somewhere. I don’t see where the API to this device driver is published.

Why make it complicated than it needs to be? The api for the zwave device is all low level commands that interface I believe by a serial connection. There was someone on the forum that was working on a man in the middle program to interface between Vera and the zwave chip.

  • Garrett

Rich, the Z-Wave device just appears as a serial port that you can communicate with directly, if you know the serial protocol. Since knowing the protocol is apparently a trade secret worthy of an NDA, you can only really go by what has been reverse-engineered, which is not much.

Also, because it’s a serial device, your command-line program and the Vera daemon (LuaUPnP) will be in contention for the single resource. You can kill the daemon but then your Vera is little more than a router with a Z-Wave controller built into it.

So this is why we are suggesting that you talk to LuaUPnP with your command-line program. It handles all the low-level stuff on behalf of all its clients, both the web interface and your command-line program. The LuaUPnP interface is over HTTP on port 3480. You can of course use curl to speak to LuaUPnP from the command line. It works pretty well.

Interesting. So, you’re saying that the http daemon talks directly to the serial device and keeps it open? I was imagining that the http daemon simply called another executable which talked to the zwave device. Who would I need to sign the NDA with? Sigma?

Sigma is the one that requires NDA for access to the ZWave specs and protocols.

And costs a pretty penny I bet.

  • Garrett

… or visit [tt]http://open-zwave.googlecode.com/svn/trunk/cpp/src/command_classes/[/tt].

Good find!

  • Garrett

Yep.

# lsof | grep ttyUSB0 LuaUPnP 2222 root 4u CHR 188,0 0t0 1224 /dev/ttyUSB0