Skip to content

Commit

Permalink
Updated example with location and street address.
Browse files Browse the repository at this point in the history
Signed-off-by: Trocotronic <[email protected]>
  • Loading branch information
trocotronic committed Jul 9, 2021
1 parent 99757ec commit 0ad8c7c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion example.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from NativeAPI import WeConnect
import logging
import requests

logging.getLogger().setLevel(logging.WARN)
vwc = WeConnect()
Expand Down Expand Up @@ -93,4 +94,10 @@
avtyre = {'left_front':'Left front', 'right_front':'Right front', 'left_rear':'Left rear', 'right_rear':'Right rear','spare':'Spare'}
for d in avtyre.items():
print('\t\t{}: {} (desired {}, diff {})'.format(d[1], tyre['current_'+d[0]], tyre['desired_'+d[0]], tyre['difference_'+d[0]]))

pos = vwc.get_position(vin)
latlong = pos['storedPositionResponse']['position']['carCoordinate']
data = requests.get('https://nominatim.openstreetmap.org/search.php?q='+str(latlong['latitude']/1e6)+','+str(latlong['longitude']/1e6)+'&polygon_geojson=1&format=jsonv2')
j = data.json()
if (len(j) > 0):
print('\tLocation: '+j[0]['display_name'])

0 comments on commit 0ad8c7c

Please sign in to comment.