The UK Home Automation Archive

Archive Home
Group Home
Search Archive


Advanced Search

The UKHA-ARCHIVE IS CEASING OPERATIONS 31 DEC 2024


[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]

Re: JAVA and Linux XPL implementations



Howdy,

> I have been reading though the java/linux framework sites and was
> wondering has anyone managed to link these all together to be able to
do
> the following on a linux machine (or just with java)

> - scripting engine (seems xpl4java does this - how easy is it to use?
> determinators?)

Determinators are really just very easy to use (within certain parameters)
scripts (or at least thats how I think of them).  For common actions, the
take away alot of the bookkeeping and cruft.

The xPL4Java scripting engine is based on the beanshell
(http://www.beanshell.org/) and is
pretty simple to use.

For example, to create a script that notes when a light (X10) is turned on
and turns a different light on (lame example, but), the script would look
like:

------
init() {
SetDefaultSource("myvendor.mydevice.default");
ListenFor("xpl-trig.*.*.*.X10.*");
}

handleXPLMessage(theMessage) {
if (theMessage.hasNamedValue("command", "on")
&& theMessage.hasNamedValue("device", "B1")) {

aMsg = CreateMessage("xpl-cmnd",
"cdp1802-hvision.default", "x10.basic");
aMsg.setNamedValue("command", "on");
aMsg.setNamedValue("device", "F12");
SendMessage(aMsg);
}
-----

You'd put this into a file (maybe follow test.bsh) and drop it into
the xPL4Java scripts/ directory and within 30 seconds (sooner likely), the
script is up and ready to turn light F12 on anytime we here that
light B1 has turned on.  Make changes to the script and the scripting
engine
will note the change, unload the old copy and load the new copy (or if you
delete the script file, it just unloads the old copy).

Obviously, you can get a lot more complicated, but this is a simple,
practical example.  One really simple script I recently created notes
whenever the exhaust fans in the bathrooms are turned on and after 30
minutes, it makes sure they are turned off.  Took about 15 lines of code.

> - xpl control of a serial x10 controller

Depends on the X10 controller you want to use.  Right now, there is a linux
xPL adapter for HomeVision (hvsrv) and there can easily be others.  What
sort of hardware are you looking to control?

Gerry
--
Gerry Duprey
Ann Arbor, MI 48103
http://www.cdp1802.org



xPL Main Index | xPL Thread Index | xPL Home | Archives Home

Comments to the Webmaster are always welcomed, please use this contact form . Note that as this site is a mailing list archive, the Webmaster has no control over the contents of the messages. Comments about message content should be directed to the relevant mailing list.