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 unjoin functionality #2379

Merged
merged 1 commit into from
Jun 30, 2016
Merged

Add Sonos unjoin functionality #2379

merged 1 commit into from
Jun 30, 2016

Conversation

lwis
Copy link
Member

@lwis lwis commented Jun 27, 2016

Description: Additional service to unjoin a Sonos device from a group.

Example entry for configuration.yaml (if applicable):

script:
  group_unpair:
    alias: Group/unpair demo
    sequence:
      - alias: Snapshot Group
        service: media_player.sonos_group_devices
        data:
          entity_id: media_player.lounge
      - alias: Door Bell Play Sound
        service: media_player.play_media
        data:
          entity_id: media_player.lounge
          media_content_id: http://localhost/local/media.mp3
          media_content_type: audio/mp3
      - delay:
          seconds: 6    
      - alias: Snapshot Unpair
        service: media_player.sonos_unpair

Checklist:

If code communicates with devices:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass

@@ -72,8 +73,8 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
add_devices(devices)
_LOGGER.info('Added %s Sonos speakers', len(players))

def group_players_service(service):
"""Group media players, use player as coordinator."""
def _apply_service(service, service_func, *service_func_args):
Copy link
Member

Choose a reason for hiding this comment

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

You can look at the media_player_service_handler in the base media_player module for an alternative way of calling methods of services. It doesn't handle arguments currently though.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd like a better way altogether for handling and registering services, it's not very clear which services are available without digging deep into the implementation in some cases.

Copy link
Member

Choose a reason for hiding this comment

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

That sounds more like a documentation issue

@lwis
Copy link
Member Author

lwis commented Jun 30, 2016

@balloob updated the code in reflection to the comments.

@balloob
Copy link
Member

balloob commented Jun 30, 2016

Looks good! 🐬

@balloob balloob merged commit 21be4c1 into home-assistant:dev Jun 30, 2016
@home-assistant home-assistant locked and limited conversation to collaborators Mar 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants