Add has_entity_name support to hvv_departures (#80963)
parent
fbe7a0289c
commit
0d4b1866a7
|
@ -55,9 +55,9 @@ async def async_setup_entry(
|
|||
description = elevator.get("description")
|
||||
|
||||
if label is not None:
|
||||
name = f"Elevator {label} at {station_name}"
|
||||
name = f"Elevator {label}"
|
||||
else:
|
||||
name = f"Unknown elevator at {station_name}"
|
||||
name = "Unknown elevator"
|
||||
|
||||
if description is not None:
|
||||
name += f" ({description})"
|
||||
|
@ -126,6 +126,7 @@ class HvvDepartureBinarySensor(CoordinatorEntity, BinarySensorEntity):
|
|||
"""HVVDepartureBinarySensor class."""
|
||||
|
||||
_attr_attribution = ATTRIBUTION
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(self, coordinator, idx, config_entry):
|
||||
"""Initialize."""
|
||||
|
|
|
@ -65,7 +65,8 @@ class HVVDepartureSensor(SensorEntity):
|
|||
self.station_name = self.config_entry.data[CONF_STATION]["name"]
|
||||
self._attr_extra_state_attributes = {}
|
||||
self._attr_available = False
|
||||
self._attr_name = f"Departures at {self.station_name}"
|
||||
self._attr_has_entity_name = True
|
||||
self._attr_name = "Departures"
|
||||
self._last_error = None
|
||||
|
||||
self.gti = hub.gti
|
||||
|
@ -178,5 +179,5 @@ class HVVDepartureSensor(SensorEntity):
|
|||
)
|
||||
},
|
||||
manufacturer=MANUFACTURER,
|
||||
name=self.name,
|
||||
name=self.config_entry.data[CONF_STATION]["name"],
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue