. . . . . .
Pytomation is an extensible device communication and automation system written in Python. It's uses include home automation and lighting control but is certainly not limited to that. It is supported on any platform that support Python ( Windows, Mac OS-X, Linux, etc )
Pytomation currently has support for the following hardware interfaces with more planned in the future.
Before you can create an instance and run Pytomation automation software you must satisfy a few dependencies. Pytomation is written in Python and currently has been tested under versions 2.6.x and 2.7.x.
Pytomation also requires the following packages to be installed for normal operation:
Optional Packages:
Additional packages are required for development and testing. See requirements.txt
for a more complete list.
Debian packages are available for pySerial, pytz, pythone-gevent, and python-openssl. They can be installed with :
sudo apt-get install git python-dev python-serial python-tz python-gevent python-openssl
For other operating systems, search your package manager for the equivalent packages or use pip to install the Python dependencies.
The remaining dependencies can be installed with pip
. Pip is a tool for installing and managing Python packages, such as those found in the Python Package Index.
Again, under Debian distributions you can install the python-pip package:
sudo apt-get install python-pip
Once pip is installed it is easy to install the rest of the dependencies with the following commands:
sudo pip install pyephem
sudo pip install APScheduler
To use the optional websocket server:
sudo pip install gevent-websocket
The gevent-websocket server is pretty fast, but can be accelerated further by installing wsaccel and ujson or simplejson
sudo pip install wsaccel ujson
Aeon Labs Z-Wave requires python-openzwave, which must be compiled from source. The instructions below list how to build from the development repositories. There is also prepared source avaiable at http://bibi21000.no-ip.biz/python-openzwave/python-openzwave-0.2.6.tgz, but that didn't work for me.
The following was extracted and adapted from the python-openzwave INSTALL_MAN.txt:
sudo apt-get install mercurial subversion python-pip python-dev python-setuptools python-louie python-sphinx make build-essential libudev-dev g++
sudo pip install cython==0.14
sudo pip install sphinxcontrib-blockdiag sphinxcontrib-actdiag
sudo pip install sphinxcontrib-nwdiag sphinxcontrib-seqdiag
hg clone https://code.google.com/p/python-openzwave/
cd python-openzwave
svn checkout http://open-zwave.googlecode.com/svn/trunk/ openzwave
./compile.sh
sudo ./install.sh
If you installed everthing, stop here. Otherwise, go to the openzwave directory and build it:
cd openzwave/cpp/build
make
cd ../../..
Build python-openzwave:
python setup-lib.py build
python setup-api.py build
And install them:
sudo python setup-lib.py install
sudo python setup-api.py install
Like with all other interfaces. Make sure the pyto user account owns or otherwise has permissions to use the device. You may want to give your own usr account access as well.
sudo chown youruseraccount:pyto /dev/yourzwavestick
sudo chmod 770 /dev/yourzwavestick
or
sudo chown pyto:pyto /dev/yourzwavestick
sudo chmod 770 /dev/yourzwavestick
Add the following either /etc/udev/rules.d
or /lib/udev/rules.d
(Simmilar procedure can be used for other serial interfaces. lsusb -v
can grab the neccessary ATTRS info.)
SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", ATTRS{serial}=="0001", SYMLINK+="zwave", GROUP="pyto", OWNER="pyto"
sudo pip install urwid louie
/ozwsh.sh --device=/dev/yourzwavestick
You are now ready to install pytomation. First, clone the pytomation git repository. Change into the pytomation repo directory and run ./install.sh
. You may have to make it executable with the command chmod +x ./install.sh
first. Install.sh can take an optional argument which points to an alternate installation directory:
./install.sh /some/other/folder/pytomation
The install.sh command does the following:
You are now ready to configure pytomation and create an instance for your devices.