I’m trying to see if it’s possible to create a template sensor that shows the " Id
" of a given set of movies in my collection. I started with a REST API call in Postman ( GET http://192.168.1.240:8096/emby/items?Recursive=true&IncludeItemTypes=Movie&Genres=comedy
) to get the following response that shows all of the “Comedy” movies in my collection (obviously I’ve only used two titles in the example below):
{
"Items": [
{
"Name": "2 Guns",
"ServerId": "3f4c3108cb47442e9b058ad01a1e2cd4",
"Id": "1889",
"RunTimeTicks": 65553700000,
"IsFolder": false,
"Type": "Movie",
"ImageTags": {
"Primary": "288697e9e3bc17add9691f67bc57df1b",
"Logo": "0902d40c7a4678ee253c4264e594e7f8",
"Thumb": "92ed6767d69ade3a8d399fdf13da21b2"
},
"BackdropImageTags": [
"ae5ada4506b7ec58cb46d17d1441047a"
],
"MediaType": "Video"
},
{
"Name": "21 & Over",
"ServerId": "3f4c3108cb47442e9b058ad01a1e2cd4",
"Id": "1890",
"RunTimeTicks": 55864950000,
"IsFolder": false,
"Type": "Movie",
"ImageTags": {
"Primary": "07f25c808e4451ab0cc26a14918a58a6",
"Logo": "fb814f5628c1864db3a41f952d7330f5",
"Thumb": "eacbb7135ab24261d75dc5b29c5fc658"
},
"BackdropImageTags": [
"9bd4efb96311fd6c0a184dd1f4684709"
],
"MediaType": "Video"
},
For another part of the system I’m working on I have a sensor that gets the session ID from the current Emby instance:
- platform: command_line
name: embysession_livingroom
command: "curl -H \"Content-Type: application/json\" -H \"X-Emby-Token: xxxxxxxxx\" -X GET \"http://192.168.1.240:8096/emby/Sessions\" | jq -r '.[] | select(.DeviceId==\"Livingroom\") | .Id'"
scan_interval: 4
Using this, the sensor returns the value of the session ID as a string.
I’ve tried adopting this for the show ID sensor I’d like to build, but I don’t really know much about using these commands, so I’d appreciate it if someone here might be able to help me (if it’s at all possible). I know the following is incorrect, but it’s as far as I’ve got so far… The sensor just says “Unknown”.
- platform: command_line
name: emby_movies_comedy
command: "curl -H \"Content-Type: application/json\" -H \"X-Emby-Token: xxxxxxxxx\" -X GET \"http://192.168.1.240:8096/emby/items?Recursive=true&IncludeItemTypes=Movie&Genres=comedy\" | jq .Id'"
scan_interval: 4
My end goal is to ideally have a sensor that lists the ID’s of all of my comedy movies in a single comma-separated string.