Skip to content

Commit

Permalink
use sane defaults for openzwave config
Browse files Browse the repository at this point in the history
Use sane default if libopenzwave is installed. In most cases this will
mean that the zwave config path will not need to e manually specified.
  • Loading branch information
tangent committed Apr 23, 2016
1 parent 413b8d3 commit ad64016
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions homeassistant/components/zwave.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"""
import logging
import os.path
import sys
import time
from pprint import pprint

Expand All @@ -25,8 +24,6 @@
CONF_DEBUG = "debug"
CONF_POLLING_INTERVAL = "polling_interval"
CONF_POLLING_INTENSITY = "polling_intensity"
DEFAULT_ZWAVE_CONFIG_PATH = os.path.join(sys.prefix, 'share',
'python-openzwave', 'config')

# How long to wait for the zwave network to be ready.
NETWORK_READY_WAIT_SECS = 30
Expand Down Expand Up @@ -175,10 +172,14 @@ def setup(hass, config):
# pylint: disable=global-statement, import-error
global NETWORK

import libopenzwave
from pydispatch import dispatcher
from openzwave.option import ZWaveOption
from openzwave.network import ZWaveNetwork

default_zwave_config_path = os.path.join(os.path.dirname(
libopenzwave.__file__), 'config')

# Load configuration
use_debug = str(config[DOMAIN].get(CONF_DEBUG)) == '1'
customize = config[DOMAIN].get(CONF_CUSTOMIZE, {})
Expand All @@ -188,7 +189,7 @@ def setup(hass, config):
config[DOMAIN].get(CONF_USB_STICK_PATH, DEFAULT_CONF_USB_STICK_PATH),
user_path=hass.config.config_dir,
config_path=config[DOMAIN].get('config_path',
DEFAULT_ZWAVE_CONFIG_PATH),)
default_zwave_config_path),)

options.set_console_output(use_debug)
options.lock()
Expand Down

0 comments on commit ad64016

Please sign in to comment.