Added hidden_string and sensor_string properties to the isy994 configuration to allow nodes to be hidden and to be handled as sensors. Implimented the sensor_string. Any node name that contains the sensor_string in its name will be treated as a sensor instead of a switch or light. The hidden_string will be implimented later.

This commit is contained in:
Ryan Kraus committed 2015-04-13 12:56:37 -04:00
1 parent 0e9a8a7cc2
commit 83aea10f06
4 files changed
+35 -22

No files matched your search

+25 -17
View File
@@ -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