Skip to content

Update the Russound RNET component to use enhanced Russound.py #9739

Merged
emlove merged 5 commits into
home-assistant:devfrom
altersis:dev
Oct 21, 2017
Merged

Update the Russound RNET component to use enhanced Russound.py #9739
emlove merged 5 commits into
home-assistant:devfrom
altersis:dev

Conversation

@altersis
Copy link
Copy Markdown
Contributor

@altersis altersis commented Oct 7, 2017

Description:

Related issue (if applicable): fixes #9604

Related to issue #6 in the russound rnet component.

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>
No documentation change is necessary

Example entry for configuration.yaml (if applicable): No configuration.yaml changes are necessary

Checklist:

If user exposed functionality or configuration variables are added/changed:

  • Documentation added/updated in home-assistant.github.io -- No new functionality added, only existing functionality has been corrected

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). No new dependencies added.
  • New dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py. No new dependencies added.
  • New files were added to .coveragerc. No new files added.

If the code does not interact with devices: N/A

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

…t reduces network traffic

Refer to issue #6 on the Russound project
… reduce network traffic

PLease see issue #6 on the russound project
Please refer to issue #6 on the Russound rnet project
@homeassistant homeassistant added merging-to-master This PR is merging into the master branch and should probably change the branch to `dev`. platform: media_player.russound_rnet cla-needed labels Oct 7, 2017
@homeassistant
Copy link
Copy Markdown
Contributor

Hi @altersis,

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!

self._source = None

_LOGGER.error("Could not update status for zone %s", self._zone_id)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

blank line contains whitespace

#index = self._russ.get_source('1', self._zone_id)
index = ret[1]
# Possibility exists that user has defined list of all sources.
# If a source is set externally that is beyond the defined list then
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

line too long (80 > 79 characters)

#self._volume = self._russ.get_volume('1', self._zone_id) / 100.0

# Returns 0 based index for source.
#index = self._russ.get_source('1', self._zone_id)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

block comment should start with '# '

self._state = STATE_ON

self._volume = ret[2] * 2 / 100.0
#self._volume = self._russ.get_volume('1', self._zone_id) / 100.0
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

block comment should start with '# '

_LOGGER.debug("ret= %s", ret)
if ret is not None:
_LOGGER.debug("Updating status for zone %s", self._zone_id)
#if self._russ.get_power('1', self._zone_id) == 0:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

block comment should start with '# '

Copy link
Copy Markdown
Contributor Author

@altersis altersis left a comment

Choose a reason for hiding this comment

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

I have changed the code to satisfy Houndbot style observations

@fabaff fabaff changed the base branch from master to dev October 8, 2017 18:17
@fabaff fabaff added Hacktoberfest and removed merging-to-master This PR is merging into the master branch and should probably change the branch to `dev`. labels Oct 8, 2017
@pvizeli
Copy link
Copy Markdown
Member

pvizeli commented Oct 13, 2017

Ping -> Fix travis please

@altersis
Copy link
Copy Markdown
Contributor Author

Can I please ask for your help? I'm not familiar with Travis, and for that reason I do not understand what needs to be fixed... I'll do it gladly, just need to understand what's the problem... thanks!

@altersis
Copy link
Copy Markdown
Contributor Author

altersis commented Oct 19, 2017 via email

@altersis
Copy link
Copy Markdown
Contributor Author

with the help of @armills, I finally got to understand what was missing here. Thanks! what comes next?

Copy link
Copy Markdown
Contributor

@emlove emlove left a comment

Choose a reason for hiding this comment

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

LGTM, but added one small note on code style.

# amount of traffic and speeding up the update process.
ret = self._russ.get_zone_info('1', self._zone_id, 4)
_LOGGER.debug("ret= %s", ret)
if ret is not None:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Preference:
Our preferred style is the pattern shown below. This saves us from having to indent the rest of the function. This will also line up the indentation of the comments below with the code.

if ret is None:
    _LOGGER.error("Could not update status for zone %s", self._zone_id)
    return

_LOGGER.debug("Updating status for zone %s", self._zone_id)
…

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.

Hi @armills , thank you for your feedback. Could it be possible to do the merge like this just for this moment, so that I can concentrate on additional enhancements to the Russound RNET component? Right now this component cannot reconnect if there is a communications error (forcing you to a full Hass restart), and would like to make fixing this my first priority. I will have the update ready in a week from now (including this style change). Do you agree?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yep, that's no problem. Not a blocker to merge. Thanks for the contribution! 🎉

@acambitsis
Copy link
Copy Markdown
Contributor

acambitsis commented Oct 19, 2017

@armills , @andrey-git as an FYI - I have tested this code on my Russound and it works well. @altersis has walked me through the improvements and from my side I am happy.

@emlove emlove merged commit 5df985a into home-assistant:dev Oct 21, 2017
@laf
Copy link
Copy Markdown
Contributor

laf commented Oct 21, 2017

Thanks @altersis, @armills and @acambitsis for this. I've been running this code from the PR for a few days so glad it's now merged in :)

@balloob balloob mentioned this pull request Nov 2, 2017
@home-assistant home-assistant locked and limited conversation to collaborators Mar 3, 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.

Serial access not synchronized/Inefficient status update for Russound RNET devices

8 participants