mirror of
https://github.com/home-assistant/core.git
synced 2025-07-10 14:57:09 +00:00
Catch garmin_connect keyerrors with unknown entity type updates (#31608)
* Catch keyerrors with unknown entity type updates * Change debug level and removed . from log call
This commit is contained in:
parent
14e0dde055
commit
1093e25a30
@ -256,21 +256,21 @@ GARMIN_ENTITY_LIST = {
|
|||||||
"brpm",
|
"brpm",
|
||||||
"mdi:progress-clock",
|
"mdi:progress-clock",
|
||||||
None,
|
None,
|
||||||
True,
|
False,
|
||||||
],
|
],
|
||||||
"lowestRespirationValue": [
|
"lowestRespirationValue": [
|
||||||
"Lowest Respiration",
|
"Lowest Respiration",
|
||||||
"brpm",
|
"brpm",
|
||||||
"mdi:progress-clock",
|
"mdi:progress-clock",
|
||||||
None,
|
None,
|
||||||
True,
|
False,
|
||||||
],
|
],
|
||||||
"latestRespirationValue": [
|
"latestRespirationValue": [
|
||||||
"Latest Respiration",
|
"Latest Respiration",
|
||||||
"brpm",
|
"brpm",
|
||||||
"mdi:progress-clock",
|
"mdi:progress-clock",
|
||||||
None,
|
None,
|
||||||
True,
|
False,
|
||||||
],
|
],
|
||||||
"latestRespirationTimeGMT": [
|
"latestRespirationTimeGMT": [
|
||||||
"Latest Respiration Update",
|
"Latest Respiration Update",
|
||||||
|
@ -165,12 +165,16 @@ class GarminConnectSensor(Entity):
|
|||||||
return
|
return
|
||||||
|
|
||||||
data = self._data.data
|
data = self._data.data
|
||||||
|
try:
|
||||||
if "Duration" in self._type and data[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 and data[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]
|
||||||
|
except KeyError:
|
||||||
|
_LOGGER.debug("Entity type %s not found in fetched data", self._type)
|
||||||
|
return
|
||||||
|
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"Entity %s set to state %s %s", self._type, self._state, self._unit
|
"Entity %s set to state %s %s", self._type, self._state, self._unit
|
||||||
|
Loading…
x
Reference in New Issue
Block a user