From aa57534d1a6872fd3f67108843f764417a12f2bf Mon Sep 17 00:00:00 2001 From: Josh Wright Date: Tue, 2 May 2017 16:47:41 -0400 Subject: [PATCH 1/4] Remove default zwave config path PYOZW now has much more comprehensive default handling for the config path (in src-lib/libopenzwave/libopenzwave.pyx:getConfig()). It looks in the same place we were looking, plus _many_ more. It will certainly do a much better job of finding the config files than we will (and will be updated as the library is changed, so we don't end up chasing it). The getConfig() method has been there for a while, but was subsntially improved recently. This change simply leaves the config_path as None if it is not specified, which will trigger the default handling in PYOZW. --- homeassistant/components/zwave/__init__.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/homeassistant/components/zwave/__init__.py b/homeassistant/components/zwave/__init__.py index dad7a55d14c8bd..bfccd4d336bb09 100755 --- a/homeassistant/components/zwave/__init__.py +++ b/homeassistant/components/zwave/__init__.py @@ -234,9 +234,6 @@ def setup(hass, config): from openzwave.network import ZWaveNetwork from openzwave.group import ZWaveGroup - default_zwave_config_path = os.path.join(os.path.dirname( - libopenzwave.__file__), 'config') - # Load configuration use_debug = config[DOMAIN].get(CONF_DEBUG) autoheal = config[DOMAIN].get(CONF_AUTOHEAL) @@ -249,8 +246,7 @@ def setup(hass, config): options = ZWaveOption( config[DOMAIN].get(CONF_USB_STICK_PATH), user_path=hass.config.config_dir, - config_path=config[DOMAIN].get( - CONF_CONFIG_PATH, default_zwave_config_path)) + config_path=config[DOMAIN].get(CONF_CONFIG_PATH)) options.set_console_output(use_debug) options.lock() From fc7e0e0e294a6cee7afea6ac2d407ee057860d08 Mon Sep 17 00:00:00 2001 From: Josh Wright Date: Tue, 2 May 2017 16:57:29 -0400 Subject: [PATCH 2/4] Install python-openzwave from PyPI As of version 0.4, python-openzwave supports installation from PyPI, which means we can use our 'normal' dependency management tooling to install it. Yay. This uses the default 'embed' build (which goes and downloads statically sources to avoid having to compile anything locally). Check out the python-openzwave readme for more details. --- homeassistant/components/zwave/__init__.py | 9 +-------- requirements_all.txt | 3 +++ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/zwave/__init__.py b/homeassistant/components/zwave/__init__.py index bfccd4d336bb09..4e3045bcee299e 100755 --- a/homeassistant/components/zwave/__init__.py +++ b/homeassistant/components/zwave/__init__.py @@ -35,7 +35,7 @@ from .discovery_schemas import DISCOVERY_SCHEMAS from .util import check_node_schema, check_value_schema, node_name -REQUIREMENTS = ['pydispatcher==2.0.5'] +REQUIREMENTS = ['pydispatcher==2.0.5', 'python_openzwave==0.4.0.31'] _LOGGER = logging.getLogger(__name__) @@ -221,13 +221,6 @@ def setup(hass, config): descriptions = conf_util.load_yaml_config_file( os.path.join(os.path.dirname(__file__), 'services.yaml')) - try: - import libopenzwave - except ImportError: - _LOGGER.error("You are missing required dependency Python Open " - "Z-Wave. Please follow instructions at: " - "https://home-assistant.io/components/zwave/") - return False from pydispatch import dispatcher # pylint: disable=import-error from openzwave.option import ZWaveOption diff --git a/requirements_all.txt b/requirements_all.txt index 2af9ff81f518f4..f7aef155c2828a 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -675,6 +675,9 @@ python-vlc==1.1.2 # homeassistant.components.wink python-wink==1.2.3 +# homeassistant.components.zwave +python_openzwave==0.4.0.31 + # homeassistant.components.device_tracker.trackr pytrackr==0.0.5 From d7ee2f98cfee715cd90530fc884b4f95c8971ea6 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Wed, 3 May 2017 08:44:51 -0700 Subject: [PATCH 3/4] Add python-openzwave deps to .travis.yml Python OpenZwave require the libudev headers to build. This adds the libudev-dev package to Travis runs via the 'apt' addon for Travis. Thanks to @MartinHjelmare for this fix. --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 864699a2fbdc9b..aad5cc7028ad17 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,8 @@ sudo: false +addons: + apt: + packages: + - libudev-dev matrix: fast_finish: true include: From 5dd6d395b079d8ee85afae912761e3fd0c23f7ca Mon Sep 17 00:00:00 2001 From: Josh Wright Date: Fri, 5 May 2017 14:32:58 -0400 Subject: [PATCH 4/4] Update docker build for PyPI openzwave Now that PYOZW can be install from PyPI, the docker image build process can be simplified to remove the explicit compilation of PYOZW. --- virtualization/Docker/Dockerfile.dev | 1 - .../Docker/scripts/python_openzwave | 30 ------------------- virtualization/Docker/setup_docker_prereqs | 9 ++---- 3 files changed, 2 insertions(+), 38 deletions(-) delete mode 100755 virtualization/Docker/scripts/python_openzwave diff --git a/virtualization/Docker/Dockerfile.dev b/virtualization/Docker/Dockerfile.dev index 5d16e9400ef072..0d546d12eb001b 100644 --- a/virtualization/Docker/Dockerfile.dev +++ b/virtualization/Docker/Dockerfile.dev @@ -9,7 +9,6 @@ MAINTAINER Paulus Schoutsen #ENV INSTALL_TELLSTICK no #ENV INSTALL_OPENALPR no #ENV INSTALL_FFMPEG no -#ENV INSTALL_OPENZWAVE no #ENV INSTALL_LIBCEC no #ENV INSTALL_PHANTOMJS no #ENV INSTALL_COAP_CLIENT no diff --git a/virtualization/Docker/scripts/python_openzwave b/virtualization/Docker/scripts/python_openzwave deleted file mode 100755 index 85a418901864f8..00000000000000 --- a/virtualization/Docker/scripts/python_openzwave +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -# Sets up python-openzwave. -# Dependencies that need to be installed: -# apt-get install cython3 libudev-dev python3-sphinx python3-setuptools - -# Stop on errors -set -e - -cd "$(dirname "$0")/.." - -if [ ! -d build ]; then - mkdir build -fi - -cd build - -if [ -d python-openzwave ]; then - cd python-openzwave - git checkout v0.3.3 -else - git clone --branch v0.3.3 --recursive --depth 1 https://github.com/OpenZWave/python-openzwave.git - cd python-openzwave -fi - -pip3 install --upgrade cython==0.24.1 -PYTHON_EXEC=`which python3` make build -PYTHON_EXEC=`which python3` make install - -mkdir -p /usr/local/share/python-openzwave -cp -R openzwave/config /usr/local/share/python-openzwave/config diff --git a/virtualization/Docker/setup_docker_prereqs b/virtualization/Docker/setup_docker_prereqs index 69f76e927e2742..a6bf716312d743 100755 --- a/virtualization/Docker/setup_docker_prereqs +++ b/virtualization/Docker/setup_docker_prereqs @@ -7,7 +7,6 @@ set -e INSTALL_TELLSTICK="${INSTALL_TELLSTICK:-yes}" INSTALL_OPENALPR="${INSTALL_OPENALPR:-yes}" INSTALL_FFMPEG="${INSTALL_FFMPEG:-yes}" -INSTALL_OPENZWAVE="${INSTALL_OPENZWAVE:-yes}" INSTALL_LIBCEC="${INSTALL_LIBCEC:-yes}" INSTALL_PHANTOMJS="${INSTALL_PHANTOMJS:-yes}" INSTALL_COAP_CLIENT="${INSTALL_COAP_CLIENT:-yes}" @@ -24,13 +23,13 @@ PACKAGES=( bluetooth libglib2.0-dev libbluetooth-dev # homeassistant.components.device_tracker.owntracks libsodium13 + # homeassistant.components.zwave + libudev-dev ) # Required debian packages for building dependencies PACKAGES_DEV=( cmake git - # python-openzwave - cython3 libudev-dev # libcec swig ) @@ -51,10 +50,6 @@ if [ "$INSTALL_FFMPEG" == "yes" ]; then virtualization/Docker/scripts/ffmpeg fi -if [ "$INSTALL_OPENZWAVE" == "yes" ]; then - virtualization/Docker/scripts/python_openzwave -fi - if [ "$INSTALL_LIBCEC" == "yes" ]; then virtualization/Docker/scripts/libcec fi