mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 00:37:13 +00:00
Some zwave cleanup (#6203)
This commit is contained in:
parent
9f04b55572
commit
b27ba9660b
@ -21,8 +21,6 @@ DEPENDENCIES = []
|
|||||||
|
|
||||||
def get_device(value, **kwargs):
|
def get_device(value, **kwargs):
|
||||||
"""Create zwave entity device."""
|
"""Create zwave entity device."""
|
||||||
value.set_change_verified(False)
|
|
||||||
|
|
||||||
device_mapping = workaround.get_device_mapping(value)
|
device_mapping = workaround.get_device_mapping(value)
|
||||||
if device_mapping == workaround.WORKAROUND_NO_OFF_EVENT:
|
if device_mapping == workaround.WORKAROUND_NO_OFF_EVENT:
|
||||||
# Default the multiplier to 4
|
# Default the multiplier to 4
|
||||||
|
@ -36,7 +36,6 @@ DEVICE_MAPPINGS = {
|
|||||||
def get_device(hass, value, **kwargs):
|
def get_device(hass, value, **kwargs):
|
||||||
"""Create zwave entity device."""
|
"""Create zwave entity device."""
|
||||||
temp_unit = hass.config.units.temperature_unit
|
temp_unit = hass.config.units.temperature_unit
|
||||||
value.set_change_verified(False)
|
|
||||||
return ZWaveClimate(value, temp_unit)
|
return ZWaveClimate(value, temp_unit)
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,14 +24,9 @@ def get_device(value, **kwargs):
|
|||||||
"""Create zwave entity device."""
|
"""Create zwave entity device."""
|
||||||
if (value.command_class == zwave.const.COMMAND_CLASS_SWITCH_MULTILEVEL
|
if (value.command_class == zwave.const.COMMAND_CLASS_SWITCH_MULTILEVEL
|
||||||
and value.index == 0):
|
and value.index == 0):
|
||||||
value.set_change_verified(False)
|
|
||||||
return ZwaveRollershutter(value)
|
return ZwaveRollershutter(value)
|
||||||
elif (value.command_class == zwave.const.COMMAND_CLASS_SWITCH_BINARY or
|
elif (value.command_class == zwave.const.COMMAND_CLASS_SWITCH_BINARY or
|
||||||
value.command_class == zwave.const.COMMAND_CLASS_BARRIER_OPERATOR):
|
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 ZwaveGarageDoor(value)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -57,14 +57,6 @@ def get_device(node, value, node_config, **kwargs):
|
|||||||
_LOGGER.debug('name=%s node_config=%s CONF_REFRESH_VALUE=%s'
|
_LOGGER.debug('name=%s node_config=%s CONF_REFRESH_VALUE=%s'
|
||||||
' CONF_REFRESH_DELAY=%s', name, node_config,
|
' CONF_REFRESH_DELAY=%s', name, node_config,
|
||||||
refresh, delay)
|
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):
|
if node.has_command_class(zwave.const.COMMAND_CLASS_SWITCH_COLOR):
|
||||||
return ZwaveColorLight(value, refresh, delay)
|
return ZwaveColorLight(value, refresh, delay)
|
||||||
|
@ -175,12 +175,6 @@ def get_device(hass, node, value, **kwargs):
|
|||||||
_LOGGER.info('Usercode at slot %s is cleared', value.index)
|
_LOGGER.info('Usercode at slot %s is cleared', value.index)
|
||||||
break
|
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):
|
if node.has_command_class(zwave.const.COMMAND_CLASS_USER_CODE):
|
||||||
hass.services.register(DOMAIN,
|
hass.services.register(DOMAIN,
|
||||||
SERVICE_SET_USERCODE,
|
SERVICE_SET_USERCODE,
|
||||||
@ -197,7 +191,6 @@ def get_device(hass, node, value, **kwargs):
|
|||||||
clear_usercode,
|
clear_usercode,
|
||||||
descriptions.get(SERVICE_CLEAR_USERCODE),
|
descriptions.get(SERVICE_CLEAR_USERCODE),
|
||||||
schema=CLEAR_USERCODE_SCHEMA)
|
schema=CLEAR_USERCODE_SCHEMA)
|
||||||
value.set_change_verified(False)
|
|
||||||
return ZwaveLock(value)
|
return ZwaveLock(value)
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,8 +17,6 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
|
|
||||||
def get_device(node, value, **kwargs):
|
def get_device(node, value, **kwargs):
|
||||||
"""Create zwave entity device."""
|
"""Create zwave entity device."""
|
||||||
value.set_change_verified(False)
|
|
||||||
|
|
||||||
# Generic Device mappings
|
# Generic Device mappings
|
||||||
if node.has_command_class(zwave.const.COMMAND_CLASS_SENSOR_MULTILEVEL):
|
if node.has_command_class(zwave.const.COMMAND_CLASS_SENSOR_MULTILEVEL):
|
||||||
return ZWaveMultilevelSensor(value)
|
return ZWaveMultilevelSensor(value)
|
||||||
|
@ -14,15 +14,8 @@ from homeassistant.components.zwave import async_setup_platform # noqa # pylint
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=unused-argument
|
def get_device(value, **kwargs):
|
||||||
def get_device(node, value, **kwargs):
|
|
||||||
"""Create zwave entity device."""
|
"""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)
|
return ZwaveSwitch(value)
|
||||||
|
|
||||||
|
|
||||||
|
@ -706,6 +706,7 @@ class ZWaveDeviceEntity(Entity):
|
|||||||
from openzwave.network import ZWaveNetwork
|
from openzwave.network import ZWaveNetwork
|
||||||
from pydispatch import dispatcher
|
from pydispatch import dispatcher
|
||||||
self._value = value
|
self._value = value
|
||||||
|
self._value.set_change_verified(False)
|
||||||
self.entity_id = "{}.{}".format(domain, self._object_id())
|
self.entity_id = "{}.{}".format(domain, self._object_id())
|
||||||
self._update_attributes()
|
self._update_attributes()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user