Handle the case where no registration number is available (instead display VIN (vehicle identification number)). (#9073)

This commit is contained in:
Erik Eriksson authored and Paulus Schoutsen committed 2017-09-05 09:10:01 -07:00
1 parent e4bb8b0444
commit 418ccc820a
2 files changed
+33 -17

No files matched your search

@@ -20,11 +20,12 @@ def setup_scanner(hass, config, see, discovery_info=None):
return
vin, _ = discovery_info
vehicle = hass.data[DATA_KEY].vehicles[vin]
voc = hass.data[DATA_KEY]
vehicle = voc.vehicles[vin]
def see_vehicle(vehicle):
"""Handle the reporting of the vehicle position."""
host_name = vehicle.registration_number
host_name = voc.vehicle_name(vehicle)
dev_id = 'volvo_{}'.format(slugify(host_name))
see(dev_id=dev_id,
host_name=host_name,