From c8ca66b671d77638f040a0563cf325c5de810c5f Mon Sep 17 00:00:00 2001 From: phardy Date: Tue, 11 Oct 2016 16:36:20 +1100 Subject: [PATCH] Stop GTFS component from overwriting friendly_name (#3798) * Prevent update from clobbering configured name. * linted * Fixing awkward line breaking. --- homeassistant/components/sensor/gtfs.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/sensor/gtfs.py b/homeassistant/components/sensor/gtfs.py index 2a5f4aa0de6..5fcf46832db 100644 --- a/homeassistant/components/sensor/gtfs.py +++ b/homeassistant/components/sensor/gtfs.py @@ -185,7 +185,8 @@ class GTFSDepartureSensor(Entity): self._pygtfs = pygtfs self.origin = origin self.destination = destination - self._name = name + self._custom_name = name + self._name = '' self._unit_of_measurement = 'min' self._state = 0 self._attributes = {} @@ -233,9 +234,10 @@ class GTFSDepartureSensor(Entity): trip = self._departure['trip'] name = '{} {} to {} next departure' - self._name = name.format(agency.agency_name, - origin_station.stop_id, - destination_station.stop_id) + self._name = (self._custom_name or + name.format(agency.agency_name, + origin_station.stop_id, + destination_station.stop_id)) # Build attributes self._attributes = {}