mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Add has_entity_name for here_travel_time (#80011)
* Add has_entity_name for here_travel_time * Duration in traffic
This commit is contained in:
parent
a18f8d2ff3
commit
712f40b6b0
@ -57,7 +57,7 @@ def sensor_descriptions(travel_mode: str) -> tuple[SensorEntityDescription, ...]
|
|||||||
native_unit_of_measurement=TIME_MINUTES,
|
native_unit_of_measurement=TIME_MINUTES,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
name="Duration in Traffic",
|
name="Duration in traffic",
|
||||||
icon=ICONS.get(travel_mode, ICON_CAR),
|
icon=ICONS.get(travel_mode, ICON_CAR),
|
||||||
key=ATTR_DURATION_IN_TRAFFIC,
|
key=ATTR_DURATION_IN_TRAFFIC,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
@ -106,7 +106,6 @@ class HERETravelTimeSensor(SensorEntity, CoordinatorEntity):
|
|||||||
"""Initialize the sensor."""
|
"""Initialize the sensor."""
|
||||||
super().__init__(coordinator)
|
super().__init__(coordinator)
|
||||||
self.entity_description = sensor_description
|
self.entity_description = sensor_description
|
||||||
self._attr_name = f"{name} {sensor_description.name}"
|
|
||||||
self._attr_unique_id = f"{unique_id_prefix}_{sensor_description.key}"
|
self._attr_unique_id = f"{unique_id_prefix}_{sensor_description.key}"
|
||||||
self._attr_device_info = DeviceInfo(
|
self._attr_device_info = DeviceInfo(
|
||||||
identifiers={(DOMAIN, unique_id_prefix)},
|
identifiers={(DOMAIN, unique_id_prefix)},
|
||||||
@ -114,6 +113,7 @@ class HERETravelTimeSensor(SensorEntity, CoordinatorEntity):
|
|||||||
name=name,
|
name=name,
|
||||||
manufacturer="HERE Technologies",
|
manufacturer="HERE Technologies",
|
||||||
)
|
)
|
||||||
|
self._attr_has_entity_name = True
|
||||||
|
|
||||||
async def async_added_to_hass(self) -> None:
|
async def async_added_to_hass(self) -> None:
|
||||||
"""Wait for start so origin and destination entities can be resolved."""
|
"""Wait for start so origin and destination entities can be resolved."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user