Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: G Johansson <[email protected]>
  • Loading branch information
G-Two and gjohansson-ST authored Jul 29, 2023
1 parent e528769 commit 49c185a
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions homeassistant/components/subaru/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,30 +61,27 @@ def __init__(self, vehicle_info: dict, coordinator: DataUpdateCoordinator) -> No
@property
def extra_state_attributes(self) -> dict[str, Any] | None:
"""Return entity specific state attributes."""
extra_attributes = None
if self.vin in self.coordinator.data:
extra_attributes = {
return {
"Position timestamp": self.coordinator.data[self.vin][
VEHICLE_STATUS
].get(TIMESTAMP)
}
return extra_attributes
return None

@property
def latitude(self) -> float | None:
"""Return latitude value of the vehicle."""
latitude = None
if self.vin in self.coordinator.data:
latitude = self.coordinator.data[self.vin][VEHICLE_STATUS].get(LATITUDE)
return latitude
return self.coordinator.data[self.vin][VEHICLE_STATUS].get(LATITUDE)
return None

@property
def longitude(self) -> float | None:
"""Return longitude value of the vehicle."""
longitude = None
if self.vin in self.coordinator.data:
longitude = self.coordinator.data[self.vin][VEHICLE_STATUS].get(LONGITUDE)
return longitude
return self.coordinator.data[self.vin][VEHICLE_STATUS].get(LONGITUDE)
return None

@property
def source_type(self) -> SourceType:
Expand Down

0 comments on commit 49c185a

Please sign in to comment.