Skip to content
This repository has been archived by the owner on May 2, 2023. It is now read-only.

davidlb/ha_owntone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 

Repository files navigation

⚠️ Since HomeAssistant 2022.10, you should switch back to the core component (better support and more features)

OwnTone Component

Forked from Core component to be able to play playlist, album or track by calling HA service
TTS is not working

How to get the uri for media_content_id?

First you need to get the id of what you want to listen to using JSON API in your browser or curl. You will need probably to play with these endpoints:

Method Endpoint Description
GET /api/library/playlists Get a list of playlists
GET /api/library/playlists/{id}/tracks Get list of tracks for a playlist
GET /api/library/artists Get a list of artists
GET /api/library/artists/{id}/albums Get list of albums for an artist
GET /api/library/albums Get a list of albums
GET /api/library/albums/{id}/tracks Get list of tracks for an album

For the full list of endpoints, check this page
You can also use the Search endpoint.

Example

To find a specific track, I use this command:

curl -s -X GET "http://localhost:3689/api/search?type=tracks&query=magic" | jq -r '.[].items[] | .artist + " / " + .title, .uri'

It will give me uri for each matching the query (magic in my case):

Brian Eno / Energy Fools the Magician
library:track:24994
Queen / A Kind Of 'A Kind Of Magic
library:track:20396
Omer Avital Quintet / Magic Carpet
library:track:14113
Red Hot Chili Peppers / Magic Johnson
library:track:18810
Jon Anderson / Magic Love
library:track:7636
Boards of Canada / Magic Teens
library:track:8605
Boards of Canada / Magic Window
library:track:8653
Keith Jarrett / The Magician in You
library:track:14447

In Home Assistant, call service media_player.play_media and the following example will play track Keith Jarrett / The Magician in You in my case.

entity_id: media_player.forked_daapd_server
media_content_id: 'library:track:14447'
media_content_type: music