From ef9d8944f1a45cdb9d10fe1c6f9a149620f80ca8 Mon Sep 17 00:00:00 2001 From: "Clifford W. Hansen" Date: Sat, 14 May 2022 05:09:09 +0200 Subject: [PATCH] Update sonarr sensor (#71576) Fixed issue when episodeFileCount/episodeCount might not exist --- homeassistant/components/sonarr/sensor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/sonarr/sensor.py b/homeassistant/components/sonarr/sensor.py index c9a946758c5..adc588f6951 100644 --- a/homeassistant/components/sonarr/sensor.py +++ b/homeassistant/components/sonarr/sensor.py @@ -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}"