-
-
Notifications
You must be signed in to change notification settings - Fork 14
Home
Beneath my personal use case and motivation to create this package is shown. Left hand side is based on Home Assistant dashboard (new), right hand side on Node-RED dashboard (not anymore in use).
node-red-contrib-sonos-plus
is a set of Node-RED nodes to control SONOS-Player in your local network.
Works well with Home Assistant.
Important: This package is in no way connected to or supported by Sonos Inc.
Highlights
-
Play your track, album, playlist, station from Spotify, Napster, Amazon, Deezer and other music content provider.
-
My Sonos, Music Library (NAS shares), SONOS-Playlists and SONOS-Queue are supported.
-
Control your player: play, stop, pause - modify the SONOS-Queue.
-
Change player setting such as volume, mute state, alarms, loudness, treble, bass, the LED and more.
-
Group players by using their SONOS-Playernames
-
Group commands automatically address the coordinator in that group
-
DNS names are supported in config node (ipv4 address should still work)
Have a look at the examples provided with this package: Node-RED menu, import, examples, node-red-contrib-sonos-plus, 00 quickstart
The preferred option is to enter the DNS name of your SONOS-Player. Alternatively you can enter the ipv4 address. For your convenience there is a search button to search in your local network for available SONOS-Player (ports must be open) and select one. If not using DNS names it is highly recommended to use static ip addresses to avoid player discovery during flow deployment/restart what means less resources, faster and higher stability.
Further information: Config node
This packages treats stand alone SONOS-Player and grouped SONOS_Player in a similar way. That means you can use all group commands on a groups but also on stand alone SONOS-Player. Group commands are automatically send to the coordinator in that group.
Commands such group.play
, group.play.track
, group.get.playbackstate
, mysonos.export.item
can be selected in the node dialog (field Commands) or provided in the incoming msg.
States such as on, off, URI, SONOS_Playername … can be entered in the node dialog (field State) or provided in the incoming message.
For incoming messages:
-
msg.topic
holds the command -
msg.payload
holds the "state/message" like on/off, uri, …
Further information about Universal node or My Sonos node
-
Wire an inject node together with universal node and a debug node.
-
Open the universal node and
-
Edit field config node
-
Name: Give a speaking name to the config node - here 'your_player_dns'
-
Player address: Enter a DNS name or ipv4 address (you can push the search button to select from list)
-
Add the config node (Add button)
-
As Topic select 'household.get.groups
-
Wire an inject node together with universal node.
-
Open the universal node and
-
Select the config node from above example (your_player_dns)
-
As Topic select 'group.play.tunein'
-
As payload enter 's24896' - Done!
Note
|
Since 2022 there is a strong link between TuneIn Service and SONOS Radio. When playing a TuneIn station the service shown is "SONOS Radio" and when playing a SONOS Radio station very often the TuneIn ad is being played. |
-
Wire an inject node together with universal node.
-
Open the universal node and
-
Select the config node from above example (your_player_dns)
-
As topic select 'group.play.queue'
Keep in mind that The SONOS-Queue is being used for album, playlists, multiple tracks but usually not for stations. Stations are streams.
Assuming you own 3 SONOS-Player named "SonosKueche", "SonosBad" and "SonosWohnzimmer" and the config node "your_player_dns" is one of them. You can group them all with "SonosKueche" as coordinator with the following flow.
-
Wire an inject node together with universal node.
-
Open the universal node and
-
Select the config node from above example (your_player_dns)
-
As topic select household.create.group
-
As payload use the real SONOS-Playernames (look up in your SONOS-App) - here SonosKueche,SonosWohnzimmer,SonosBad
Please notice: There is no blank after the comma! It is recommended to use only standard chars (digits, letter, - blank).
Assuming that your Music Library is already set up and available at your SONOS-App.
-
Wire an inject node together with universal node.
-
Open the universal node and
-
Select the config node from above example (your_player_dns)
-
As topic select group.play.library.artist
-
As payload enter a valid artist name in your SONOS-Music-Library
-
Read the SONOS Concept to understand:
-
That group.* commands are automatically send to the group coordinator
-
The difference between the SONOS-Queue and stations (streaming).
-
The advantages to use "My Sonos" (stations, playlists, albums, songs)
-
The differences between a SONOS-Player DNS name, ipv4 address, SONOS-Playername and configuration node name
-
-
Use DNS names in the configuration node and or at least assign a static ip address (at your router) to your SONOS-Player
-
Use the SONOS-App and "store" your music (playlists, album, tracks, …) in My Sonos. That enables you to easily activate and use them. It works for many _Music Service_s (Spotify, Napster, TuneIn, Apple, …)
-
Use the standard "catch node" to catch all errors and warnings and get notified e. g. via email
-
In case of any error set log level to "debug" in settings.js to get more detailed information
-
If you use a lot of universal/mysonos nodes you should use the "Don NOT check the availability of SONOS player" - that reduces interaction with the SONOS-Player during flow deployment.
Idiom | Meaning |
---|---|
SONOS-Playername |
The SONOS-Playername being shown in the app, e. g. Küche. Don’t Mix it up with the SONOS config node name. |
SONOS-Queue |
The one and only (per player) SONOS queue. |
SONOS-Playlist |
A playlist, created inside the SONOS system. Is available on all player in household. SONOS-Playlists are sometimes called "Saved Queue" as that is their most important use case. They are automatically visible in My Sonos under category Playlists. |
Music Library |
The build in Music Library - usually located on one or more NAS server_ |
My Sonos |
The "My Sonos" favorites - see SONOS-App, tab with star shape. Has categories Recently Played, Albums, Audiobooks, Playlists, Podcasts, Shows, Songs, Stations, , … |
SONOS-App |
The official SONOS App for Android or Iphone |
coordinator |
In every group (also when stand alone) there is exactly one coordinator |
joiner |
All non-coordinators in a group. There are none in a group with 1 player (stand alone player) |
stereopair |
Two players bind together - each for left/right channel. They act as one player (the other ones name is hidden) |
URI |
A Uniform Resource Identifier (URI) is a string of characters that unambiguously identifies a particular resource. To guarantee uniformity, all URIs follow a predefined set of syntax rules, but also maintain extensibility through a separately defined hierarchical naming scheme (e.g. http://). https://en.wikipedia.org/wiki/Uniform_Resource_Identifier |
UUID |
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer systems such as 'RINCON_949F3EC13B9901400' |
UDN |
Unique Device Name such as 'uuid:RINCON_949F3EC13B9901400' (uuid:\<UUID\>) |
Group volume is the average of all player volumes and any changes will taken in account the relation of player volumes to each others captured as a specific point in time. You can create a new snapshot with group.create.snapvolume.
See also: Understanding group volume
Type | Valid values |
---|---|
Player with TV |
'Sonos Beam' 'Sonos Playbar' 'Sonos Playbase' 'Sonos Arc' |
Playback states |
'stopped' 'playing' 'paused_playback' 'transitioning' 'no_media_present' |
SONOS queue modes |
'NORMAL' 'REPEAT_ONE' 'REPEAT_ALL' 'SHUFFLE' 'SHUFFLE_NOREPEAT' 'SHUFFLE_REPEAT_ONE' |
Actions |
'Set' 'Stop' 'Pause' 'Play' 'X_DLNA_SeekTime' 'Next' 'Previous' 'X_DLNA_SeekTrackNr' |
node-red-contrib-sonos-plus 2024