Only normalise Garmin connect data to minutes if the value is not None ()

Otherwise this causes additional TypeError messages to be logged for
division of None.
pull/31547/head
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
1 changed files with 2 additions and 2 deletions
homeassistant/components/garmin_connect

View File

@ -165,9 +165,9 @@ class GarminConnectSensor(Entity):
return return
data = self._data.data data = self._data.data
if "Duration" in self._type: if "Duration" in self._type and data[self._type]:
self._state = data[self._type] // 60 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 self._state = data[self._type] // 60
else: else:
self._state = data[self._type] self._state = data[self._type]