NUT sensor enhancements#14570
Merged
syssi merged 6 commits intohome-assistant:devfrom May 22, 2018
Merged
Conversation
…dy when connection to nut unavailable; output human-readable state name by default
… raw value of current status in more info dialog
…t used to display a human-readable form of the status
syssi
reviewed
May 21, 2018
| attr = dict() | ||
| attr[ATTR_STATE] = self.opp_state() | ||
| attr[ATTR_STATE] = self.display_state() + " (" + \ | ||
| self._data.status[KEY_STATUS] + ")" |
Member
There was a problem hiding this comment.
Please use format() instead of concats (+)
Contributor
Author
There was a problem hiding this comment.
Sure, makes sense.
syssi
approved these changes
May 21, 2018
2 tasks
syssi
reviewed
May 21, 2018
| """Return the sensor attributes.""" | ||
| attr = dict() | ||
| attr[ATTR_STATE] = self.opp_state() | ||
| attr[ATTR_STATE] = "{} ({})".format(self.display_state(), |
Member
There was a problem hiding this comment.
If you are very accurate this is a breaking change. I would remove the duplicate info here. What do you think?
Contributor
Author
There was a problem hiding this comment.
Yes, you are right. And with the introduction of a separate sensor type for the human-readable status, the additional information in the more info dialogue is probably not necessary anymore.
…man-readable status without the raw value
syssi
approved these changes
May 22, 2018
Contributor
Author
|
Is this still a breaking change now that the more info dialogue output remains untouched? |
Member
|
Oh! You are right. I've removed the tag again. |
Contributor
|
Thank you @exxamalte for this fix! 👍 |
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:
This proposal makes the NUT sensor a bit more user-friendly, and contains the following changes:
ups.status.displaywhich outputs the UPS status in a human-readable form. For example, outputs "Online Battery Charging" instead of "OL CHRG" on the sensor's state card.Change the more info dialog output by appending the raw status value to the human-readable form. Example output: "state . Online Battery Charging (OL CHRG)".PlatformNotReadyto make HA try again after a few seconds.Related issue (if applicable): fixes #14324
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#5411
Example entry for
configuration.yaml(if applicable):Checklist:
tox. Your PR cannot be merged unless tests passIf user exposed functionality or configuration variables are added/changed: