-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Fix COMMAND_CLASS_BARRIER 8000 _OPERATOR for dev branch of OpenZwave #8574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Update zwave.py to work with updated OpenZwave library
Update to fix garage door support for latest version of openzwavelib
Update to cover.zwave to provide list of states based on dev version of openzwave lib
Variable Update and properties added
@firstof9, thanks for your PR! By analyzing the history of the files in this pull request, we identified @fabaff, @turbokongen and @balloob to be potential reviewers. |
if self._door_state == "Closed": | ||
return True | ||
else: | ||
return False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation is not a multiple of four
@property | ||
def is_closed(self): | ||
"""Return the current position of Zwave garage door.""" | ||
return not self._state | ||
if self._door_state == "Closed": | ||
return True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation is not a multiple of four
def door_state_list(self): | ||
"""Return the list of door states.""" | ||
return self._door_state_list | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation contains tabs
indentation contains mixed spaces and tabs
blank line contains whitespace
"""Return the current door state.""" | ||
return self._door_state | ||
|
||
@property |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation contains mixed spaces and tabs
def door_state(self): | ||
"""Return the current door state.""" | ||
return self._door_state | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation contains tabs
indentation contains mixed spaces and tabs
blank line contains whitespace
door_state_list = self.values.primary.data_items | ||
if door_state_list: | ||
self._door_state_list = list(door_state_list) | ||
_LOGGER.debug("self._door_state_list=%s",self._door_state_list) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing whitespace after ','
self._door_state = self.values.primary.data | ||
door_state_list = self.values.primary.data_items | ||
if door_state_list: | ||
self._door_state_list = list(door_state_list) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation is not a multiple of four
self._state = self.values.primary.data | ||
|
||
self._door_state = self.values.primary.data | ||
door_state_list = self.values.primary.data_items |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
multiple spaces after operator
@@ -244,6 +246,13 @@ def state_attributes(self): | |||
current_tilt = self.current_cover_tilt_position | |||
if current_tilt is not None: | |||
data[ATTR_CURRENT_TILT_POSITION] = self.current_cover_tilt_position | |||
|
|||
door_state = self.door_state |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation contains mixed spaces and tabs
@@ -244,6 +246,13 @@ def state_attributes(self): | |||
current_tilt = self.current_cover_tilt_position | |||
if current_tilt is not None: | |||
data[ATTR_CURRENT_TILT_POSITION] = self.current_cover_tilt_position | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation contains tabs
indentation contains mixed spaces and tabs
blank line contains whitespace
self._door_state = self.values.primary.data | ||
door_state_list = self.values.primary.data_items | ||
if door_state_list: | ||
self._door_state_list = list(door_state_list) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation is not a multiple of four
tests/components/cover/test_zwave.py
Outdated
@@ -178,14 +178,14 @@ def test_garage_value_changed(hass, mock_openzwave): | |||
def test_garage_commands(hass, mock_openzwave): | |||
"""Test position changed.""" | |||
node = MockNode() | |||
value = MockValue(data=False, node=node, | |||
value = MockValue(data="Opened", node=node, data_items=["Opened","Closed","Closing","Opening","Unknown"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing whitespace after ','
line too long (109 > 79 characters)
tests/components/cover/test_zwave.py
Outdated
@@ -161,15 +161,15 @@ def test_roller_reverse_open_close(hass, mock_openzwave): | |||
def test_garage_value_changed(hass, mock_openzwave): | |||
"""Test position changed.""" | |||
node = MockNode() | |||
value = MockValue(data=False, node=node, | |||
value = MockValue(data="Opened", node=node, data_items=["Opened","Closed","Closing","Opening","Unknown"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing whitespace after ','
line too long (109 > 79 characters)
* Added is_opening * Added is_closing * Updated test based on changes
* Changed cover_state back to _state
tests/components/cover/test_zwave.py
Outdated
value = MockValue(data=False, node=node, | ||
command_class=const.COMMAND_CLASS_BARRIER_OPERATOR) | ||
value = MockValue(data="Closed", node=node, | ||
command_class=const.COMMAND_CLASS_BARRIER_OPERATOR) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
continuation line over-indented for visual indent
tests/components/cover/test_zwave.py
Outdated
@@ -178,14 +177,14 @@ def test_garage_value_changed(hass, mock_openzwave): | |||
def test_garage_commands(hass, mock_openzwave): | |||
"""Test position changed.""" | |||
node = MockNode() | |||
value = MockValue(data=False, node=node, | |||
command_class=const.COMMAND_CLASS_BARRIER_OPERATOR) | |||
value = MockValue(data="Closed", node=node, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trailing whitespace
tests/components/cover/test_zwave.py
Outdated
value = MockValue(data=False, node=node, | ||
command_class=const.COMMAND_CLASS_BARRIER_OPERATOR) | ||
value = MockValue(data="Closed", node=node, | ||
command_class=const.COMMAND_CLASS_BARRIER_OPERATOR) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
continuation line over-indented for visual indent
tests/components/cover/test_zwave.py
Outdated
@@ -161,15 +161,14 @@ def test_roller_reverse_open_close(hass, mock_openzwave): | |||
def test_garage_value_changed(hass, mock_openzwave): | |||
"""Test position changed.""" | |||
node = MockNode() | |||
value = MockValue(data=False, node=node, | |||
command_class=const.COMMAND_CLASS_BARRIER_OPERATOR) | |||
value = MockValue(data="Closed", node=node, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trailing whitespace
@@ -14,12 +14,14 @@ | |||
from homeassistant.components.zwave import async_setup_platform # noqa # pylint: disable=unused-import | |||
from homeassistant.components.zwave import workaround | |||
from homeassistant.components.cover import CoverDevice | |||
from homeassistant.const import ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'homeassistant.const.STATE_OPEN' imported but unused
'homeassistant.const.STATE_CLOSED' imported but unused
'homeassistant.const.STATE_CLOSING' imported but unused
'homeassistant.const.STATE_OPENING' imported but unused
'homeassistant.const.STATE_STOPPED' imported but unused
'homeassistant.const.STATE_UNKNOWN' imported but unused
return STATE_OPENING | ||
if self.is_closing: | ||
return STATE_CLOSING | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation contains tabs
indentation contains mixed spaces and tabs
blank line contains whitespace
if self.is_opening: | ||
return STATE_OPENING | ||
if self.is_closing: | ||
return STATE_CLOSING |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
undefined name 'STATE_CLOSING'
@@ -225,6 +225,12 @@ def current_cover_tilt_position(self): | |||
@property | |||
def state(self): | |||
"""Return the state of the cover.""" | |||
|
|||
if self.is_opening: | |||
return STATE_OPENING |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
undefined name 'STATE_OPENING'
@@ -225,6 +225,12 @@ def current_cover_tilt_position(self): | |||
@property | |||
def state(self): | |||
"""Return the state of the cover.""" | |||
|
|||
if self.is_opening: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation contains mixed spaces and tabs
@@ -225,6 +225,12 @@ def current_cover_tilt_position(self): | |||
@property | |||
def state(self): | |||
"""Return the state of the cover.""" | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation contains tabs
indentation contains mixed spaces and tabs
blank line contains whitespace
@armills There we go |
I'm ok with this :) 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job! This is nice and tidy. One small tweak then good to merge.
@property | ||
def is_opening(self): | ||
"""Return true if cover is in an opening state.""" | ||
if self._state == "Opening": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nitpick, here we can just write
return self._state == "Opening"
since the equality operator already returns a boolean. Same for the others.
Great work @firstof9! Code is working great! With this change I need to update one of my template sensors that would display the doors state:
Any ideas on what that should be changed to now? |
@hawk259 states.cover.unknown_id014f_unknown_type4744_id3530_barrier_state_label_9_1 should now populate to open, opened, closed, closing, stopped, or unknown |
…assistant#8574) * Update zwave.py to work with updated OpenZwave library Update zwave.py to work with updated OpenZwave library * Update zwave.py * Update zwave.py * Update to fix garage door openers Update to fix garage door support for latest version of openzwavelib * Update to cover.zwave list of states Update to cover.zwave to provide list of states based on dev version of openzwave lib * Some values not saved * Formatting fix * Formatting fix * Variable typo * Formatting fix * Formatting * Variable Update Variable Update and properties added * Formatting fixes * Formatting Fix * Update test case for door states * Formatting / Testing process fix * Formatting * Formatting / Test Fixes * Variable rename * Added members to CoverDevice * Removed un-needed else * Formatting * Formatting * Variable name changes and const updates * Changed variable names to cover_state * Added constains into const.py * Updated to change the main state on the cover device * Fixes * Formatting fixes * Formatting/Variables * Formatting * Variable fixes * Import update * Formatting / Variables * Update test for new states * Revert state changes * Test fix * Variable Fix * Formatting * Variable typo * Missing constant * Variable fix * Requested changes * Added is_opening * Added is_closing * Updated test based on changes * Formatting * Changed cover_state back to _state * Formatting and variable fixes * Test fixes * Formatting and variable touchup * Formatting * Optimizations * Add new cover features to demo * Add tests for demo cover closing/opening * Remove unused STATE_STOPPED * Add tests for new zwave cover values
Fix for issue Zwave Cover not working with Garage Door opener #8323
Handles updates to dev branch of OpenZwave to operate and monitor the status of garage door openers
Updates list of door states: Opened, Opening, Closed, Closing, Stopped, Unknown