Jump to content

Recommended Posts

Posted

When connecting to Emby server with Home Assistant I get 2 errors...

 

Unable to register emby client.
17:48:55  (ERROR) /usr/local/lib/python3.9/site-packages/pyemby/server.py
 
Error fetching Emby data: [Errno 104] Connection reset by peer
17:48:55  (ERROR) /usr/local/lib/python3.9/site-packages/pyemby/server.py
 
 
The integration is setup as per the Home Assistant documentation..
 
 
 
# Emby Server
media_player:
  - platform: emby
    host: 192.168.1.100
    api_key: 6933************************5d6b
 
 
 
Home assistant is able to ping Emby server which is running in a docker container on Unraid.
Emby server can ping Home assistant with IP or hostname.
 
 
Has anybody experienced any similar errors or knows of a fix?
seanbuff
Posted

Are you using a non-default Emby port? If so, specify it there.

"Connection reset by peer" suggests Emby didn't like something and forcibly closed the connection attempt -- do you see any corresponding responses in the Emby Server log around that same time?

Posted

I cant find anything relevant in the log. 

The port is standard 8096. I get the same message if I specify the port in configuration.yaml.

Posted (edited)
36 minutes ago, Milldor said:

I cant find anything relevant in the log. 

The port is standard 8096. I get the same message if I specify the port in configuration.yaml.

2022-01-14 20:36:07.089 Info Server: http/1.1 GET http://192.168.1.100:8096/Sessions. UserAgent: Python/3.9 aiohttp/3.8.1
2022-01-14 20:36:07.093 Info Server: http/1.1 Response 500 to 192.168.1.200. Time: 4ms. http://192.168.1.100:8096/Sessions

 

Above are the log entries.

Edited by Milldor
Posted

Does Home Assistant require SSL?

seanbuff
Posted
8 hours ago, Luke said:

Does Home Assistant require SSL?

Nope, it does not.

Here is my working config:

#media_player:
  - platform: emby
    host: <emby_host>
    api_key: !secret emby_api
    port: 8096
    ssl: false

 

Posted
On 16/01/2022 at 03:49, Luke said:

OK. @Milldor you may want to try copying from that. 

I've already tried that with the same result. :(

seanbuff
Posted
9 minutes ago, Milldor said:

I've already tried that with the same result. :(

Two things to try:

  • Have you tried generating a new API key to test with?
  • Can you enable debug level logs in Emby Server to maybe get some more information on why its responding with a 500 to the GET request?


I have tried breaking my HA config in various ways, but am unable to reproduce what you're seeing unfortunately.

Posted
9 hours ago, seanbuff said:

Two things to try:

  • Have you tried generating a new API key to test with?
  • Can you enable debug level logs in Emby Server to maybe get some more information on why its responding with a 500 to the GET request?


I have tried breaking my HA config in various ways, but am unable to reproduce what you're seeing unfortunately.

I have tried with different API keys. 

Currently the configuration file looks like this...

# Emby Server
media_player:
  - platform: emby
    host: 192.168.1.100
    api_key: 6a7713d3a0a6422e985d5ff1ce4b01dc
    port: 8096
    ssl: false
    

But will be changed after posting to protect the API key.

With debug logs turned on I get the exact same messages.

 

2022-01-18 16:53:25.753 Info Server: http/1.1 GET http://192.168.1.100:8096/Sessions. UserAgent: Python/3.9 aiohttp/3.8.1
2022-01-18 16:53:25.757 Info Server: http/1.1 Response 500 to 192.168.1.200. Time: 4ms. http://192.168.1.100:8096/Sessions

seanbuff
Posted

I'm pretty much out of ideas.

Can you try removing HA from the picture, and just issue a basic cURL command to your Emby Server to pull back sessions?

curl -X GET "http://192.168.1.100:8096/emby/Sessions?api_key=6a7713d3a0a6422e985d5ff1ce4b01dc" -H "accept: application/json"

Any valid response means Emby was okay with the GET request.

Or if command line is not ideal, you could try using an app like Postman to achieve the same thing:
image.png.83905d68bb59bbd862f6c94c94217f98.png


Ideally if you could perform the above from the HA docker, that would help simulate an exact scenario.

Let us know how you go.

Posted (edited)
18 hours ago, seanbuff said:

I'm pretty much out of ideas.

Can you try removing HA from the picture, and just issue a basic cURL command to your Emby Server to pull back sessions?

curl -X GET "http://192.168.1.100:8096/emby/Sessions?api_key=6a7713d3a0a6422e985d5ff1ce4b01dc" -H "accept: application/json"

Any valid response means Emby was okay with the GET request.

Or if command line is not ideal, you could try using an app like Postman to achieve the same thing:
image.png.83905d68bb59bbd862f6c94c94217f98.png


Ideally if you could perform the above from the HA docker, that would help simulate an exact scenario.

Let us know how you go.

The command works fine from my PC and Windows VM through cmd and in a browser window. in Hssio cli I get.....

  curl: (56) Recv failure: Connection reset by peer.

Still unsure whether emby doesn't like the HA vm or the other way around. 

emby can still ping HA through the docker console and HA can ping emby through cli. 

Was there anything wrong with how the API key was written in the conf file...? Does it need a slash or quotes or anything?

Edited by Milldor
seanbuff
Posted
5 hours ago, Milldor said:

Was there anything wrong with how the API key was written in the conf file...? Does it need a slash or quotes or anything?

No, there's nothing wrong with your HA config, api_key looks fine. (I already tried sending a dummy API key, and that's not the response you get)

5 hours ago, Milldor said:

emby can still ping HA through the docker console and HA can ping emby through cli.

pinging a host is very different to sending a specific service on that host a request - a response to ping doesn't necessarily mean all comms between the two will work. 

which you've proven by testing a request from various devices, the problem clearly lies with your HA docker. The fact that Emby responded to those other devices, but not HA, tells me that Emby is not the problem here. I'd be guessing that there is some kind of networking firewall that needs to be opened on that docker host or image.

The outgoing request on 8096 is leaving HA, but the response seems to be blocked on the way back.

If you could run a wireshark or tcpdump trace on either source or destination, it might give you more insights. But i think you've narrowed down where the problem might be.

Posted (edited)

I have just found that it works perfectly fine through port 1 on my Unraid server but not through port 2.

So half fixed I guess. I just need to find out why that port is acting so strangely, but that problem is not for here. Thanks for the help.😀

Edited by Milldor
  • Thanks 1
  • 7 months later...
Posted

Hi!

I am having a very similar problem. It drives me nuts!

Logger: pyemby.server Source: runner.py:119 First occurred: 17:14:44 (1 occurrences) Last logged: 17:14:44  Unable to register emby client.Logger: pyemby.server Source: runner.py:119 First occurred: 17:14:44 (10023 occurrences) Last logged: 17:14:44  Unable to register emby client.

Logger: pyemby.server Source: /usr/local/lib/python3.10/site-packages/pyemby/server.py:252 First occurred: 17:14:44 (10048 occurrences) Last logged: 17:14:44  Error fetching Emby data: Cannot connect to host http:443 ssl:default [Name does not resolve]s

I am able to ping, log in and scrobble through media from Home assistant. Everything actually works but I can't get rid of these error messages.

I would appreciate some guidance, pointers or advice.

 

 

My system:
Screenshot_20220919-173223.thumb.jpg.e2a7f769cea6e06059f3a63a58e9916b.jpgHome Assistant 2022.9.5 Supervisor 2022.09.1 Operating System 9.0 Frontend-version: 20220907.2 - latest

 

Screenshot_20220919-173742.jpg

Posted
6 hours ago, fritzo said:

I would appreciate some guidance, pointers or advice.

You're connecting with "ssl = true"

So just get rid of the "http://" portion from your host string and just leave the IP in your configuration.yaml file.

 

Posted (edited)
21 hours ago, seanbuff said:

You're connecting with "ssl = true"

So just get rid of the "http://" portion from your host string and just leave the IP in your configuration.yaml file.

 

Of course you are right, i forgot to remove http when changing http/https.

A solution is still needed.

The problem persists on both http and https.

Edited by fritzo
Posted
3 hours ago, fritzo said:

A solution is still needed.

I'm sorry, I'm a little confused.

Your config screens do not look like they are from Emby. Are you using Jellyfin as per your ssl certificate path? If so, then you should be using the native Jellyfin integration for HA and not Emby.

Hope that helps.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...