Coder Social home page Coder Social logo

jellyfin_ha's Introduction

jellyfin_ha

Jellyfin integration for Home Assistant

Installation:

  • Install the Jellyfin integration through HACS or below
  • Configure your Jellyfin server
  • After a restart, you will have media_player and sensor entities.

Features

Entities

  • 1 media_player entity per device
  • 1 sensor per server
  • Supports the "upcoming-media-card" custom card

Media Browser

  • Browse medias and start playback from within Home Assistant

Media Source

  • Browse and stream to a cast device (e.g. Chromecast)

Services

  • trigger_scan: Trigger a server media scan
  • browse: Show a media info on a device
  • delete: Delete a media
  • search: Search for media (for compatible fontends)

Upcoming Media Card

Sample for ui-lovelace.yaml:
- type: custom:upcoming-media-card
  entity: sensor.jellyfin_media_server
  title: Latest Media

More configuration options can be found in the upcoming-media-card repo.


jellyfin_ha's People

Contributors

developmentaloctopus avatar jacobcoffee avatar koying avatar sim7b avatar thisistenou avatar zachowj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

jellyfin_ha's Issues

Unexpected Keyword error when using Browse service

While the integration seems to be working fine for me otherwise, when attempting to use the Browse service, an error like this appears in the HA logs:

2021-12-03 14:00:12 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140194619643744] Error handling message: Unknown error
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 26, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 523, in handle_execute_script
    await script_obj.async_run(msg.get("variables"), context=context)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1243, in async_run
    await asyncio.shield(run.async_run())
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 353, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 371, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 571, in _async_call_service_step
    await service_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service
    await handler.job.target(service_call)
  File "/config/custom_components/jellyfin/__init__.py", line 183, in async_service_handler
    await getattr(media_player, method['method'])(**params)
TypeError: async_browse_item() got an unexpected keyword argument 'id'

In the past I had this working to browse to either a whole library or individual media item, but now trying either will result in the above. The IDs are copied from the id parameter in the Jellyfin webUI URLs, and work fine to play media with.

is this discontinued?

the default Jellyfin integ in HA is lacking, this one looks more capable, but I can't get it to work in HA 2023.5.x. Are there any updates planned? Thanks!

Feature: Support for multiple users on one server

We have different user IDs on our home Jellyfin for everybody, mainly to be able to track who has watched what but also for parental control. We also have unique dashboards for each family member in HA, based on interest and again - parental control.

Currently, this integration supports only one connection per server which limits the usefulness of the upcoming media card quite a bit. It also allows every user to control every media player instance which is not necessarily desirable.

I would like to suggest the possibility of separate connections per user to one JF server to be able to separate watched/upcoming information and isolate media player control.

Jellyfin Integration Page - Depends on Cloud

On the recently redesigned Home Assistant integration page, there is now detail about custom integrations and "connects to the cloud". The dashboard card identifies that this Jellyfin integration connects to the cloud... I don't believe this to be true. Perhaps it's a bug or further explanation is required in the README.

local variable 'url' referenced before assignment

Hi, I keep getting this error whenever I try to play any videos using this integration. Music files work just fine it just does this with the videos. Is there something I'm missing? Or is this a bug, and if so is there any kind of workaround?

Here is the full log out gives with the error:

`Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/jellyfin/init.py:1264
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 5:20:21 PM (1 occurrences)
Last logged: 5:20:21 PM

[281473142058432] local variable 'url' referenced before assignment
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1491, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1526, in _execute_service
await handler.job.target(service_call)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
await self.hass.helpers.service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 658, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 760, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 695, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/cast/media_player.py", line 453, in async_play_media
sourced_media = await media_source.async_resolve_media(self.hass, media_id)
File "/usr/src/homeassistant/homeassistant/components/media_source/init.py", line 85, in async_resolve_media
return await _get_media_item(hass, media_content_id).async_resolve()
File "/usr/src/homeassistant/homeassistant/components/media_source/models.py", line 83, in async_resolve
return await self.async_media_source().async_resolve_media(self)
File "/config/custom_components/jellyfin/media_source.py", line 116, in async_resolve_media
t = await self.jelly_cm.get_stream_url(media_content_id, media_content_type)
File "/config/custom_components/jellyfin/init.py", line 1264, in get_stream_url
_LOGGER.debug("stream info: %s - url: %s", info, url)
UnboundLocalError: local variable 'url' referenced before assignment
`

Metadata not displaying with Chromecast

When playing music through Chromecast Audio from Media Sources, the display shows "default media receiver" instead of showing the song title, artist and album cover.

Handle temporarily unavailable server gracefully

Hi! My Jellyfin host is not available 24/7 but rather is suspended on a timer. Now when the host goes into suspend all states of the entities freeze while they should probably change to something like "unavailable".

Furthermore the HA log is spammed with hundreds of messages like these "Failed to connect to server" followed by a traceback and many more follow-up errors like "Failed to login to server with status code: 502".
It would be really sweet if jellyfin_ha could handle this situation a bit cleaner. Thank you in any case for the great integration, works already much better than emby HA!

“Unknown error” when I try to browse media

Home Assistant version: container core-2022.6.7
Jellyfin Server: container 10.8.0
Jellyfin-HA: addon 1.1.1
Kodi: Matrix 19.4

Hello! I can’t browse my file from home assistant in order to play media to my kodi players. Whenever I try to do it, it prompt “Unknown errror”

Screenshot 2022-06-25 at 02 01 01

I tried to reinstall the addon, even on a fresh install of home assistant. I also tried the 1.0.8 version of jellyfin-ha as a similar issue has been already mentioned. Still nothing…

But, if I delete my manual playlist in jellyfin I can browse media again

Here the logs from Home assistant:

2022-06-25 02:13:31 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [2717597736] Error handling message: Unknown error (unknown_error)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 27, in _handle_async_response
await func(hass, connection, msg)
File "/usr/src/homeassistant/homeassistant/components/media_source/init.py", line 161, in websocket_browse_media
media = await async_browse_media(hass, msg.get("media_content_id", ""))
File "/usr/src/homeassistant/homeassistant/components/media_source/init.py", line 112, in async_browse_media
item = await _get_media_item(hass, media_content_id, None).async_browse()
File "/usr/src/homeassistant/homeassistant/components/media_source/models.py", line 86, in async_browse
return await self.async_media_source().async_browse_media(self)
File "/config/custom_components/jellyfin/media_source.py", line 128, in async_browse_media
return await async_library_items(self.jelly_cm, media_content_type, media_content_id, canPlayList=False)
File "/config/custom_components/jellyfin/media_source.py", line 289, in async_library_items
identifier=f'{Type2Mediatype(item["Type"])}{IDENTIFIER_SPLIT}{item["Id"]}',
File "/config/custom_components/jellyfin/media_source.py", line 157, in Type2Mediatype
return switcher[type]
KeyError: 'ManualPlaylistsFolder'

Thanks

Repetitive threads when connecting over https

Jellyfin integration worked just fine with previous HA versions, but after upgrade to 2021.11, today, I get a message logged every 2 to 3 seconds:

image

Thread count goes up, session-id different every time. I have disabled the integration for now, as this slows down this considerably and I don't want my logfile to blow up. Any idea what is happening?

Thanks!

Log level

Hello, what is the correct configuration for the logger to change the level ?
I tried the following but that seems not correct :
custom_components.jellyfin: critical
jellyfin: critical

Thanks.

No more entities

Hi,

I don't know from when, maybe jellyfin server update or HA recent update but my media player entities where in status restored. I deleted the integration and reinstalled it but now, there is no more media player entities.

Here are the HA logs:
Logger: JELLYFIN.jellyfin_apiclient_python.ws_client
Source: /usr/local/lib/python3.10/site-packages/jellyfin_apiclient_python/ws_client.py:85
First occurred: 22:42:44 (1 occurrences)
Last logged: 22:42:44
'socket' object has no attribute 'pending'

And another one:
Logger: root
Source: /usr/src/homeassistant/homeassistant/bootstrap.py:336
First occurred: 22:42:44 (1 occurrences)
Last logged: 22:42:44

Uncaught thread exception
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/websocket/_app.py", line 354, in setSock
dispatcher.read(self.sock.sock, read, check)
File "/usr/local/lib/python3.10/site-packages/websocket/_app.py", line 70, in read
r = self.select()
File "/usr/local/lib/python3.10/site-packages/websocket/_app.py", line 78, in select
if sock.pending():
AttributeError: 'socket' object has no attribute 'pending'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.10/site-packages/jellyfin_apiclient_python/ws_client.py", line 72, in run
self.wsc.run_forever(
File "/usr/local/lib/python3.10/site-packages/websocket/_app.py", line 420, in run_forever
setSock()
File "/usr/local/lib/python3.10/site-packages/websocket/_app.py", line 356, in setSock
handleDisconnect(e)
File "/usr/local/lib/python3.10/site-packages/websocket/_app.py", line 407, in handleDisconnect
dispatcher.timeout(reconnect, setSock)
AttributeError: 'SSLDispatcher' object has no attribute 'timeout'

Thanks.

missing the watching sensor?

i setup home assistant a few days and had no issues with the sensors. today i reinstalled everything and now its gone and dont know how to get it back again?

Set scan interval

How can you set scan interval for this integration so that is checks the state of an entity more frequently? I am trying to raise and dim lights based off of the state and paused and playing are quite delayed.

Error on connecting to the device

I am receiving an error upon connecting.

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 587, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 711, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 464, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 501, in _async_write_ha_state
    extra_state_attributes = self.extra_state_attributes
  File "/config/custom_components/jellyfin/sensor.py", line 93, in extra_state_attributes
    if self.jelly_cm.data:
  File "/config/custom_components/jellyfin/__init__.py", line 867, in data
    "number": f'S{item["ParentIndexNumber"]}E{item["IndexNumber"]}',
KeyError: 'ParentIndexNumber'

From the point of jellyfins, it looks like everything is working just fine as I can see several API calls from the HA user receiving data.

If there is anything I can do to help troubleshooting the issue, please let me know.

State doesn’t change to paused when paused

I don’t know if this is a Jellyfin server issue but when I pause media the state in Home Assistant remains as “Playing”. The state changes to “Idle” if I stop playing the media completely.

The client is NVIDIA Shield

Active Devices

This would be great if it pulled down the active devices connected to Jellyfin, so HA is able to show when people are watching things. Thanks!

duplicate entities for same Chromecast device

I understand the integration creates media_player entities on-the-fly.
However, it seems to be creating multiple media_player entities for the same Chromecast device.

I only have one Chromecast device.
Despite this, I have media_player.chromecast, media_player.chromecast_2, media_player.chromecast_3... etc. etc. etc. up to media_player.chromecast_23!
Some of these become unavailable/restored at various points in time, I'm not always able to delete them and they are cluttering the registry. Any idea why this happens?

Https

Does this require https within Jellyfin?

Music control possible ?

Hi

Is there a way for example to start random play in whole music library or start a specific playlist ? and do you have some sample codes for HA for that ?

Thanks

Vincèn

jellyfin integration affected by deprecation of magic numbers

Hello,
I received the following warning message in my logs:
Entity None (<class 'custom_components.jellyfin.media_player.JellyfinMediaPlayer'>) is using deprecated supported features values which will be removed in HA Core 2025.1. Instead it should use <MediaPlayerEntityFeature.PAUSE|SEEK|PREVIOUS_TRACK|NEXT_TRACK|PLAY_MEDIA|STOP|PLAY|BROWSE_MEDIA: 152115>, please create a bug report at https://github.com/koying/jellyfin_ha/issues and reference https://developers.home-assistant.io/blog/2023/12/28/support-feature-magic-numbers-deprecation
Therefore, with reference to #https://developers.home-assistant.io/blog/2023/12/28/support-feature-magic-numbers-deprecation, I send this bug report and hope the problem resolves before January 2025, even though a custom component is affected.

[FR] Users connected/streaming

I would love to see from my HA what people are streaming. Would this be possible in this addon?
Media/mediaplayer integration is for me not relevant, so perhaps it should be separate from this addon even?

edit: I think this could be achieved using the /sessions endpoint of the Jellyfin api

Upcoming Media Card Images

Is it possible to pull the show fanart/poster rather than the episode thumbnail? Seems most of the shows i have dont have backdrop image for the episode but the show does. Primary is normally the thumbnail.

Configuration issue ?

Hi

Trying to use that custom integration but a little confused :( I have installed the integration in hacs, then restarted hassio then i go into Integrations but no Jellyfin shows up in list of integrations ! How do you configure it ? Missing something obvious I guess but can't find any doc about setup :(

Thanks

Vincèn

Entities disabled by default

Hello, is there any reason why the integration disables entities by default? Even if an entity has a current stream the entity stays disabled. If the entity is enabled manually, the streams show up on the developer tools states. Thank you.

Can only play Movies

When playing (initiating playback in Home Assistant through the media tab), to the Jellyfin App (Android TV). I can only cast Movies (those work great). Music and TV-Shows both show "No Items".

Integration not available after installing in HACS

Just went to install this today and it downloads and installs in HACS just fine. Reboot the HA server multiple times but the Jellyfin integration never shows up to add. There's nothing at all available in the standard integration page via HA to install this.

Jellyfin users without password

My user in Jellyfin has no password, but it is not possible to add the integration without a password as it is a mandatory field.
Would it be possible to add passwordless users? Maybe using the API key?

script playlist on home assistant

Hi,
I'm trying to script a playlist in home assistant to play it in google home, but I can't find the correct way. Any suggestions?
Thank you

send messages to clients

I can send messages to Jellyfin clients from the admin UI. It would be cool if Home Assistant could too.

Retrying setup: None, cannot connect to server.

I'm not sure what's wrong here? I put the url to browser and can log in just fine. But the integration claims it can't connect?

This error originated from a custom integration.

Logger: custom_components.jellyfin
Source: custom_components/jellyfin/__init__.py:167
Integration: Jellyfin (documentation, issues)
First occurred: 10:40:36 AM (223 occurrences)
Last logged: 11:38:35 AM

Cannot connect to Jellyfin server.

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.