X10Graph version 0.2c
If you'd like to send patches or discuss improvements, I'm interested, please email me.
Talk to me first since I am actively working on this If you find it useful at all, please send me an email to let me know. (akom isat usa dot net) If you can't get it to work after reading this file, send me a detailed outline of the problem
(Obviously if xtend isn't working - consult xtend help instead)
- PREMISE
I have a bunch of X10 - controlled items at home. I am also running a Linux server with a bunch of stuff on it which is always ON. I already had a CM11A 2-way interface hooked up to this server
I wanted to be able to find out what the X10 system is up to when I'm not around, and perhaps even when I am. At first I wrote this as a quick hack, but it sort of grew and I cleaned up the code an put it up on Freshmeat.net
As it turned out, between the motion detectors and dusk/dawn changes, a lot of interesting events occur on the system. (In my setup) I can even figure out when different people wake up, where they go and guess why.
WHAT IS IT
A plotter to present X10 activity, as received by any 2way X10 computer interface. As X10 interfaces store almost no data, data is recorded in a data file on the PC, while all of the hard/soft ware is on.
REQUIREMENTS
- Hardware
-X10 interface (2way, eg CM11A, CM12A)
Those are available from http://www.x10.com Note: firecracker is NOT a 2 way interface, it can only send signals
-Any computer capable of running all of this which will be always ON
(Or at least on when you wish data to be recorded)
Software:
-x10 daemon software, eg xtend (see xtend page on freshmeat.net)
XTEND page: http://www.jabberwocky.com/software/xtend/
if you already have heyu, xtend can work with it, see xtend README
-Jpgraph (A graph generator) (see jpgraph page on freshmeat.net)
JPGRAPH page: http://www.aditus.nu/jpgraph/
-Any PHP capable web server (eg Apache)
- INSTALLATION
1)Install xtend if you don't have it 2)Install jpgraph if you don't have it 3) Unzip and put the php files in your web tree,
you'll probably want them in their own directory. Add them to php include path if necessary, see your server.
Edit x10lib.php (first few lines have configuration options) and graph.php (location of jpgraph.php, etc) 3a) Make sure the help/ directory is under the directory with the php files,
this will enable help to work 4) Add xtendrc.segment.? to your .xtendrc (probably in /etc)
There are 16 of these files, add the one(s) to match the housecode
you wish do record data for.
All of these are really the same, just the letter is replaced for your convenience
Don't forget to backup your .xtendrc
try this: "cat xtendrc.segment.a >> /etc/.xtendrc"
Do this for each housecode you want.
If you really want to record data on all housecodes, do
"cat xtendrc.segment.* >> /etc/.xtendrc"
Before doing any of this, make sure there aren't already any of these
commands at the end of the .xtendrc file, eg from a prior addition
Edit the added text to make sure the paths are valid (do a replace-all!!!)
If you do edit it, also change x10lib.php to use the same path
Make sure the file(s) that those commands create can be created.
You should proably create it yourself, or wait until it's created by an X10 event,
then change the ownership to your webserver uid. (eg: apache:apache)
This way x10lib.php will be able to truncate it when it becomes too large
(Set the data limit params in x10lib.php)
Also, if you have a prior xtend installation, check that the new commands
have not been already defined. If they have, you should join them together with
semicolons on one line.
For example if you already had
b2 on do something to something
you should change it to
b2 on the command line I supply in xtend.segment ; do something to something
If you do not do this, xtend will spew warnings at startup, and will ignore
whichever command comes second.
Restart xtend when you're done, and send some X10 signals.
do a "tail -f c.x10" (or whatever your code is) on the file, and watch entries appear.
If they are not, some part of your xtend setup is not working.
Check serial cable, port in .xtendrc, filepaths in .xtendrc, permissions etc.
Check Xtend documentation.
You do not need to have any of the xtendrc.segment.* files in your web tree, and you
may delete them or move them elsewhere when you get everything running
5) Try to hit the url of the index.php page
That should do it.
- TWEAKING
xtend tends to die on me. I added an xtend restart to cron.hourly and had no more problems The result of xtend dying, naturally, is absense of data past its death point.
- Advanced
- Xtend and the rest of the software need not be on the same machine. If you can get xtend to write the output to a file on another computer, you can get everything to work. All that is required is that x10lib.php can access it
- TROUBLESHOOTING
Problem: Nothing appears on the graph or table, normal mode shows 1969 as the last event time for all units
-Is there any data? Check the data file (it is text), eg: /whereverYouSetIt/a.x10
If there is data in it, you know xtend is setup correctly and events have occured.
Check that x10lib.php is set to use that same file(s), and can read it.
If not, check /etc/.xtendrc and that the paths in the event commands are pointing
to an existing location, which is writable.
Restart xtend and watch for any startup errors
Problem: Graph (only) does not work
-are jpgraph.php and its lineplot file accessible to x10graph.php? check the require line
-If an internal error is suspected, try to view the image by itself.
To do this, replace the url with the same but use /x10graph.php
as the script name. eg /path/x10graph.php?offset=&house=a ...etc
(You may be able to right-click on the empty space of the graph and
select "View Image" or "Open ..." - it's the same thing)
This will permit you to see if any errors were printed by x10graph
If you cannot fix it yourself, or you suspect a bug - report it in detail
