From b27ba9660b960375efb7fa0f466351e81a890650 Mon Sep 17 00:00:00 2001 From: Andrey Date: Fri, 24 Feb 2017 16:17:27 +0200 Subject: [PATCH] Some zwave cleanup (#6203) --- homeassistant/components/binary_sensor/zwave.py | 2 -- homeassistant/components/climate/zwave.py | 1 - homeassistant/components/cover/zwave.py | 5 ----- homeassistant/components/light/zwave.py | 8 -------- homeassistant/components/lock/zwave.py | 7 ------- homeassistant/components/sensor/zwave.py | 2 -- homeassistant/components/switch/zwave.py | 9 +-------- homeassistant/components/zwave/__init__.py | 1 + 8 files changed, 2 insertions(+), 33 deletions(-) diff --git a/homeassistant/components/binary_sensor/zwave.py b/homeassistant/components/binary_sensor/zwave.py index 71c64a017f7..48ef1479eec 100644 --- a/homeassistant/components/binary_sensor/zwave.py +++ b/homeassistant/components/binary_sensor/zwave.py @@ -21,8 +21,6 @@ DEPENDENCIES = [] def get_device(value, **kwargs): """Create zwave entity device.""" - value.set_change_verified(False) - device_mapping = workaround.get_device_mapping(value) if device_mapping == workaround.WORKAROUND_NO_OFF_EVENT: # Default the multiplier to 4 diff --git a/homeassistant/components/climate/zwave.py b/homeassistant/components/climate/zwave.py index a9524729a9f..ad6c89bcea1 100755 --- a/homeassistant/components/climate/zwave.py +++ b/homeassistant/components/climate/zwave.py @@ -36,7 +36,6 @@ DEVICE_MAPPINGS = { def get_device(hass, value, **kwargs): """Create zwave entity device.""" temp_unit = hass.config.units.temperature_unit - value.set_change_verified(False) return ZWaveClimate(value, temp_unit) diff --git a/homeassistant/components/cover/zwave.py b/homeassistant/components/cover/zwave.py index 131ce795d93..aa2cdf858fd 100644 --- a/homeassistant/components/cover/zwave.py +++ b/homeassistant/components/cover/zwave.py @@ -24,14 +24,9 @@ def get_device(value, **kwargs): """Create zwave entity device.""" if (value.command_class == zwave.const.COMMAND_CLASS_SWITCH_MULTILEVEL and value.index == 0): - value.set_change_verified(False) return ZwaveRollershutter(value) elif (value.command_class == zwave.const.COMMAND_CLASS_SWITCH_BINARY or value.command_class == zwave.const.COMMAND_CLASS_BARRIER_OPERATOR): - if (value.type != zwave.const.TYPE_BOOL and - value.genre != zwave.const.GENRE_USER): - return None - value.set_change_verified(False) return ZwaveGarageDoor(value) return None diff --git a/homeassistant/components/light/zwave.py b/homeassistant/components/light/zwave.py index 36ef7eca21d..84aebffab0e 100644 --- a/homeassistant/components/light/zwave.py +++ b/homeassistant/components/light/zwave.py @@ -57,14 +57,6 @@ def get_device(node, value, node_config, **kwargs): _LOGGER.debug('name=%s node_config=%s CONF_REFRESH_VALUE=%s' ' CONF_REFRESH_DELAY=%s', name, node_config, refresh, delay) - if value.command_class != zwave.const.COMMAND_CLASS_SWITCH_MULTILEVEL: - return None - if value.type != zwave.const.TYPE_BYTE: - return None - if value.genre != zwave.const.GENRE_USER: - return None - - value.set_change_verified(False) if node.has_command_class(zwave.const.COMMAND_CLASS_SWITCH_COLOR): return ZwaveColorLight(value, refresh, delay) diff --git a/homeassistant/components/lock/zwave.py b/homeassistant/components/lock/zwave.py index 86ded53bae9..ba1df32130d 100644 --- a/homeassistant/components/lock/zwave.py +++ b/homeassistant/components/lock/zwave.py @@ -175,12 +175,6 @@ def get_device(hass, node, value, **kwargs): _LOGGER.info('Usercode at slot %s is cleared', value.index) break - if value.command_class != zwave.const.COMMAND_CLASS_DOOR_LOCK: - return None - if value.type != zwave.const.TYPE_BOOL: - return None - if value.genre != zwave.const.GENRE_USER: - return None if node.has_command_class(zwave.const.COMMAND_CLASS_USER_CODE): hass.services.register(DOMAIN, SERVICE_SET_USERCODE, @@ -197,7 +191,6 @@ def get_device(hass, node, value, **kwargs): clear_usercode, descriptions.get(SERVICE_CLEAR_USERCODE), schema=CLEAR_USERCODE_SCHEMA) - value.set_change_verified(False) return ZwaveLock(value) diff --git a/homeassistant/components/sensor/zwave.py b/homeassistant/components/sensor/zwave.py index 03f85ddbda4..0d10a470b07 100644 --- a/homeassistant/components/sensor/zwave.py +++ b/homeassistant/components/sensor/zwave.py @@ -17,8 +17,6 @@ _LOGGER = logging.getLogger(__name__) def get_device(node, value, **kwargs): """Create zwave entity device.""" - value.set_change_verified(False) - # Generic Device mappings if node.has_command_class(zwave.const.COMMAND_CLASS_SENSOR_MULTILEVEL): return ZWaveMultilevelSensor(value) diff --git a/homeassistant/components/switch/zwave.py b/homeassistant/components/switch/zwave.py index 9942743d326..a9166c8352f 100644 --- a/homeassistant/components/switch/zwave.py +++ b/homeassistant/components/switch/zwave.py @@ -14,15 +14,8 @@ from homeassistant.components.zwave import async_setup_platform # noqa # pylint _LOGGER = logging.getLogger(__name__) -# pylint: disable=unused-argument -def get_device(node, value, **kwargs): +def get_device(value, **kwargs): """Create zwave entity device.""" - if not node.has_command_class(zwave.const.COMMAND_CLASS_SWITCH_BINARY): - return None - if value.type != zwave.const.TYPE_BOOL or value.genre != \ - zwave.const.GENRE_USER: - return None - value.set_change_verified(False) return ZwaveSwitch(value) diff --git a/homeassistant/components/zwave/__init__.py b/homeassistant/components/zwave/__init__.py index 033cedac705..c18a87710fe 100755 --- a/homeassistant/components/zwave/__init__.py +++ b/homeassistant/components/zwave/__init__.py @@ -706,6 +706,7 @@ class ZWaveDeviceEntity(Entity): from openzwave.network import ZWaveNetwork from pydispatch import dispatcher self._value = value + self._value.set_change_verified(False) self.entity_id = "{}.{}".format(domain, self._object_id()) self._update_attributes()