Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
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}

if self._code is not None and "weather" in self._type:
attrs['condition_code'] = self._code

return attrs

def update(self):
"""Get the latest data from Yahoo! and updates the states."""
Expand Down
2 changes: 2 additions & 0 deletions tests/components/sensor/test_yweather.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ def test_setup_all(self, mock_yahooweather):
state = self.hass.states.get('sensor.yweather_condition')
assert state is not None
self.assertEqual(state.state, 'Mostly Cloudy')
self.assertEqual(state.attributes.get('condition_code'),
'28')
self.assertEqual(state.attributes.get('friendly_name'),
'Yweather Condition')

Expand Down