Skip to content

BMW code cleanup#14424

Merged
syssi merged 3 commits intohome-assistant:devfrom
gerard33:bmw-cleanup
May 15, 2018
Merged

BMW code cleanup#14424
syssi merged 3 commits intohome-assistant:devfrom
gerard33:bmw-cleanup

Conversation

@gerard33
Copy link
Copy Markdown
Contributor

Description:

As suggested by @MartinHjelmare in #14293 some cleanups in the if...elif trails are made.

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass

elif self._attribute == 'charging_status':
return 'mdi:battery-charging'
elif self._attribute == 'charging_level_hv':
for key, value in ATTR_TO_HA.items():
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

if self._attribute == 'charging_level_hv':
    return icon_for_battery_level(...)
icon, _ = ATTR_TO_HA.get(self._attribute, [None, None])
return icon

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

return 'h'
elif self._attribute == 'charging_level_hv':
return '%'
for key, value in ATTR_TO_HA.items():
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Similar as above.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

'CONNECTED')

def _format_cbs_report(self, report):
result = dict()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

result = {}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

@gerard33 gerard33 changed the title BMW cleanup BMW code cleanup May 13, 2018
Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Looks good! Can be merged when build passes.

Copy link
Copy Markdown
Member

@syssi syssi left a comment

Choose a reason for hiding this comment

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

Nice!

@syssi syssi merged commit 2e7b5dc into home-assistant:dev May 15, 2018
@gerard33 gerard33 deleted the bmw-cleanup branch May 19, 2018 08:56
@balloob balloob mentioned this pull request May 28, 2018
@gerard33 gerard33 mentioned this pull request May 28, 2018
2 tasks
girlpunk pushed a commit to girlpunk/home-assistant that referenced this pull request Sep 4, 2018
* Some cleanup for BMW sensors

* Changed dict sort

* Updates based on review and Travis
@home-assistant home-assistant locked and limited conversation to collaborators Sep 5, 2018
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.

4 participants