mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Add has_entity_name support to hvv_departures (#80963)
This commit is contained in:
parent
fbe7a0289c
commit
0d4b1866a7
@ -55,9 +55,9 @@ async def async_setup_entry(
|
|||||||
description = elevator.get("description")
|
description = elevator.get("description")
|
||||||
|
|
||||||
if label is not None:
|
if label is not None:
|
||||||
name = f"Elevator {label} at {station_name}"
|
name = f"Elevator {label}"
|
||||||
else:
|
else:
|
||||||
name = f"Unknown elevator at {station_name}"
|
name = "Unknown elevator"
|
||||||
|
|
||||||
if description is not None:
|
if description is not None:
|
||||||
name += f" ({description})"
|
name += f" ({description})"
|
||||||
@ -126,6 +126,7 @@ class HvvDepartureBinarySensor(CoordinatorEntity, BinarySensorEntity):
|
|||||||
"""HVVDepartureBinarySensor class."""
|
"""HVVDepartureBinarySensor class."""
|
||||||
|
|
||||||
_attr_attribution = ATTRIBUTION
|
_attr_attribution = ATTRIBUTION
|
||||||
|
_attr_has_entity_name = True
|
||||||
|
|
||||||
def __init__(self, coordinator, idx, config_entry):
|
def __init__(self, coordinator, idx, config_entry):
|
||||||
"""Initialize."""
|
"""Initialize."""
|
||||||
|
@ -65,7 +65,8 @@ class HVVDepartureSensor(SensorEntity):
|
|||||||
self.station_name = self.config_entry.data[CONF_STATION]["name"]
|
self.station_name = self.config_entry.data[CONF_STATION]["name"]
|
||||||
self._attr_extra_state_attributes = {}
|
self._attr_extra_state_attributes = {}
|
||||||
self._attr_available = False
|
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._last_error = None
|
||||||
|
|
||||||
self.gti = hub.gti
|
self.gti = hub.gti
|
||||||
@ -178,5 +179,5 @@ class HVVDepartureSensor(SensorEntity):
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
manufacturer=MANUFACTURER,
|
manufacturer=MANUFACTURER,
|
||||||
name=self.name,
|
name=self.config_entry.data[CONF_STATION]["name"],
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user