-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
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
Conversation
return { | ||
ATTR_ATTRIBUTION: CONF_ATTRIBUTION, | ||
} | ||
attrs = { ATTR_ATTRIBUTION: CONF_ATTRIBUTION } |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
Also make sure to update the test |
Ok, this is ready to go, with a boneheadless diff this time. Thanks! |
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.