8000 Update ios.py by biacz · Pull Request #7160 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 14 commits into from
Apr 22, 2017
Merged

Update ios.py #7160

merged 14 commits into from
Apr 22, 2017

Conversation

biacz
Copy link
Contributor
@biacz biacz commented Apr 18, 2017

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:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • New dependencies have been added to the REQUIREMENTS variable (example).
  • New dependencies are only imported inside functions that use them (example).
  • New dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

If the code does not interact with devices:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • Tests have been added to verify that the new code works.

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
@mention-bot
Copy link

@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.

@homeassistant
Copy link
Contributor

Hi @biacz,

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!


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]

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))

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))

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
@homeassistant
Copy link
Contributor

Hi @biacz,

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

else:
returning_icon = "{}-{}".format(DEFAULT_ICON,
str(rounded_level))
returning_icon_level = "{}-{}".format(DEFAULT_ICON_LEVEL,

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))

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,

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
@homeassistant
Copy link
Contributor

Hi @biacz,

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!


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]

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 =

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 =

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,

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 =

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

@biacz
Copy link
Contributor Author
biacz commented Apr 18, 2017

i hope thats it - thanks @robbiet480 and @kellerza for resolving any additional things.
i tried to install tox but i am not sure if that makes sense for such a small commit.
going to try to get my head into this for further commits i might do.

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:
Copy link
Member

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)

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

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,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trailing whitespace

@robbiet480 robbiet480 added this to the 0.43 milestone Apr 22, 2017
@balloob balloob merged commit 1194690 into home-assistant:dev Apr 22, 2017
@balloob
Copy link
Member
balloob commented Apr 22, 2017

Cherry-picked for 0.43

balloob pushed a commit that referenced this pull request Apr 22, 2017
* 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
@balloob balloob mentioned this pull request Apr 22, 2017
@balloob balloob mentioned this pull request May 5, 2017
@home-assistant home-assistant locked and limited conversation to collaborators Aug 12, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants
0