Adding additional switches and sensors for Tesla (#12241)

* Adding switch for maxrange charging and sensors for odometer and range

* Fixing style errors
This commit is contained in:
Alan Tse 2018-03-04 02:35:38 -08:00 committed by Pascal Vizeli
parent ae257651bf
commit 36e9f523d1
3 changed files with 60 additions and 14 deletions

View file

@ -44,14 +44,15 @@ class TeslaDeviceTracker(object):
_LOGGER.debug("Updating device position: %s", name)
dev_id = slugify(device.uniq_name)
location = device.get_location()
lat = location['latitude']
lon = location['longitude']
attrs = {
'trackr_id': dev_id,
'id': dev_id,
'name': name
}
self.see(
dev_id=dev_id, host_name=name,
gps=(lat, lon), attributes=attrs
)
if location:
lat = location['latitude']
lon = location['longitude']
attrs = {
'trackr_id': dev_id,
'id': dev_id,
'name': name
}
self.see(
dev_id=dev_id, host_name=name,
gps=(lat, lon), attributes=attrs
)