Skip to content
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

New media_player platform for Russound devices using the RIO protocol #8448

Merged
merged 5 commits into from Jul 31, 2017

Conversation

Projects
None yet
7 participants
@wickerwaka
Copy link
Contributor

commented Jul 12, 2017

media_player platform for Russound devices using the RIO protocol

Auto discovers zones and sources
Handles media metadata from sources that support it
asyncio implementation
Push updates for any zone or source changes so no polling required.

Example entry for configuration.yaml (if applicable):

media_player:
  platform: russound_rio
  host: 192.168.105.116
  name: Russound

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][ex-requir]).
  • New dependencies are only imported inside functions that use them ([example][ex-import]).
  • New dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.
New media_player platform for Russound devices using the RIO protocol
Auto discovers zones and sources
Handles media metadata from sources that support it
asyncio implementation
Push updates for any zone or source changes so no polling required.
@mention-bot

This comment has been minimized.

Copy link

commented Jul 12, 2017

@wickerwaka, thanks for your PR! By analyzing the history of the files in this pull request, we identified @balloob, @fabaff and @robbiet480 to be potential reviewers.

@homeassistant

This comment has been minimized.

Copy link

commented Jul 13, 2017

Hello @wickerwaka,

When attempting to inspect the commits of your pull request for CLA signature status among all authors we encountered commit(s) which were not linked to a GitHub account, thus not allowing us to determine their status(es).

The commits that are missing a linked GitHub account are the following:

Unfortunately, we are unable to accept this pull request until this situation is corrected.

Here are your options:

  1. If you had an email address set for the commit that simply wasn't linked to your GitHub account you can link that email now and it will retroactively apply to your commits. The simplest way to do this is to click the link to one of the above commits and look for a blue question mark in a blue circle in the top left. Hovering over that bubble will show you what email address you used. Clicking on that button will take you to your email address settings on GitHub. Just add the email address on that page and you're all set. GitHub has more information about this option in their help center.

  2. If you didn't use an email address at all, it was an invalid email, or it's one you can't link to your GitHub, you will need to change the authorship information of the commit and your global Git settings so this doesn't happen again going forward. GitHub provides some great instructions on how to change your authorship information in their help center.

    • If you only made a single commit you should be able to run
      git commit --amend --author="Author Name <email@address.com>"
      
      (substituting Author Name and email@address.com for your actual information) to set the authorship information.
    • If you made more than one commit and the commit with the missing authorship information is not the most recent one you have two options:
      1. You can re-create all commits missing authorship information. This is going to be the easiest solution for developers that aren't extremely confident in their Git and command line skills.
      2. You can use this script that GitHub provides to rewrite history. Please note: this should be used only if you are very confident in your abilities and understand its impacts.
    • Whichever method you choose, I will come by to re-check the pull request once you push the fixes to this branch.

We apologize for this inconvenience, especially since it usually bites new contributors to Home Assistant. We hope you understand the need for us to protect ourselves and the great community we all have built legally. The best thing to come out of this is that you only need to fix this once and it benefits the entire Home Assistant and GitHub community.

Thanks, I look forward to checking this PR again soon! ❤️

@homeassistant

This comment has been minimized.

Copy link

commented Jul 13, 2017

Hello @wickerwaka,

When attempting to inspect the commits of your pull request for CLA signature status among all authors we encountered commit(s) which were not linked to a GitHub account, thus not allowing us to determine their status(es).

The commits that are missing a linked GitHub account are the following:

Unfortunately, we are unable to accept this pull request until this situation is corrected.

Here are your options:

  1. If you had an email address set for the commit that simply wasn't linked to your GitHub account you can link that email now and it will retroactively apply to your commits. The simplest way to do this is to click the link to one of the above commits and look for a blue question mark in a blue circle in the top left. Hovering over that bubble will show you what email address you used. Clicking on that button will take you to your email address settings on GitHub. Just add the email address on that page and you're all set. GitHub has more information about this option in their help center.

  2. If you didn't use an email address at all, it was an invalid email, or it's one you can't link to your GitHub, you will need to change the authorship information of the commit and your global Git settings so this doesn't happen again going forward. GitHub provides some great instructions on how to change your authorship information in their help center.

    • If you only made a single commit you should be able to run
      git commit --amend --author="Author Name <email@address.com>"
      
      (substituting Author Name and email@address.com for your actual information) to set the authorship information.
    • If you made more than one commit and the commit with the missing authorship information is not the most recent one you have two options:
      1. You can re-create all commits missing authorship information. This is going to be the easiest solution for developers that aren't extremely confident in their Git and command line skills.
      2. You can use this script that GitHub provides to rewrite history. Please note: this should be used only if you are very confident in your abilities and understand its impacts.
    • Whichever method you choose, I will come by to re-check the pull request once you push the fixes to this branch.

We apologize for this inconvenience, especially since it usually bites new contributors to Home Assistant. We hope you understand the need for us to protect ourselves and the great community we all have built legally. The best thing to come out of this is that you only need to fix this once and it benefits the entire Home Assistant and GitHub community.

Thanks, I look forward to checking this PR again soon! ❤️

@Landrash

This comment has been minimized.

Copy link
Contributor

commented Jul 13, 2017

@wickerwaka

This comment has been minimized.

Copy link
Contributor Author

commented Jul 14, 2017

I resolved the CLA issue with this PR, but it doesn't look like the bot removed the label.

@joshlawless

This comment has been minimized.

Copy link

commented Jul 22, 2017

Oh, this is good news. Can't wait to try this out!

Each zone is added as a separate media player device. If the source that the
zone is assigned to is capable of sending metadata such as artist/album name
then this data will be reported back via the media_* properties.
"""

This comment has been minimized.

Copy link
@pvizeli

pvizeli Jul 27, 2017

Member

Please look to other component/platform how that comments need to be.

if host is None or port is None:
_LOGGER.error("Invalid config. Expected %s and %s",
CONF_HOST, CONF_PORT)
return False

This comment has been minimized.

Copy link
@pvizeli

pvizeli Jul 27, 2017

Member

Remove this, we do that on PLATFORM_SCHEMA

except CommandException:
break
if name != '':
sources.append((source_id, name))

This comment has been minimized.

Copy link
@pvizeli

pvizeli Jul 27, 2017

Member

Move that into try block. Better would be if you API can get a list of exists source instead to trow 16 exceptions for that.

else:
return None

def __init__(self, russ, zone_id, name, sources):

This comment has been minimized.

Copy link
@pvizeli

pvizeli Jul 27, 2017

Member

please move init function on top of class

self._zone_id = zone_id
self._sources = sources
self._russ.add_zone_callback(self._zone_callback_handler)
self._russ.add_source_callback(self._source_callback_handler)

This comment has been minimized.

Copy link
@pvizeli

pvizeli Jul 27, 2017

Member

Move callback handling into async_added_to_hass Interface function

@asyncio.coroutine
def async_turn_off(self):
"""Turn off the zone."""
yield from self._russ.send_zone_event(self._zone_id,

This comment has been minimized.

Copy link
@pvizeli

pvizeli Jul 27, 2017

Member

remove the @asyncio.coroutine and return a coroutine

@asyncio.coroutine
def async_turn_on(self):
"""Turn on the zone."""
yield from self._russ.send_zone_event(self._zone_id,

This comment has been minimized.

Copy link
@pvizeli

pvizeli Jul 27, 2017

Member

remove the @asyncio.coroutine and return a coroutine

def async_set_volume_level(self, volume):
"""Set the volume level."""
rvol = int(volume * 50.0)
yield from self._russ.send_zone_event(self._zone_id,

This comment has been minimized.

Copy link
@pvizeli

pvizeli Jul 27, 2017

Member

remove the @asyncio.coroutine and return a coroutine

for source_id, name in self._sources:
if name.lower() != source.lower():
continue
yield from self._russ.send_zone_event(

This comment has been minimized.

Copy link
@pvizeli

pvizeli Jul 27, 2017

Member

remove the @asyncio.coroutine and return a coroutine

return None
return value
else:
return None

This comment has been minimized.

Copy link
@pvizeli

pvizeli Jul 27, 2017

Member

make that cleaner with if xy in (None, "", "---"):

wickerwaka added some commits Jul 28, 2017

Addressing PR feedback
Updated russound_rio dependency to 0.1.3
Use enumerate_zones and enumerate_sources methods instead of doing it in
the platform.
Register callbacks in async_added_to_hass coroutine
Corrected behavior of async methods

@pvizeli pvizeli merged commit 164e953 into home-assistant:dev Jul 31, 2017

4 checks passed

cla-bot Everyone involved has signed the CLA
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.04%) to 93.643%
Details
hound No violations found. Woof!

@wickerwaka wickerwaka deleted the wickerwaka:russound_rio branch Aug 1, 2017

@fabaff fabaff referenced this pull request Aug 12, 2017

Merged

0.51 #8919

dethpickle added a commit to dethpickle/home-assistant that referenced this pull request Aug 18, 2017

New media_player platform for Russound devices using the RIO protocol (
…home-assistant#8448)

* New media_player platform for Russound devices using the RIO protocol
Auto discovers zones and sources
Handles media metadata from sources that support it
asyncio implementation
Push updates for any zone or source changes so no polling required.

* Fixed up linting issues

* Addressing PR feedback

Updated russound_rio dependency to 0.1.3
Use enumerate_zones and enumerate_sources methods instead of doing it in
the platform.
Register callbacks in async_added_to_hass coroutine
Corrected behavior of async methods

@home-assistant home-assistant locked and limited conversation to collaborators Dec 11, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.