Stop GTFS component from overwriting friendly_name (#3798)
* Prevent update from clobbering configured name. * linted * Fixing awkward line breaking.pull/3812/head
parent
9b98d470c2
commit
c8ca66b671
|
@ -185,7 +185,8 @@ class GTFSDepartureSensor(Entity):
|
||||||
self._pygtfs = pygtfs
|
self._pygtfs = pygtfs
|
||||||
self.origin = origin
|
self.origin = origin
|
||||||
self.destination = destination
|
self.destination = destination
|
||||||
self._name = name
|
self._custom_name = name
|
||||||
|
self._name = ''
|
||||||
self._unit_of_measurement = 'min'
|
self._unit_of_measurement = 'min'
|
||||||
self._state = 0
|
self._state = 0
|
||||||
self._attributes = {}
|
self._attributes = {}
|
||||||
|
@ -233,9 +234,10 @@ class GTFSDepartureSensor(Entity):
|
||||||
trip = self._departure['trip']
|
trip = self._departure['trip']
|
||||||
|
|
||||||
name = '{} {} to {} next departure'
|
name = '{} {} to {} next departure'
|
||||||
self._name = name.format(agency.agency_name,
|
self._name = (self._custom_name or
|
||||||
origin_station.stop_id,
|
name.format(agency.agency_name,
|
||||||
destination_station.stop_id)
|
origin_station.stop_id,
|
||||||
|
destination_station.stop_id))
|
||||||
|
|
||||||
# Build attributes
|
# Build attributes
|
||||||
self._attributes = {}
|
self._attributes = {}
|
||||||
|
|
Loading…
Reference in New Issue