Start/Trigger Playlist on Synology from HTTP request

I dug around here, and elsewhere, but I couldn’t find anything (that at least I could understand) on how to do this.

Goal: Trigger playlist from a scene on vera, have music begin playing through airplay connected device. Seems simple ???

Environment:
Synology DS412+
ROCKI (Airplay device) connected to amplifier/speakers
Vera 3

I installed Synology Audio Station, which works great for playing music to the ROCKI, so at least I know that part of the setup works okay. What I can’t figure out is a way to send an HTTP command to Audio Station to start playing a specific playlist (or song) to the ROCKI.

Seems like something pretty basic…however I can’t figure out where/how :smiley:

Any help would be appreciated!

[quote=“EOppie, post:1, topic:181099”]I dug around here, and elsewhere, but I couldn’t find anything (that at least I could understand) on how to do this.

Goal: Trigger playlist from a scene on vera, have music begin playing through airplay connected device. Seems simple ???

Environment:
Synology DS412+
ROCKI (Airplay device) connected to amplifier/speakers
Vera 3

I installed Synology Audio Station, which works great for playing music to the ROCKI, so at least I know that part of the setup works okay. What I can’t figure out is a way to send an HTTP command to Audio Station to start playing a specific playlist (or song) to the ROCKI.

Seems like something pretty basic…however I can’t figure out where/how :smiley:

Any help would be appreciated![/quote]

I’m thinking about the same but using BT speaker, maybe some progress?

Here some luup code I use to connect to my synology DS audio Webapi. The Synology than plays directly to my Airport/Stereo when starting the scene.

In the code below my synology has the fictive id=403CFC043XXX but it can alsno be something like: SYNO_USB_PLAYER. You can find the id when logging into the api via the following two commands:

http://192.168.1.8:5000/webapi/auth.cgi?api=SYNO.API.Auth&version=2&method=login&account=myusername&passwd=mypassword&session=AudioStation&format=cookie
http://192.168.1.8:5000/webapi/AudioStation/remote_player.cgi?api=SYNO.AudioStation.RemotePlayer&version=2&method=list

Scene that starts the playlist 143:

luup.log('Starting Playlist Play ’ … luup.version)
local status, result = luup.inet.wget(“http://192.168.1.8:5000/webapi/auth.cgi?api=SYNO.API.Auth&version=2&method=login&account=myusername&passwd=mypassword&session=AudioStation&format=cookie”, 1)

result2 = string.gsub(result,“{"data":{"sid":"”,“”)
result3 = string.gsub(result2,“"},"success":true}”,“”)
cookie = string.gsub(result3,string.char(10),“”)
luup.log(‘Found Cookie:’ … cookie … ‘’)

luup.log('Load Playlist 143 ')
local status, result = luup.inet.wget(“http://192.168.1.8:5000/webapi/AudioStation/remote_player.cgi?api=SYNO.AudioStation.RemotePlayer&method=updateplaylist&library=shared&id=403CFC043XXX&offset=0&limit=0&play=true&version=2&containers_json=[{“type”%3A"playlist"%2C"id"%3A"playlist_shared_normal%2F143"}]&_sid=” … cookie, 2)

luup.log(‘Play’)
local status, result = luup.inet.wget(“http://192.168.1.8:5000/webapi/AudioStation/remote_player.cgi?api=SYNO.AudioStation.RemotePlayer&method=control&action=play&value=0&id=403CFC043XXX&version=2&_sid=” … cookie, 2)

local status, result = luup.inet.wget(“http://192.168.1.8:5000/webapi/AudioStation/remote_player.cgi?api=SYNO.AudioStation.RemotePlayer&version=2&method=getstatus&id=403CFC043XXX&_sid=” … cookie, 2)
luup.log(‘Result Status:’ … result)

local status, result = luup.inet.wget(“http://192.168.1.8:5000/webapi/auth.cgi?api=SYNO.API.Auth&version=2&method=logout&session=AudioStation”, 1)

Scene that stops the playlist:

luup.log('Stopping Playlist ’ … luup.version)
local status, result = luup.inet.wget(“http://192.168.1.8:5000/webapi/auth.cgi?api=SYNO.API.Auth&version=2&method=login&account=myusername&passwd=mypassword&session=AudioStation&format=cookie”, 1)

result2 = string.gsub(result,“{"data":{"sid":"”,“”)
result3 = string.gsub(result2,“"},"success":true}”,“”)
cookie = string.gsub(result3,string.char(10),“”)
luup.log(‘Found Cookie:’ … cookie … ‘xxxxxxxx’)

luup.log('Stop ')
local status, result = luup.inet.wget(“http://192.168.1.8:5000/webapi/AudioStation/remote_player.cgi?api=SYNO.AudioStation.RemotePlayer&method=control&action=stop&id=403CFC043XXX&version=2&_sid=” … cookie,2)
local status, result = luup.inet.wget(“http://192.168.1.8:5000/webapi/AudioStation/remote_player.cgi?api=SYNO.AudioStation.RemotePlayer&version=2&method=getstatus&id=403CFC04XXX&_sid=” … cookie, 2)
local status, result = luup.inet.wget(“http://192.168.1.8:5000/webapi/auth.cgi?api=SYNO.API.Auth&version=2&method=logout&session=AudioStation”, 1)

Scene that starts the next song in playlist:

luup.log('Play Next in Playlist ’ … luup.version)
local status, result = luup.inet.wget(“http://192.168.1.8:5000/webapi/auth.cgi?api=SYNO.API.Auth&version=2&method=login&account=myusername&passwd=mypassword&session=AudioStation&format=cookie”, 1)

result2 = string.gsub(result,“{"data":{"sid":"”,“”)
result3 = string.gsub(result2,“"},"success":true}”,“”)
cookie = string.gsub(result3,string.char(10),“”)
luup.log(‘Found Cookie:’ … cookie … ‘xxxxxxxx’)

luup.log(‘Volgende’)
local status, result = luup.inet.wget(“http://192.168.1.8:5000/webapi/AudioStation/remote_player.cgi?api=SYNO.AudioStation.RemotePlayer&method=control&action=next&id=403CFC04XXX&version=2&_sid=” … cookie, 2)
local status, result = luup.inet.wget(“http://192.168.1.8:5000/webapi/auth.cgi?api=SYNO.API.Auth&version=2&method=logout&session=AudioStation”, 1)

If you need more options see Audio Station API · kwent/syno Wiki · GitHub

Hi,

My name is Manuel and i’m from Spain.

I have a Synology NAS and i would like to use the Synology Audio Station Api for my domotic system in my home, but first i need to create a python code from API.

I have little acknowledgment about programming (C++, java, Matlab, etc) but i’m not expert.

I tried the first api http commands like:

http://192.168.1.100:5050/webapi/auth.cgi?api=SYNO.API.Auth&version=2&method=login&account=myusername&passwd=mypassword&session=AudioStation&format=cookie

http://192.168.1.100:5050/webapi/AudioStation/remote_player.cgi?api=SYNO.AudioStation.RemotePlayer&version=2&method=list

and i i have these results:

{"data":{"sid":"PRGeQfzHlFAAU1720NZXXXXXX"},"success":true}

{“data”:{“players”:[]},“success”:true}

Now i dunno which command more i need to use and which parameters i need to add in browser for the API by http.

thanks