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.
This commit is contained in:
Dougal Matthews 2020-02-06 16:52:46 +00:00 committed by GitHub
parent 7233048fea
commit 24c382d689
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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]