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.
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.
Should the attribute added always (attrs['condition_code'] = None) even if "weather" isn't in self._type?
There was a problem hiding this comment.
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.
If you want to follow that pattern, you should check for is not None
There was a problem hiding this comment.
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_codeon 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.