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

Add Sonos device attribute with grouping information #13553

Merged
merged 2 commits into from
Apr 25, 2018

Conversation

amelchio
Copy link
Contributor

@amelchio amelchio commented Mar 30, 2018

Description:

This PR replaces the Sonos is_coordinator boolean attribute with a more useful attribute sonos_group that reveals the actual speaker group arrangement.

Related issue (if applicable): suggested in forum

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>

BREAKING CHANGE NOTE: The media_player.sonos attribute is_coordinator has been removed; the new attribute sonos_group (listing all group members, coordinator first) can be used instead.

Example template:

This will list the players that used to have is_coordinator == True:

{% for player in states.media_player -%}
{% if player.attributes.sonos_group | first == player.entity_id -%}
{{ player.entity_id }}
{% endif -%}
{% endfor -%}

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox.

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

If the code communicates with devices, web services, or third-party tools:

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

@amelchio amelchio changed the title Add Sonos device attributes with grouping information WIP: Add Sonos device attributes with grouping information Mar 30, 2018
@amelchio amelchio force-pushed the sonos-group-attributes branch from 198bcbd to 1503ad1 Compare March 31, 2018 15:06
@amelchio amelchio changed the title WIP: Add Sonos device attributes with grouping information Add Sonos device attributes with grouping information Apr 6, 2018
@amelchio amelchio changed the title Add Sonos device attributes with grouping information Add Sonos device attribute with grouping information Apr 6, 2018
@pvizeli
Copy link
Member

pvizeli commented Apr 17, 2018

I think we should implement the group/snapshot feature on core to generalize the handling

@amelchio
Copy link
Contributor Author

Okay ... and what do you think about this PR? 😃

@balloob
Copy link
Member

balloob commented Apr 20, 2018

So I'm fine with storing this in the state machine. I am a bit confused as to why we would make it more difficult to find who is the coordinator? Isn't it that we can only send commands to the coordinator?

@amelchio
Copy link
Contributor Author

Sending commands to slaves works without this, the platform will redirect the command to the coordinator.

The attribute in this PR was hashed out in this forum thread after the original solution with is_coordinator turned out to not provide enough information for the intended use (building a UI for groups).

I think it is okay to be a bit verbose because it is not used much.

@amelchio amelchio merged commit 241a079 into home-assistant:dev Apr 25, 2018
bachya pushed a commit to bachya/home-assistant that referenced this pull request Apr 26, 2018
…13553)

Moves RainMachine to component/hub model

Updated requirements

Updated coverage

Hound violations
@balloob balloob mentioned this pull request May 11, 2018
@home-assistant home-assistant locked and limited conversation to collaborators Jul 26, 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