Skip to content

Commit

Permalink
Implement of BARRIER_OPERATOR for garage door (home-assistant#2712)
Browse files Browse the repository at this point in the history
  • Loading branch information
turbokongen authored Aug 2, 2016
1 parent ab377f1 commit 40d7361
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 5 additions & 4 deletions homeassistant/components/garage_door/zwave.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from homeassistant.components.garage_door import GarageDoorDevice

COMMAND_CLASS_SWITCH_BINARY = 0x25 # 37

COMMAND_CLASS_BARRIER_OPERATOR = 0x66 # 102
_LOGGER = logging.getLogger(__name__)


Expand All @@ -25,7 +25,8 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
node = zwave.NETWORK.nodes[discovery_info[zwave.ATTR_NODE_ID]]
value = node.values[discovery_info[zwave.ATTR_VALUE_ID]]

if value.command_class != zwave.COMMAND_CLASS_SWITCH_BINARY:
if value.command_class != zwave.COMMAND_CLASS_SWITCH_BINARY and \
value.command_class != zwave.COMMAND_CLASS_BARRIER_OPERATOR:
return
if value.type != zwave.TYPE_BOOL:
return
Expand Down Expand Up @@ -62,8 +63,8 @@ def is_closed(self):

def close_door(self):
"""Close the garage door."""
self._value.node.set_switch(self._value.value_id, False)
self._value.data = False

def open_door(self):
"""Open the garage door."""
self._value.node.set_switch(self._value.value_id, True)
self._value.data = True
4 changes: 3 additions & 1 deletion homeassistant/components/zwave.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
COMMAND_CLASS_DOOR_LOCK = 98
COMMAND_CLASS_THERMOSTAT_SETPOINT = 67
COMMAND_CLASS_THERMOSTAT_FAN_MODE = 68
COMMAND_CLASS_BARRIER_OPERATOR = 102
COMMAND_CLASS_BATTERY = 128
COMMAND_CLASS_SENSOR_ALARM = 156

Expand Down Expand Up @@ -173,7 +174,8 @@
[GENERIC_COMMAND_CLASS_ENTRY_CONTROL],
[SPECIFIC_DEVICE_CLASS_SECURE_BARRIER_ADD_ON,
SPECIFIC_DEVICE_CLASS_SECURE_DOOR],
[COMMAND_CLASS_SWITCH_BINARY],
[COMMAND_CLASS_SWITCH_BINARY,
COMMAND_CLASS_BARRIER_OPERATOR],
TYPE_BOOL,
GENRE_USER)
]
Expand Down

0 comments on commit 40d7361

Please sign in to comment.