Skip to content
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

Expose the condition code on condition sensors #14011

Merged
merged 5 commits into from
Apr 21, 2018

Conversation

maddox
Copy link
Contributor

@maddox maddox commented Apr 20, 2018

Description:

This exposes the condition_code on the condition YWeather sensor. The Yahoo Weather condition codes have long been used to map to icons like these great weather icons and these.

Exposing the codes lets other projects like dashboards utilize the codes to use iconography to show conditions with custom icons.

return {
ATTR_ATTRIBUTION: CONF_ATTRIBUTION,
}
attrs = { ATTR_ATTRIBUTION: CONF_ATTRIBUTION }

Choose a reason for hiding this comment

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

whitespace after '{'
whitespace before '}'

}
attrs = {ATTR_ATTRIBUTION: CONF_ATTRIBUTION}

if self._code is None or "weather" in self._type:
Copy link
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
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
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
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.

@syssi syssi changed the title expose the condition code on condition sensors Expose the condition code on condition sensors Apr 20, 2018
@balloob
Copy link
Member

balloob commented Apr 20, 2018

Also make sure to update the test

@maddox
Copy link
Contributor Author

maddox commented Apr 21, 2018

Ok, this is ready to go, with a boneheadless diff this time. Thanks!

@MartinHjelmare MartinHjelmare merged commit f12ff6f into dev Apr 21, 2018
@maddox maddox deleted the expose-condition-code-yweather-sensor branch April 22, 2018 00:51
@balloob balloob mentioned this pull request May 11, 2018
@home-assistant home-assistant locked and limited conversation to collaborators Jul 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants