Added city/state/country options and fixed several bugs#9436
Merged
Conversation
MartinHjelmare
requested changes
Sep 15, 2017
Member
MartinHjelmare
left a comment
There was a problem hiding this comment.
Looks good. One name change required and one suggestion for simplification.
| ATTR_COUNTRY = 'country' | ||
| ATTR_POLLUTANT_SYMBOL = 'pollutant_symbol' | ||
| ATTR_POLLUTANT_UNIT = 'pollutant_unit' | ||
| ATTR_STATE = 'region' |
Member
There was a problem hiding this comment.
Rename the constant to eg ATTR_REGION.
| _LOGGER('Unable to retrieve data from the API') | ||
| _LOGGER.error("There is likely no data on this location") | ||
| _LOGGER.debug(exc_info) | ||
| self.pollution_info = None |
Member
There was a problem hiding this comment.
You could do self.pollution_info = {} so you don't have to do all the checks above.
MartinHjelmare
requested changes
Sep 15, 2017
| def unit_of_measurement(self): | ||
| """Return the unit the value is expressed in.""" | ||
| return '' | ||
| return 'unit' if self.state == '1' else 'units' |
Member
There was a problem hiding this comment.
Missed this one first pass. I don't think it's wise to change the unit for the same entity. That will mess with 3rd party recorders and be very unpredictable for the users. Just decide on either of these.
Contributor
Author
|
@MartinHjelmare: Made all of your requested changes. Even going with your original unit suggestion. Thanks! |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
Related issue (if applicable): N/A
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#3370
Example entry for
configuration.yaml(if applicable):Checklist:
If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
toxrun successfully. Your PR cannot be merged unless tests pass