I’ve been searching around both this site and the source code of Volumio2, but didn’t find enough info.
Are there any examples for accesing the websocket API for Volumio2 from Python?
I’m specifically looking for info on the API endpoint (/api ?), port and other details.
Hello,
I have a Raspberry PIB +touchscreen and try to build a Ruby/TK interface using the API (because web UI doesn’t work on RPI1)
Here is a code I built to see how the API works. I think you can easily translate it to Python.
Also look into Volumio2-UI/app/services to see the availables commands.
require 'socket.io-client-simple'
socket = SocketIO::Client::Simple.connect 'http://volumio:3000'
socket.on :disconnect do
puts "disconnected!!"
end
socket.on :error do |err|
p err
end
socket.on :pushState do |data|
puts data
end
socket.on :getBrowseFilters do |data|
puts data
end
socket.on :pushBrowseLibrary do |data|
puts Time.now
# puts data
end
puts "please input and press Enter key"
loop do
puts "====================="
puts "getBrowseSources"
puts "getBrowseFilters"
puts "getState"
puts "getTrackInfo"
puts "getSeek"
puts "getMultiroom"
puts "getMultiRoomDevices"
puts "getQueue"
puts "listPlaylist"
puts "search"
puts "play"
puts "stop"
puts "prev"
puts "next"
puts "shuffle"
puts "browseLibrary"
puts "====================="
msg = STDIN.gets.strip
next if msg.empty?
vals = msg.split "|"
code = vals[0]
h = eval(vals[1]) if vals[1]
#h = {"uri"=>"music-library"}
if h
puts h
puts Time.now
socket.emit code, h
else
puts Time.now
socket.emit code
end
end