From 24c382d689c6980bb702763c7a4901eb93cc58f2 Mon Sep 17 00:00:00 2001 From: Dougal Matthews Date: Thu, 6 Feb 2020 16:52:46 +0000 Subject: [PATCH] Only normalise Garmin connect data to minutes if the value is not None (#31526) Otherwise this causes additional TypeError messages to be logged for division of None. --- homeassistant/components/garmin_connect/sensor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/garmin_connect/sensor.py b/homeassistant/components/garmin_connect/sensor.py index 51ec421e02b..737d53b2109 100644 --- a/homeassistant/components/garmin_connect/sensor.py +++ b/homeassistant/components/garmin_connect/sensor.py @@ -165,9 +165,9 @@ class GarminConnectSensor(Entity): return data = self._data.data - if "Duration" in self._type: + if "Duration" in self._type and data[self._type]: self._state = data[self._type] // 60 - elif "Seconds" in self._type: + elif "Seconds" in self._type and data[self._type]: self._state = data[self._type] // 60 else: self._state = data[self._type]