Skip to content

Commit

Permalink
Improve call to google api radar_api.py (#3)
Browse files Browse the repository at this point in the history
Only call google api when the POI is in the radius
  • Loading branch information
MelleD authored Sep 9, 2024
1 parent ca0c0e0 commit 2e4bac6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions custom_components/radar_warnings/radar_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ async def get_pois(self):
start_point = Point(self.latitude, self.longitude)
end_point = Point(poi_data['lat'], poi_data['lng'])
distance = geodesic(start_point, end_point).kilometers
poi_street = poi_data.get('street', None)
adress, adress_short, street = await self.get_adress(end_point, poi_street)
if distance <= self.radius_km:
poi_street = poi_data.get('street', None)
adress, adress_short, street = await self.get_adress(end_point, poi_street)
poi = POI(
id=poi_data['id'],
latitude=poi_data['lat'],
Expand Down

0 comments on commit 2e4bac6

Please sign in to comment.