Sonos icon

Sonos

Control your Sonos system.

Overview

The Sonos n8n node allows you to control your Sonos audio system through various actions such as playing music, controlling playback, adjusting volume, and managing home theater options. This node is useful for automating smart home scenarios, integrating Sonos with other services, or building custom workflows that require audio feedback or media control.

Common Scenarios:

  • Automate music playback in response to events (e.g., play a favorite playlist when you arrive home).
  • Play specific audio clips for notifications or alarms.
  • Control group volume or playback across multiple Sonos devices.
  • Integrate Sonos controls into larger automation flows (e.g., pause music during meetings).

Practical Examples:

  • Play a sound file on a specific player when a new order is received.
  • Group all players and start a party playlist automatically.
  • Set TV power state or adjust home theater settings via workflow triggers.

Properties

Name Type Meaning
Household options The Sonos household to control. Required for all actions.
Action options The operation to perform (e.g., Play, Pause, Play Audio Clip, etc.).
Player options The specific Sonos player to target. Required for certain actions (e.g., Play Audio Clip).
Favorite options The Sonos favorite to play. Required for the "Play Favorite" action.
Shuffe boolean Whether to shuffle playback. Used with "Play Favorite".
Repeat boolean Whether to repeat playback. Used with "Play Favorite".
Crossfade boolean Whether to enable crossfade between tracks. Used with "Play Favorite".
Volume number The volume level (1–100). Used with "Play Audio Clip" and "Set Group Volume".
Soundfile string URL of the audio file to play. Used with "Play Audio Clip".
Night Mode boolean Enable night mode for home theater. Used with "Set Home Theater Options".
Enhance Dialog boolean Enhance dialog for home theater. Used with "Set Home Theater Options".
Power State boolean Set TV power state. Used with "Set TV Power State".

Output

  • The node outputs a JSON array with one object per execution.
  • On success:
    [
      {
        "message": "ok"
      }
    ]
    
  • On error (if "Continue On Fail" is enabled):
    [
      {
        "error": "<error message>"
      }
    ]
    

Note: The node does not output binary data.


Dependencies

  • External Service: Requires access to a Sonos system.
  • API Credentials: Needs valid Sonos OAuth2 API credentials configured in n8n (sonosOAuth2Api).
  • n8n Configuration: Ensure the Sonos credential is set up in your n8n instance.

Troubleshooting

Common Issues:

  • Missing Credentials:
    Error: No credentials got returned!
    Resolution: Make sure the Sonos OAuth2 API credentials are properly configured in n8n.

  • Unknown Method:
    Error: Unknown method or not implemented
    Resolution: Check that the selected action is supported by the node.

  • Invalid Parameters:
    If required fields (like Household, Player, or Favorite) are missing for the chosen action, the node may fail.
    Resolution: Ensure all required properties for the selected action are provided.

  • Sonos API Errors:
    Any issues communicating with the Sonos API (e.g., network errors, invalid tokens) will result in an error message in the output if "Continue On Fail" is enabled.


Links and References

Discussion