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:
Kevin Stillhammer 2022-10-12 02:22:21 +02:00 committed by GitHub
parent a18f8d2ff3
commit 712f40b6b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,7 +57,7 @@ def sensor_descriptions(travel_mode: str) -> tuple[SensorEntityDescription, ...]
native_unit_of_measurement=TIME_MINUTES,
),
SensorEntityDescription(
name="Duration in Traffic",
name="Duration in traffic",
icon=ICONS.get(travel_mode, ICON_CAR),
key=ATTR_DURATION_IN_TRAFFIC,
state_class=SensorStateClass.MEASUREMENT,
@ -106,7 +106,6 @@ class HERETravelTimeSensor(SensorEntity, CoordinatorEntity):
"""Initialize the sensor."""
super().__init__(coordinator)
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_device_info = DeviceInfo(
identifiers={(DOMAIN, unique_id_prefix)},
@ -114,6 +113,7 @@ class HERETravelTimeSensor(SensorEntity, CoordinatorEntity):
name=name,
manufacturer="HERE Technologies",
)
self._attr_has_entity_name = True
async def async_added_to_hass(self) -> None:
"""Wait for start so origin and destination entities can be resolved."""