Fix Tile location accuracy bug (#37233)

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
Aaron Bach 2020-06-29 18:25:01 -06:00 committed by GitHub
parent 856f8fd6de
commit 0f43476d03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -84,6 +84,11 @@ class TileDeviceTracker(TileEntity, TrackerEntity):
Value in meters.
"""
state = self._tile["last_tile_state"]
h_accuracy = state.get("h_accuracy")
v_accuracy = state.get("v_accuracy")
if h_accuracy is not None and v_accuracy is not None:
return round(
(
self._tile["last_tile_state"]["h_accuracy"]
@ -92,6 +97,14 @@ class TileDeviceTracker(TileEntity, TrackerEntity):
/ 2
)
if h_accuracy is not None:
return h_accuracy
if v_accuracy is not None:
return v_accuracy
return None
@property
def latitude(self) -> float:
"""Return latitude value of the device."""