Jellyfin integration

Hi,

A specific integration for Jellyfin (an Emby fork) is now available in HACS.

Beyond the basic functionalities that were already usable via the Emby integration, this one adds:

  • Config flow support (YAML not supported)
  • Media browser support (browse and launch a media on a Jellyfin device)
  • Media Source (browse and launch a media on a cast device, i.e. Chromecast)
  • Services:
    . trigger_scan : trigger a library scan
    . browse: Display a media card on a Jellyfin device (needs Jellyfin id)
    . delete: Delete a media (needs Jellyfin id)

It also optionally supports the upcoming-media-card lovelace card.

In cas you wonder, it also support a card of mine named YAMC I’m working on, which is the “upcoming” card on steroid, but not quite ready for prime, yet:

Enjoy

11 Likes

Oh wow, can’t believe I missed this. Going to try it right away. Thank you mister :wink:

Hmm, the media_player and sensor entities seem to report their state just fine, and the browse command works, but trying to browse and play media from either the Media Browser or Browse Media doesn’t seem to work. No error appears in either the Jellyfin or HA logs, and the websocket shows a play media service call being sent, so I’m not sure what’s up:

service: media_player.play_media
data:
  entity_id: "media_player.jellyfin_google_tv_chromecast"
  media_content_id: "media-source://jellyfin/episode~~cf9365266c2a0862446f6ad33a08c4f3"
  media_content_type: "episode"

Should be fixed in latest version

Playing via the Browse Media button on a media player card now works as expected :slight_smile: Thanks!

Playing via the media browser goes further but still doesn’t work. Selecting an item for playback now causes the device to go into Chromecast mode, but then gets stuck on a generic Chromecast logo while producing a Home Assistant error. I think this is caused by direct play on the media player vs transcoding on the Chromecast, my server can’t handle transcoding. Here’s the error in case you’re interested, but I think this one’s on me:

2021-06-07 08:34:54 ERROR (Thread-14) [homeassistant.components.cast.media_player] Failed to cast media https://<public domain>/videos/c28856b0-d630-0b1a-2ec4-9be20bc3a496/stream.mp4?DeviceId=b5cdc2d9-4f74-41f6-ae59-b61a7550516f&MediaSourceId=c28856b0d6300b1a2ec49be20bc3a496&VideoCodec=h264,mpeg4,mpeg2video&AudioCodec=aac,mp3,opus,flac,vorbis&AudioStreamIndex=1&VideoBitrate=24360000&AudioBitrate=640000&PlaySessionId=0e7ecff5fbae4f169c6b2e9e570dda01&api_key=3a48c462fe1843a7abe8da1d58623aa7&SubtitleMethod=Encode&TranscodingMaxAudioChannels=6&RequireAvc=false&Tag=cfdcc4df8613439e626f15fe7766b359&TranscodeReasons=ContainerNotSupported,VideoCodecNotSupported,AudioCodecNotSupported. Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address

Also looking for some general advice, not quite relevant to the integration specifically but I’m wondering how others are dealing with it. I can use either my public domain or LAN IP to access my Jellyfin server, and both work to configure the integration. However, when using the LAN IP, the upcoming media card has the image URLs with HTTPS in place of HTTP, which isn’t configured so the images break (I think this is a browser thing and not possible to circumvent). Using the public domain fixes this, but it results in occasional buffering compared to the LAN IP since the WAN interface is obviously slower. I haven’t tried configuring SSL within Jellyfin yet since it’s currently set up through a reverse proxy and I believe double-SSL is gonna break stuff or otherwise be a huge headache.

Hi,
I’m certainly doing something wrong but i have only one entity called sensor.jellyfin_jellyfin from this integration with lots of attributes.
Is it normal ?

You should have one media_player per active device, in addition of one sensor for the server:

not sure to understand, i should find a “media_player.jellyfin” ?

Yes. In this example, a “media_player.jellyfin_firefox”.
They become inactive in HA when inactive in Jellyfin

I have added the integration to HACS but I cannot figure out how to configure it and let home assistant know the address of my Jellyfin server. Does this need setup in configuration.yaml?

I’m trying to script a playlist to play through google home, but I can’t find the way.
Do I use the media_content_id: media-source / jellyfin / etc .... playlistname.xml or is there another line to write?.

Thanks!!

After adding the HACS integration you have to add it like a regular home assistant integration.

I would also be interested in this. I can’t find a way to play a stream url of the playlist from the server either.

It’s a generic question, actually.
The integration generates media ids, and when you browse via Google Cast, the cast integration calls back the integration to get the actual url to play.

I’ve opened a generic questions to see if others have clues:

I’ve been playing around with this a little bit and while it doesn’t use the media source feature, it’s a solid workaround until we figure that out. If you go to a particular item (episode, song, movie) in the Jellyfin web interface, you can generate a stream URL by right clicking on it. You can put that URL in the media_content_id field and as long as your device can access the URL it will play it. That URL does contain what appears to be the actual ID of the item in Jellyfin but using anything mentioned here with that ID doesn’t seem to work.

Hi, this integration works very well for me but I just have a technical question of curiosity, and i can’t find my answer in your code.
How does the polling work ? I mean, in debug mode in HA, I can see that the attributes of the media player that is playing are updated every second. HA polls jellyfin server every second ?
And when you’re not playing any media, HA polls as well at high frequency ?

It is just to be curious of how does it work.
Thanks.

The media playing part is handled through a websocket, which listen for events coming from Jellyfin.
That part is not actually poll but push.

Thank you for your explanation, i understand.
I supposed something like that but was not sure.

Anyway, well done, great integration.

When calling the browse service as below, I get a TypeError: async_browse_item() got an unexpected keyword argument 'id' error, full log here

service: jellyfin.browse
data:
  entity_id: media_player.jellyfin_google_tv_chromecast
  id: f137a2dd21bbc1b99aa5c0f6bf02a805

This is with the latest docker containers for Home Assistant and Jellyfin; I’m actually testing under a clean installation with minimal config due to another issue. It was also occurring with my long-standing setup, but I believe it was fine about six weeks ago when I first posted in this thread. I hadn’t made much use of the browse service in the time since then, so I’m not too sure if a specific change prompted the issue.

I’m using Jellyfin without a password, but to setup the integration it seems that the password field can’t be blank.

Is there a way to use this without a password for my Jellyfin User?

Thanks for your help!