Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions homeassistant/components/cover/gogogate2.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
CoverDevice, SUPPORT_OPEN, SUPPORT_CLOSE)
from homeassistant.const import (
CONF_USERNAME, CONF_PASSWORD, STATE_CLOSED,
CONF_IP_ADDRESS, CONF_NAME)
CONF_IP_ADDRESS, CONF_NAME, ATTR_TEMPERATURE)
import homeassistant.helpers.config_validation as cv

REQUIREMENTS = ['pygogogate2==0.0.7']
REQUIREMENTS = ['pygogogate2==0.1.1']

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -70,6 +70,7 @@ def __init__(self, mygogogate2, device, name):
self.device_id = device['door']
self._name = name or device['name']
self._status = device['status']
self._temperature = device['temperature']
self._available = None

@property
Expand All @@ -92,6 +93,13 @@ def supported_features(self):
"""Flag supported features."""
return SUPPORT_OPEN | SUPPORT_CLOSE

@property
def state_attributes(self):
"""Return the state attributes."""
data = super().state_attributes
data[ATTR_TEMPERATURE] = self._temperature

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

undefined name 'ATTR_TEMPERATURE'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should not be added as an attribute but instead be made into it's own sensor. This means that you will need to greate a gogogate2 component to handle the connection and then setup the cover and sensor platforms.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fair enough. For now, I'll update the PR to get the bug fix in and look at adding the component/sensors later.

For additional data points such as battery_level of the garage tilt sensor - should that be added as an attribute of the cover platform or should it be its own sensor too?

return data

@property
def available(self):
"""Could the device be accessed during the last update call."""
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ pyfritzhome==0.3.7
pyfttt==0.3

# homeassistant.components.cover.gogogate2
pygogogate2==0.0.7
pygogogate2==0.1.1

# homeassistant.components.remote.harmony
pyharmony==1.0.20
Expand Down