-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Update ios.py #7160
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
Update ios.py #7160
Conversation
as discussed. the part: if battery_state == ios.ATTR_BATTERY_STATE_FULL: returning_icon_level = DEFAULT_ICON_LEVEL kinda screws up the charging icon. i might just miss a logical solution for that though. let me know what you think. it might not be beautiful but i think its an overall improve over the current "double battery" solution
@biacz, thanks for your PR! By analyzing the history of the files in this pull request, we identified @robbiet480 and @kellerza to be potential reviewers. |
|
||
def update(self): | ||
"""Get the latest state of the sensor.""" | ||
self._device = ios.devices().get(self._device_name) | ||
self._state = self._device[ios.ATTR_BATTERY][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.
blank line at end of file
blank line contains whitespace
else: | ||
returning_icon = "{}-{}".format(DEFAULT_ICON, | ||
str(rounded_level)) | ||
returning_icon_level = "{}-{}".format(DEFAULT_ICON_LEVEL,str(rounded_level)) |
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.
missing whitespace after ','
line too long (92 > 79 characters)
elif battery_state == ios.ATTR_BATTERY_STATE_CHARGING: | ||
# Why is MDI missing 10, 50, 70? | ||
if rounded_level in (20, 30, 40, 60, 80, 90, 100): | ||
returning_icon = "{}-charging-{}".format(DEFAULT_ICON, | ||
str(rounded_level)) | ||
returning_icon_level = "{}-charging-{}".format(DEFAULT_ICON_LEVEL,str(rounded_level)) |
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.
line too long (101 > 79 characters)
missing whitespace after ','
chound fix and full_battery_charge fix
else: | ||
returning_icon = "{}-{}".format(DEFAULT_ICON, | ||
str(rounded_level)) | ||
returning_icon_level = "{}-{}".format(DEFAULT_ICON_LEVEL, |
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.
trailing whitespace
returning_icon = "{}-charging-{}".format(DEFAULT_ICON, | ||
str(rounded_level)) | ||
returning_icon_level = "{}-charging-{}".format(DEFAULT_ICON_LEVEL, | ||
str(rounded_level)) |
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.
line too long (82 > 79 characters)
elif battery_state == ios.ATTR_BATTERY_STATE_CHARGING: | ||
# Why is MDI missing 10, 50, 70? | ||
if rounded_level in (20, 30, 40, 60, 80, 90, 100): | ||
returning_icon = "{}-charging-{}".format(DEFAULT_ICON, | ||
str(rounded_level)) | ||
returning_icon_level = "{}-charging-{}".format(DEFAULT_ICON_LEVEL, |
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.
line too long (82 > 79 characters)
trailing whitespace
removed new line
|
||
def update(self): | ||
"""Get the latest state of the sensor.""" | ||
self._device = ios.devices().get(self._device_name) | ||
self._state = self._device[ios.ATTR_BATTERY][self.type] | ||
self._state = self._device[ios.ATTR_BATTERY][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.
trailing whitespace
elif battery_state == ios.ATTR_BATTERY_STATE_UNPLUGGED: | ||
if rounded_level < 10: | ||
returning_icon = "{}-outline".format(DEFAULT_ICON) | ||
returning_icon_level = |
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.
trailing whitespace
else: | ||
returning_icon = "{}-charging".format(DEFAULT_ICON) | ||
returning_icon_level = |
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.
trailing whitespace
returning_icon = "{}-charging-{}".format(DEFAULT_ICON, | ||
str(rounded_level)) | ||
returning_icon_level = | ||
"{}-charging-{}".format(DEFAULT_ICON_LEVEL, |
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.
trailing whitespace
elif battery_state == ios.ATTR_BATTERY_STATE_CHARGING: | ||
# Why is MDI missing 10, 50, 70? | ||
if rounded_level in (20, 30, 40, 60, 80, 90, 100): | ||
returning_icon = "{}-charging-{}".format(DEFAULT_ICON, | ||
str(rounded_level)) | ||
returning_icon_level = |
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.
trailing whitespace
SyntaxError: invalid syntax
i hope thats it - thanks @robbiet480 and @kellerza for resolving any additional things. thanks guys. |
elif battery_level == 100: | ||
returning_icon_state = "{}-off".format(DEFAULT_ICON_STATE) | ||
returning_icon_level = "{}-outline".format( | ||
DEFAULT_ICON_LEVEL) | ||
elif battery_level > 95: |
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.
Combine this and the elif battery_level == 100
chain?
DEFAULT_ICON_LEVEL) | ||
returning_icon_state = "{}-off".format(DEFAULT_ICON_STATE) | ||
elif battery_level > 95 | ||
returning_icon_state = "{}-off".format(DEFAULT_ICON_STATE) |
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.
unexpected indentation
returning_icon_level = "{}-outline".format( | ||
DEFAULT_ICON_LEVEL) | ||
returning_icon_state = "{}-off".format(DEFAULT_ICON_STATE) | ||
elif battery_level > 95 |
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.
SyntaxError: invalid syntax
else: | ||
returning_icon = "{}-{}".format(DEFAULT_ICON, | ||
str(rounded_level)) | ||
returning_icon_level = "{}-{}".format(DEFAULT_ICON_LEVEL, |
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.
trailing whitespace
Cherry-picked for 0.43 |
* Update ios.py as discussed. the part: if battery_state == ios.ATTR_BATTERY_STATE_FULL: returning_icon_level = DEFAULT_ICON_LEVEL kinda screws up the charging icon. i might just miss a logical solution for that though. let me know what you think. it might not be beautiful but i think its an overall improve over the current "double battery" solution * Update ios.py chound fix and full_battery_charge fix * Update ios.py removed new line * Update ios.py * Update ios.py * Update ios.py * Update ios.py * Update ios.py * Update ios.py * merged request from robbie * Update ios.py * Update ios.py * Update ios.py
as discussed. the part:
if battery_state == ios.ATTR_BATTERY_STATE_FULL:
returning_icon_level = DEFAULT_ICON_LEVEL
kinda screws up the charging icon.
i might just miss a logical solution for that though.
let me know what you think. it might not be beautiful but i think its an overall improve over the current "double battery" solution
Description:
Related issue (if applicable): fixes #
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.github.io#<home-assistant.github.io PR number goes here>
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:
tox
run successfully. Your PR cannot be merged unless tests passREQUIREMENTS
variable (example).requirements_all.txt
by runningscript/gen_requirements_all.py
..coveragerc
.If the code does not interact with devices:
tox
run successfully. Your PR cannot be merged unless tests pass