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

Fix Sonos join/unjoin in scripts #13248

Merged
merged 1 commit into from Mar 15, 2018

Conversation

amelchio
Copy link
Contributor

Description:

Since #12126 the Sonos platform has relied exclusively on push events to determine the grouping of players. That is very clean and works perfectly ... in theory.

In practice, we have scripts that modify a group and start using a single speaker before any event tells us that it is now detached.

This PR sacrifices a bit of the cleanliness because actually working is also nice. We now update the group topology by hand when issuing group modifications. This happens under the existing topology_lock so we never construct any partial groups.

The event handler is still needed because external controllers might also be modifying groups.

Example entry for configuration.yaml (if applicable):

script:
  sonos_say:
    sequence:
      - service: media_player.sonos_snapshot
        data_template:
          entity_id: "{{ sonos_entity }}"
      - service: media_player.sonos_unjoin
        data_template:
          entity_id: "{{ sonos_entity }}"
      - service: tts.google_say
        data_template:
          entity_id: "{{ sonos_entity }}"
          message: "{{ message }}"
      - service: media_player.sonos_restore
        data_template:
          entity_id: "{{ sonos_entity }}"

Checklist:

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

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 added this to the 0.65.6 milestone Mar 15, 2018
@balloob balloob merged commit de1ff1e into home-assistant:dev Mar 15, 2018
balloob pushed a commit that referenced this pull request Mar 21, 2018
@balloob balloob mentioned this pull request Mar 21, 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.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants