Skip to content

Commit c78c312

Browse files
authored
Merge pull request #600 from SmartThingsCommunity/feat/sonos-add-queue-action-preference
2 parents fa8c123 + 9e2d086 commit c78c312

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

drivers/SmartThings/sonos/profiles/sonos-player.yml

+13
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,16 @@ components:
2929
version: 1
3030
categories:
3131
- name: Speaker
32+
preferences:
33+
- name: "queueAction"
34+
title: "\"Load Favorites\" Queuing Action"
35+
description: Determines the playback behavior when a Favorite is loaded while content is already queued on the speaker.
36+
required: false
37+
preferenceType: enumeration
38+
definition:
39+
options:
40+
Append: "Add to End of Queue"
41+
Insert: "Play Now"
42+
Insert_Next: "Play Next"
43+
Replace: "Replace Queue"
44+
default: Append

drivers/SmartThings/sonos/src/api/cmd_handlers.lua

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ local st_utils = require "st.utils"
99
--- https://developer.sonos.com/reference/control-api-examples-lan/
1010
local CapCommandHandlers = {}
1111

12+
local QUEUE_ACTION_PREF = "queueAction"
13+
1214
local function _do_send(device, payload)
1315
local conn = device:get_field(PlayerFields.CONNECTION)
1416
if conn and conn:is_running() then
@@ -151,7 +153,8 @@ function CapCommandHandlers.handle_play_preset(driver, device, cmd)
151153
{ namespace = "favorites", command = "loadFavorite" },
152154
{
153155
favoriteId = cmd.args.presetId,
154-
playOnCompletion = true
156+
playOnCompletion = true,
157+
action = (device.preferences[QUEUE_ACTION_PREF] or "APPEND")
155158
}
156159
}
157160
_do_send_to_group(driver, device, payload)

0 commit comments

Comments
 (0)