mirror of
https://github.com/home-assistant/core.git
synced 2025-07-29 08:07:45 +00:00
Fix error when Series missing 'episodeFileCount' or 'episodeCount' (#15824)
* Fix error when Series missing 'episodeFileCount' or 'episodeCount' * Update sonarr.py * Update sonarr.py
This commit is contained in:
parent
9cfe0db3c8
commit
6031801206
@ -158,8 +158,12 @@ class SonarrSensor(Entity):
|
|||||||
)
|
)
|
||||||
elif self.type == 'series':
|
elif self.type == 'series':
|
||||||
for show in self.data:
|
for show in self.data:
|
||||||
attributes[show['title']] = '{}/{} Episodes'.format(
|
if 'episodeFileCount' not in show \
|
||||||
show['episodeFileCount'], show['episodeCount'])
|
or 'episodeCount' not in show:
|
||||||
|
attributes[show['title']] = 'N/A'
|
||||||
|
else:
|
||||||
|
attributes[show['title']] = '{}/{} Episodes'.format(
|
||||||
|
show['episodeFileCount'], show['episodeCount'])
|
||||||
elif self.type == 'status':
|
elif self.type == 'status':
|
||||||
attributes = self.data
|
attributes = self.data
|
||||||
return attributes
|
return attributes
|
||||||
|
Loading…
x
Reference in New Issue
Block a user