custom-components/sensor.radarr_upcoming_media

radarr_upcoming_media: Error on device update

Closed this issue · 7 comments

Describe the Bug
sensor not showing in states - radarr_upcoming_media: Error on device update

The Error
Traceback (most recent call last):
File "/config/custom_components/radarr_upcoming_media/sensor.py", line 183, in update
'780', tmdb_json['backdrop_path'])
IndexError: list assignment index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 299, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 461, in async_device_update
await self.hass.async_add_executor_job(self.update)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/radarr_upcoming_media/sensor.py", line 185, in update
movie['images'][1] = ''
IndexError: list assignment index out of range

Indicate if you followed all steps in the troubleshooting doc
All steps followed

What data does the sensor display if any?
Sensor is not displayed in states

What displays when visiting the API URL from the troubleshooting guide?
When visiting API URL info is displayed correctly

Does the default Home Assistant Radarr component work for you?
Yes, default component works

Home Assistant Version
0.104.3

Additional Context
``
radarr_issue

Same error here. Any update/fix?

For anyone else with this issue, edit /config/custom_components/radarr_upcoming_media/sensor.py
Go to line 182 and remove this entire section

 try:
                        movie['images'][1] = image_url % (
                            '780', tmdb_json['backdrop_path'])
                    except:
                        movie['images'][1] = ''

Reboot home assistant so it reads the configuration and it will work

This fix will only work if you do not use fanart view. I would be interested in knowing what movie is causing this issue as it would help me track it down. If you could share the results from a direct connection to the radarr api and the sensor's data from HA it would be helpful. If you're more comfortable sending this to me via PM on the HA forums, don't hesitate to do so. My username over there is mayker with an e instead of the last a I use here.

Could be as simple as a movie just not having a backdrop file, in which case something like this would do it:

                    try:
                        movie['images'][1] = image_url % (
                            '780', tmdb_json['backdrop_path'])
                    except:
                        pass

That looks to work as well

Try latest release, if that does it you can safely close this issue

Fix works for me. I cant close this since I'm not the ticket owner