core
core copied to clipboard
Exception: 'SonarrQueueDetail' object has no attribute 'timeleft'
The problem
After upgrading core, the Sonarr integration has started throwing the following exception.
What version of Home Assistant Core has the issue?
2022.11.0
What was the last working version of Home Assistant Core?
2022.10.x
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Sonarr
Link to integration documentation on our website
https://www.home-assistant.io/integrations/sonarr
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
2022-11-03 11:54:59.789 ERROR (MainThread) [homeassistant.components.sonarr] Unexpected error fetching sonarr data: 'SonarrQueueDetail' object has no attribute 'timeleft'
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiopyarr/request_client.py", line 183, in _async_request
response = BaseModel(
File "/usr/local/lib/python3.10/site-packages/aiopyarr/models/base.py", line 95, in __init__
value = generate_data(value, datatype)
File "/usr/local/lib/python3.10/site-packages/aiopyarr/models/base.py", line 78, in generate_data
return datatype(data)
File "/usr/local/lib/python3.10/site-packages/aiopyarr/models/base.py", line 116, in __init__
self.__post_init__()
File "/usr/local/lib/python3.10/site-packages/aiopyarr/models/sonarr.py", line 193, in __post_init__
self.records = [SonarrQueueDetail(record) for record in self.records]
File "/usr/local/lib/python3.10/site-packages/aiopyarr/models/sonarr.py", line 193, in <listcomp>
self.records = [SonarrQueueDetail(record) for record in self.records]
File "/usr/local/lib/python3.10/site-packages/aiopyarr/models/base.py", line 116, in __init__
self.__post_init__()
File "/usr/local/lib/python3.10/site-packages/aiopyarr/models/sonarr.py", line 176, in __post_init__
super().__post_init__()
File "/usr/local/lib/python3.10/site-packages/aiopyarr/models/request_common.py", line 165, in __post_init__
and self.timeleft == "00:00:00"
AttributeError: 'SonarrQueueDetail' object has no attribute 'timeleft'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh
self.data = await self._async_update_data()
File "/usr/src/homeassistant/homeassistant/components/sonarr/coordinator.py", line 67, in _async_update_data
return await self._fetch_data()
File "/usr/src/homeassistant/homeassistant/components/sonarr/coordinator.py", line 118, in _fetch_data
return await self.api_client.async_get_queue(
File "/usr/local/lib/python3.10/site-packages/aiopyarr/sonarr_client.py", line 137, in async_get_queue
return await self._async_request("queue", params=params, datatype=SonarrQueue)
File "/usr/local/lib/python3.10/site-packages/aiopyarr/request_client.py", line 207, in _async_request
raise ArrException(self, ex) from ex
aiopyarr.exceptions.ArrException: 'SonarrQueueDetail' object has no attribute 'timeleft'
Additional information
No response
Hey there @ctalkington, mind taking a look at this issue as it has been labeled with an integration (sonarr
) you are listed as a code owner for? Thanks!
Code owner commands
Code owners of sonarr
can trigger bot actions by commenting:
-
@home-assistant close
Closes the issue. -
@home-assistant rename Awesome new title
Change the title of the issue. -
@home-assistant reopen
Reopen the issue. -
@home-assistant unassign sonarr
Removes the current integration label and assignees on the issue, add the integration domain after the command.
(message by CodeOwnersMention)
sonarr documentation sonarr source (message by IssueLinks)
This seems to stem from this PR merged in aiopyarr: https://github.com/tkdrob/aiopyarr/pull/56
Looking at the python code, not every model class seems to implement timeleft
so this PR made a wrong assumption. I'll open a ticket with the upstream repository.
I've narrowed this down to having stalled qBittorrent downloads in your queue as you can see in the issue linked in aiopyarr above. You can either remove your stalled downloads, or move them out of the Sonarr download category if you have that set; that fixes the error for me.
Thanks. Seems like a good workaround until a fix is merged. I see you submitted a PR, so hopefully that resolves it
More on what @NanoSector was saying, this appears to differ between download clients. I don't use qBittorrent and am not having this issue.
Nor do I - I am using transmission
I see it's been added to the 2022.11.2 milestone - thanks @tkdrob !
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
I was seeing this regularly before, and I haven't seen this in some time, so I suspect it's been resolved by the above releases, though I don't have any technical insight to back that up.
Issues is also present in Lidarr (built on same common code). Will attempt to move stalled qBit torrents to another catagory to test but both can confirm issue is still preset….. I’ll post follow up after testing the relocation of torrents and can provide logs if desired but it seems the problem was well understood just yet to see fix pushed for this. Thanks !
Issues is also present in Lidarr (built on same common code). Will attempt to move stalled qBit torrents to another catagory to test but both can confirm issue is still preset….. I’ll post follow up after testing the relocation of torrents and can provide logs if desired but it seems the problem was well understood just yet to see fix pushed for this. Thanks !
Have you updated to the latest Home Assistant?
Issues is also present in Lidarr (built on same common code). Will attempt to move stalled qBit torrents to another catagory to test but both can confirm issue is still preset….. I’ll post follow up after testing the relocation of torrents and can provide logs if desired but it seems the problem was well understood just yet to see fix pushed for this. Thanks !
Have you updated to the latest Home Assistant?
Apologies for the brevity in my earlier post. I opened an issue directly under Lidarr (referenced above). With further details and referring back here for potential context.
To answer your question, yes I am on HA:latest, and Lidarr:latest, pulled earlier this morning before regression testing above. Specifically Lidarr Version: 1.0.2.2592, HA docker: 2023.3.6 Frontend 20230309.1
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.