1
mirror of https://github.com/home-assistant/core synced 2024-08-02 23:40:32 +02:00

Update sonarr sensor (#71576)

Fixed issue when episodeFileCount/episodeCount might not exist
This commit is contained in:
Clifford W. Hansen 2022-05-14 05:09:09 +02:00 committed by GitHub
parent d84c6af55d
commit ef9d8944f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -237,7 +237,7 @@ class SonarrSensor(SonarrEntity, SensorEntity):
stats = item.statistics
attrs[
item.title
] = f"{stats.episodeFileCount}/{stats.episodeCount} Episodes"
] = f"{getattr(stats,'episodeFileCount', 0)}/{getattr(stats, 'episodeCount', 0)} Episodes"
elif key == "upcoming" and self.data.get(key) is not None:
for episode in self.data[key]:
identifier = f"S{episode.seasonNumber:02d}E{episode.episodeNumber:02d}"