Zwave garagedoor (#2361)

* First go at zwave Garage door

* Refactor of zwave discovery

* Allaround fixes for rollershutter and garage door
This commit is contained in:
John Arild Berentsen 2016-06-24 17:44:24 +02:00 committed by Josh Wright
parent 600a3e3965
commit ec8dc25c9c
3 changed files with 168 additions and 52 deletions

View file

@ -28,7 +28,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
if value.command_class != zwave.COMMAND_CLASS_SWITCH_MULTILEVEL:
return
if value.index != 1:
if value.index != 0:
return
value.set_change_verified(False)
@ -56,26 +56,15 @@ class ZwaveRollershutter(zwave.ZWaveDeviceEntity, RollershutterDevice):
@property
def current_position(self):
"""Return the current position of Zwave roller shutter."""
for value in self._node.get_values(
class_id=COMMAND_CLASS_SWITCH_MULTILEVEL).values():
if value.command_class == 38 and value.index == 0:
return value.data
return self._value.data
def move_up(self, **kwargs):
"""Move the roller shutter up."""
for value in self._node.get_values(
class_id=COMMAND_CLASS_SWITCH_MULTILEVEL).values():
if value.command_class == 38 and value.index == 0:
value.data = 255
break
self._node.set_dimmer(self._value.value_id, 0)
def move_down(self, **kwargs):
"""Move the roller shutter down."""
for value in self._node.get_values(
class_id=COMMAND_CLASS_SWITCH_MULTILEVEL).values():
if value.command_class == 38 and value.index == 0:
value.data = 0
break
self._node.set_dimmer(self._value.value_id, 100)
def stop(self, **kwargs):
"""Stop the roller shutter."""
@ -84,3 +73,4 @@ class ZwaveRollershutter(zwave.ZWaveDeviceEntity, RollershutterDevice):
# Rollershutter will toggle between UP (True), DOWN (False).
# It also stops the shutter if the same value is sent while moving.
value.data = value.data
break