gcorgnet / sensor.emby_upcoming_media

Home Assistant component to feed Upcoming Media Card with the latest releases on an Emby instance.
MIT License
20 stars 17 forks source link

KeyError: "ViewCategories" on setup #13

Open hanerd opened 3 years ago

hanerd commented 3 years ago

I can't get the sensor to actually install on HA .114 and Emby 4.4.3. It fails setup with the following error:


Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 184, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/emby_upcoming_media/sensor.py", line 85, in setup_platform
    categories = client.get_view_categories()
  File "/config/custom_components/emby_upcoming_media/client.py", line 41, in get_view_categories
    return self.data["ViewCategories"]
KeyError: 'ViewCategories'```
mhertel commented 3 years ago

I am having the same issue..

boardwarp commented 3 years ago

Same issue here. I previously had this working fine, then moved house and changed a bunch of network settings. Aside from updating the Emby configuration to the new IP, no Emby-specific settings have changed. My logs are identical to @hanerd's aside from the line numbers, but happy to help with other logs/troubleshooting.

Squale76 commented 3 years ago

Same problem here. I am under Emby 4.5.4.0 via a Docker image hosted on a NAS (IP: 192.168.0.240) and HA 2020.12.2 supervisor hosted via a Docker image on an RPi (IP 192.168.0.252). Did you find a solution or a workaround?

Squale76 commented 3 years ago

To work around the problem, you must connect to Emby via the account used by HA. Then go to Profile, get the URL that points to this page. It will be in this form: http://<emby_host_ip>: 8096/web/index.html #!/settings/profile.html?userId=<user_id>&serverId=<server_id> Retrieve the user_id that you put in the parameters in the HA configuration file configuraiton.yaml with this code :

sensor:
- platform: emby_upcoming_media
  api_key: YOUR_EMBY_API_KEY
  user_id: <user_id>
  host: <ip address of emby host>
boardwarp commented 3 years ago

To work around the problem, you must connect to Emby via the account used by HA...

This worked perfectly for me, thanks!