Skip to content
Merged
Changes from 1 commit
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
9 changes: 6 additions & 3 deletions homeassistant/components/sensor/yweather.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,12 @@ def entity_picture(self):
@property
def device_state_attributes(self):
"""Return the state attributes."""
return {
ATTR_ATTRIBUTION: CONF_ATTRIBUTION,
}
attrs = { ATTR_ATTRIBUTION: CONF_ATTRIBUTION }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

whitespace after '{'
whitespace before '}'


if self._code is None or "weather" in self._type:

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.

Should the attribute added always (attrs['condition_code'] = None) even if "weather" isn't in self._type?

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.

No. Only the weather condition version of this sensor should have condition code since it doesn’t make much sense for the temp sensor to have it.

This follows the pattern of entity_image

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.

If you want to follow that pattern, you should check for is not None

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.

Yeah, I blew this, copying the pattern for returning None lol. Late night PRs.

I’ll fix it later today. Thanks.

attrs['condition_code'] = self._code

return attrs

def update(self):
"""Get the latest data from Yahoo! and updates the states."""
Expand Down