From da2bcb3f27e7fec77666c55bca2f208bf7212376 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Sat, 27 Feb 2016 20:11:32 -0800 Subject: [PATCH 1/6] Fix static configured wemo devices The new wemo code was pulling 'static' from the global config instead of the wemo component config. --- homeassistant/components/wemo.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/wemo.py b/homeassistant/components/wemo.py index 9dc144266a8..e7fb426fe37 100644 --- a/homeassistant/components/wemo.py +++ b/homeassistant/components/wemo.py @@ -77,7 +77,8 @@ def setup(hass, config): devices = [(device.host, device) for device in pywemo.discover_devices()] # Add static devices from the config file - devices.extend((address, None) for address in config.get('static', [])) + devices.extend((address, None) + for address in config['wemo'].get('static', [])) for address, device in devices: port = pywemo.ouimeaux_device.probe_wemo(address) From 3790764df9d56697f5dd0aeb8a73130de6e8df89 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Sat, 27 Feb 2016 20:33:35 -0800 Subject: [PATCH 2/6] Fix wemo known device tracking The wemo component was tracking devices by mac to avoid adding duplicates, but this means we'd never be able to load more than one static wemo, since they all have mac=None. This changes the code to track by url, which has to be unique per wemo anyway, and which we also have for even static wemos. --- homeassistant/components/wemo.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/wemo.py b/homeassistant/components/wemo.py index e7fb426fe37..0427815c6e1 100644 --- a/homeassistant/components/wemo.py +++ b/homeassistant/components/wemo.py @@ -58,12 +58,12 @@ def setup(hass, config): def discovery_dispatch(service, discovery_info): """Dispatcher for WeMo discovery events.""" # name, model, location, mac - _, model_name, _, mac = discovery_info + _, model_name, url, _ = discovery_info # Only register a device once - if mac in KNOWN_DEVICES: + if url in KNOWN_DEVICES: return - KNOWN_DEVICES.append(mac) + KNOWN_DEVICES.append(url) service = WEMO_MODEL_DISPATCH.get(model_name) or DISCOVER_SWITCHES component = WEMO_SERVICE_DISPATCH.get(service) From 34b463f435224d0fffa63880b2a9eb6187667a54 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Sun, 28 Feb 2016 07:45:34 -0800 Subject: [PATCH 3/6] Gracefully handle having no wemo config section I broke this with my fix, where I assumed that we'd always have a wemo config section if we're running the wemo code. However, if we're fully auto-detected, we might not. --- homeassistant/components/wemo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/wemo.py b/homeassistant/components/wemo.py index 0427815c6e1..e6fc88bea1a 100644 --- a/homeassistant/components/wemo.py +++ b/homeassistant/components/wemo.py @@ -78,7 +78,7 @@ def setup(hass, config): # Add static devices from the config file devices.extend((address, None) - for address in config['wemo'].get('static', [])) + for address in config.get(DOMAIN, {}).get('static', [])) for address, device in devices: port = pywemo.ouimeaux_device.probe_wemo(address) From e246c83b0ef40d60d583ee1e9e278462da2cb637 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sun, 28 Feb 2016 09:27:52 -0800 Subject: [PATCH 4/6] Version bump to 0.14.1 --- homeassistant/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/const.py b/homeassistant/const.py index 1cd3cb4e5ca..a17f6359de5 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -1,7 +1,7 @@ # coding: utf-8 """Constants used by Home Assistant components.""" -__version__ = "0.14.0" +__version__ = "0.14.1" # Can be used to specify a catch all when registering state or event listeners. MATCH_ALL = '*' From c6a6eaee9f3a7d54b595cef6d236c6c9f3577a00 Mon Sep 17 00:00:00 2001 From: Stefan Jonasson Date: Mon, 29 Feb 2016 11:05:11 +0100 Subject: [PATCH 5/6] Fixed the z-wave sensor workarounds for empty manufacturer ids --- .../components/binary_sensor/zwave.py | 32 +++++++++++-------- homeassistant/components/sensor/zwave.py | 19 ++++++----- 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/homeassistant/components/binary_sensor/zwave.py b/homeassistant/components/binary_sensor/zwave.py index bd3ff69e8cf..683dbe117b5 100644 --- a/homeassistant/components/binary_sensor/zwave.py +++ b/homeassistant/components/binary_sensor/zwave.py @@ -39,22 +39,26 @@ def setup_platform(hass, config, add_devices, discovery_info=None): node = NETWORK.nodes[discovery_info[ATTR_NODE_ID]] value = node.values[discovery_info[ATTR_VALUE_ID]] - - specific_sensor_key = (int(value.node.manufacturer_id, 16), - int(value.node.product_id, 16), - value.index) - value.set_change_verified(False) - if specific_sensor_key in DEVICE_MAPPINGS: - if DEVICE_MAPPINGS[specific_sensor_key] == WORKAROUND_NO_OFF_EVENT: - # Default the multiplier to 4 - re_arm_multiplier = (get_config_value(value.node, 9) or 4) - add_devices([ - ZWaveTriggerSensor(value, "motion", - hass, re_arm_multiplier * 8) - ]) - elif value.command_class == COMMAND_CLASS_SENSOR_BINARY: + # Make sure that we have values for the key before converting to int + if (value.node.manufacturer_id.strip() and + value.node.product_id.strip()): + specific_sensor_key = (int(value.node.manufacturer_id, 16), + int(value.node.product_id, 16), + value.index) + + if specific_sensor_key in DEVICE_MAPPINGS: + if DEVICE_MAPPINGS[specific_sensor_key] == WORKAROUND_NO_OFF_EVENT: + # Default the multiplier to 4 + re_arm_multiplier = (get_config_value(value.node, 9) or 4) + add_devices([ + ZWaveTriggerSensor(value, "motion", + hass, re_arm_multiplier * 8) + ]) + return + + if value.command_class == COMMAND_CLASS_SENSOR_BINARY: add_devices([ZWaveBinarySensor(value, None)]) diff --git a/homeassistant/components/sensor/zwave.py b/homeassistant/components/sensor/zwave.py index 066ada12546..a441676c6f2 100644 --- a/homeassistant/components/sensor/zwave.py +++ b/homeassistant/components/sensor/zwave.py @@ -50,17 +50,20 @@ def setup_platform(hass, config, add_devices, discovery_info=None): # groups[1].associations): # node.groups[1].add_association(NETWORK.controller.node_id) - specific_sensor_key = (int(value.node.manufacturer_id, 16), - int(value.node.product_id, 16), - value.index) + # Make sure that we have values for the key before converting to int + if (value.node.manufacturer_id.strip() and + value.node.product_id.strip()): + specific_sensor_key = (int(value.node.manufacturer_id, 16), + int(value.node.product_id, 16), + value.index) - # Check workaround mappings for specific devices. - if specific_sensor_key in DEVICE_MAPPINGS: - if DEVICE_MAPPINGS[specific_sensor_key] == WORKAROUND_IGNORE: - return + # Check workaround mappings for specific devices. + if specific_sensor_key in DEVICE_MAPPINGS: + if DEVICE_MAPPINGS[specific_sensor_key] == WORKAROUND_IGNORE: + return # Generic Device mappings - elif value.command_class == COMMAND_CLASS_SENSOR_MULTILEVEL: + if value.command_class == COMMAND_CLASS_SENSOR_MULTILEVEL: add_devices([ZWaveMultilevelSensor(value)]) elif (value.command_class == COMMAND_CLASS_METER and From f9eb62dd9e260bd02829ec06079b43093274f199 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Mon, 29 Feb 2016 08:10:52 -0800 Subject: [PATCH 6/6] Version bump to 0.14.2 --- homeassistant/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/const.py b/homeassistant/const.py index a17f6359de5..a9c0503b126 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -1,7 +1,7 @@ # coding: utf-8 """Constants used by Home Assistant components.""" -__version__ = "0.14.1" +__version__ = "0.14.2" # Can be used to specify a catch all when registering state or event listeners. MATCH_ALL = '*'