Skip to content

Commit

Permalink
added python-openzwave support
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Baginski committed May 12, 2016
1 parent 28f656c commit 7f12048
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 5 deletions.
25 changes: 20 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@

![image](images/hass_icon.png) ![image](images/plus.png) ![image](images/fabric_icon.png)

Easily deploy [Home-Assistant](http://home-assistant.io) along with a websockets enabled build of [Mosquitto](https://github.com/eclipse/mosquitto) to your Raspberry Pi with Fabric.

The fabric script deploys hass in a virtualenv, and is run by a service account. This build is done in alignment with the install instructions found on Home-Assistant's website. The script also installs hass and Mosquitto as a Systemd service for you with the supplied .service files.
Easily deploy [Home-Assistant](http://home-assistant.io) and it's componants from a fresh Raspbian Jessie or Debian 8 install. The deploy script will do the following:
* Create needed directories
* Create needed service accounts
* Install OS and Python dependencies
* Setup a virtualenv to run Home-Assistant and components inside.
* Run as a service account
* Build Mosquitto from source with websocket support
* Install Python-openzwave in the Home-Assistant virtualenv
* Add both Home-Assistant and Mosquitto to systemd services



**What is [Fabric](http://www.fabfile.org)?**
The official README says:
Expand All @@ -17,11 +25,18 @@
### To Run:

Simply install fabric locally:
```pip install fabric```
```pip install fabric``` (for python 3 support, install fabric3 [https://github.com/mathiasertl/fabric.git](https://github.com/mathiasertl/fabric))

Ensure you're able to SSH into the target server.

Clone the contents: ``` git clone https://github.com/jbags81/fabric-home-assistant.git ```
Add the host info from before to the beginning of ```fabfile.py```

Run the "deploy" function to build a new home-assistant server: ``` fab deploy ```

Fabric allows any of the underlying functions to be ran individually as well. run ``` fab -l ``` to see a list of all callable jobs.

Run the "deploy" function: ``` fab deploy ```
Future support for non-virtualenv based servers will be added, along with the ability to auto upload existing or backup .yaml Home-Assistant configs. I'm also working on a turn-key devlopment script to make testing and development environments one click setups.. More to come!



Expand Down
17 changes: 17 additions & 0 deletions fabfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ def setup_dirs():
with cd("/srv"):
sudo("mkdir hass")
sudo("chown hass hass")
with cd("hass"):
sudo("mkdir -p src")
sudo("chown hass:hass src")
with cd("/home"):
sudo("mkdir -p hass")
sudo("chown hass:hass hass")
Expand Down Expand Up @@ -99,6 +102,17 @@ def setup_homeassistant():
""" Activate VirtualEnv, Install Home-Assistant """
sudo("source /srv/hass/hass_venv/bin/activate && pip3 install homeassistant", user="hass")

def setup_pyzwave():
""" Install python-openzwave and configure """
sudo("apt-get install -y cython3 libudev-dev python3-sphinx python3-setuptools")
sudo("source /srv/hass/hass_venv/bin/activate && pip3 install --upgrade cython", user="hass")
with cd("/srv/hass/src"):
sudo("git clone https://github.com/OpenZWave/python-openzwave.git", user="hass")
with cd("python-openzwave"):
sudo("git checkout python3", user="hass")
sudo("source /srv/hass/hass_venv/bin/activate && PYTHON_EXEC=`which python3` make build", user="hass")
sudo("source /srv/hass/hass_venv/bin/activate && PYTHON_EXEC=`which python3` make install", user="hass")

def setup_services():
""" Enable applications to start at boot via systemd """
with cd("/etc/systemd/system/"):
Expand Down Expand Up @@ -136,5 +150,8 @@ def deploy():
## Activate venv, install Home-Assistant ##
setup_homeassistant()

## Activate venv, build and install python-openzwave ##
setup_pyzwave()

## Make apps start at boot ##
setup_services()

0 comments on commit 7f12048

Please sign in to comment.