8000 Fix COMMAND_CLASS_BARRIER_OPERATOR for dev branch of OpenZwave by firstof9 · Pull Request #8574 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 62 commits into from
Jul 27, 2017
Merged

Fix COMMAND_CLASS_BARRIER_OPERATOR for dev branch of OpenZwave #8574

merged 62 commits into from
Jul 27, 2017

Conversation

firstof9
Copy link
Contributor
@firstof9 firstof9 commented Jul 20, 2017

@mention-bot
Copy link

@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.

@homeassistant
Copy link
Contributor

Hi @firstof9,

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

if self._door_state == "Closed":
return True
else:
return False

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

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

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

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

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)

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)

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

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

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

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)

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

@@ -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"],

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)

@@ -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"],

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)

firstof9 added 2 commits July 27, 2017 10:27
* Added is_opening
* Added is_closing
* Updated test based on changes
* Changed cover_state back to _state
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)

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

@@ -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,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trailing whitespace

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)

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

@@ -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,

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 (

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

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

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

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:

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."""

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

@firstof9
Copy link
Contributor Author

@armills There we go

@turbokongen
Copy link
Contributor

I'm ok with this :) 👍

Copy link
Contributor
@emlove emlove left a 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":
Copy link
Contributor

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.

@emlove emlove merged commit e8ce418 into home-assistant:dev Jul 27, 2017
@balloob balloob mentioned this pull request Jul 29, 2017
@hawk259
Copy link
Contributor
hawk259 commented Jul 29, 2017

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:

value_template: "{{ states.cover.unknown_id014f_unknown_type4744_id3530_barrier_state_label_9_1.attributes.door_state | capitalize() }}"

Any ideas on what that should be changed to now?

< F634 !-- '"` -->

@firstof9
Copy link
Contributor Author

@hawk259 states.cover.unknown_id014f_unknown_type4744_id3530_barrier_state_label_9_1 should now populate to open, opened, closed, closing, stopped, or unknown

dethpickle pushed a commit to dethpickle/home-assistant that referenced this pull request Aug 18, 2017
…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
@firstof9 firstof9 deleted the proper-patch branch September 7, 2017 22:50
@home-assistant home-assistant locked and limited conversation to collaborators Dec 11, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants
0