diff --git a/homeassistant/components/isy994.py b/homeassistant/components/isy994.py index 6c4a431c1002798e0fc9ee06d5d20470c2671054..7fa0524d32f2da55ec45ff12a8f3e7927a644d35 100644 --- a/homeassistant/components/isy994.py +++ b/homeassistant/components/isy994.py @@ -25,6 +25,8 @@ DISCOVER_LIGHTS = "isy994.lights" DISCOVER_SWITCHES = "isy994.switches" DISCOVER_SENSORS = "isy994.sensors" ISY = None +SENSOR_STRING = 'Sensor' +HIDDEN_STRING = '{HIDE ME}' # setup logger logger = logging.getLogger(__name__) @@ -32,28 +34,34 @@ logger.setLevel(logging.DEBUG) def setup(hass, config): - # pull values from configuration file + # check for required values in configuration file if not validate_config(config, {DOMAIN: [CONF_HOST, CONF_USERNAME, CONF_PASSWORD]}, logger): return False + + # pull and parse standard configuration + user = config[DOMAIN][CONF_USERNAME] + password = config[DOMAIN][CONF_PASSWORD] + host = urlparse(config[DOMAIN][CONF_HOST]) + addr = host.geturl() + if host.scheme == 'http': + addr = addr.replace('http://', '') + https = False + elif host.scheme == 'https': + addr = addr.replace('https://', '') + https = True else: - user = config[DOMAIN][CONF_USERNAME] - password = config[DOMAIN][CONF_PASSWORD] - host = urlparse(config[DOMAIN][CONF_HOST]) - addr = host.geturl() - if host.scheme == 'http': - addr = addr.replace('http://', '') - https = False - elif host.scheme == 'https': - addr = addr.replace('https://', '') - https = True - else: - logger.error('isy994 host value in configuration ' + - 'file is invalid.') - return False - port = host.port - addr = addr.replace(':{}'.format(port), '') + logger.error('isy994 host value in configuration file is invalid.') + return False + port = host.port + addr = addr.replace(':{}'.format(port), '') + + # pull and parse optional configuration + global SENSOR_STRING + global HIDDEN_STRING + SENSOR_STRING = config[DOMAIN].get('sensor_string', SENSOR_STRING) + HIDDEN_STRING = config[DOMAIN].get('hidden_string', HIDDEN_STRING) # connect to ISY controller global ISY diff --git a/homeassistant/components/light/isy994.py b/homeassistant/components/light/isy994.py index 16d7f6b052c33e3dbb7c537e550b683f3cd6c1cf..60a4faafe13c6c8a2e46e4d0da9b12147ea522f6 100644 --- a/homeassistant/components/light/isy994.py +++ b/homeassistant/components/light/isy994.py @@ -3,7 +3,7 @@ import logging # homeassistant imports -from homeassistant.components.isy994 import ISYDeviceABC, ISY +from homeassistant.components.isy994 import ISYDeviceABC, ISY, SENSOR_STRING from homeassistant.components.light import ATTR_BRIGHTNESS from homeassistant.const import STATE_ON, STATE_OFF @@ -19,7 +19,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None): # import dimmable nodes for node in ISY.nodes: - if node.dimmable: + if node.dimmable and SENSOR_STRING not in node.name: devs.append(ISYLightDevice(node)) add_devices(devs) diff --git a/homeassistant/components/sensor/isy994.py b/homeassistant/components/sensor/isy994.py index a05257f2c3b52737219acf7939ddae9d152441bc..aa98c5949101cbe0f387e380fc507fb5b13336a4 100644 --- a/homeassistant/components/sensor/isy994.py +++ b/homeassistant/components/sensor/isy994.py @@ -3,7 +3,7 @@ import logging # homeassistant imports -from homeassistant.components.isy994 import ISY, ISYDeviceABC +from homeassistant.components.isy994 import ISY, ISYDeviceABC, SENSOR_STRING from homeassistant.const import (STATE_OPEN, STATE_CLOSED, STATE_HOME, STATE_NOT_HOME, STATE_ON, STATE_OFF) @@ -26,6 +26,11 @@ def setup_platform(hass, config, add_devices, discovery_info=None): getattr(ISY.climate, prop + '_units')) devs.append(ISYSensorDevice(node)) + # import sensor nodes + for node in ISY.nodes: + if SENSOR_STRING in node.name: + devs.append(ISYSensorDevice(node, [STATE_ON, STATE_OFF])) + # import sensor programs for (folder_name, states) in ( ('HA.locations', [STATE_HOME, STATE_NOT_HOME]), diff --git a/homeassistant/components/switch/isy994.py b/homeassistant/components/switch/isy994.py index c33e0666fd3c1c342af2c8083e27bb1913a586e6..1ea87e3fc2e9229c879d7de3ee4cdba0e34d9b50 100644 --- a/homeassistant/components/switch/isy994.py +++ b/homeassistant/components/switch/isy994.py @@ -3,7 +3,7 @@ import logging # homeassistant imports -from homeassistant.components.isy994 import ISY, ISYDeviceABC +from homeassistant.components.isy994 import ISY, ISYDeviceABC, SENSOR_STRING from homeassistant.const import STATE_ON, STATE_OFF # STATE_OPEN, STATE_CLOSED # The frontend doesn't seem to fully support the open and closed states yet. # Once it does, the HA.doors programs should report open and closed instead of @@ -21,7 +21,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None): # import not dimmable nodes and groups for node in ISY.nodes: - if not node.dimmable: + if not node.dimmable and SENSOR_STRING not in node.name: devs.append(ISYSwitchDevice(node)) # import ISY doors programs