Zwave rgb fix (#3879)

* _zw098 must be set before update_properties

* Fix problematic zwave color light value matching

See https://community.home-assistant.io/t/color-issues-with-aeotec-zwave-zw098/2830
This commit is contained in:
Adam Mills 2016-10-15 00:17:48 -04:00 committed by Paulus Schoutsen
parent 49b1643ff0
commit 1bf5554017

View File

@ -115,7 +115,6 @@ class ZwaveDimmer(zwave.ZWaveDeviceEntity, Light):
zwave.ZWaveDeviceEntity.__init__(self, value, DOMAIN) zwave.ZWaveDeviceEntity.__init__(self, value, DOMAIN)
self._brightness = None self._brightness = None
self._state = None self._state = None
self.update_properties()
self._alt_delay = None self._alt_delay = None
self._zw098 = None self._zw098 = None
@ -134,6 +133,8 @@ class ZwaveDimmer(zwave.ZWaveDeviceEntity, Light):
" %s", value.parent_id) " %s", value.parent_id)
self._alt_delay = 1 self._alt_delay = 1
self.update_properties()
# Used for value change event handling # Used for value change event handling
self._refreshing = False self._refreshing = False
self._timer = None self._timer = None
@ -222,17 +223,12 @@ class ZwaveColorLight(ZwaveDimmer):
self._rgb = None self._rgb = None
self._ct = None self._ct = None
# Here we attempt to find a zwave color value with the same instance # Currently zwave nodes only exist with one color element per node.
# id as the dimmer value. Currently zwave nodes that change colors
# only include one dimmer and one color command, but this will
# hopefully provide some forward compatibility for new devices that
# have multiple color changing elements.
for value_color in value.node.get_rgbbulbs().values(): for value_color in value.node.get_rgbbulbs().values():
if value.instance == value_color.instance:
self._value_color = value_color self._value_color = value_color
if self._value_color is None: if self._value_color is None:
raise ValueError("No matching color command found.") raise ValueError("No color command found.")
for value_color_channels in value.node.get_values( for value_color_channels in value.node.get_values(
class_id=zwave.const.COMMAND_CLASS_SWITCH_COLOR, class_id=zwave.const.COMMAND_CLASS_SWITCH_COLOR,