mirror of
https://github.com/home-assistant/core.git
synced 2025-08-12 17:15:19 +02:00
Check the registry entry in sensor unit_of_measurement instead of unique_id (#96731)
The unit_of_measurement check was checking to see if the entity has a unique_id instead of a registry entry. Its much cheaper to check for the registry_entry than the unique id since some entity have to construct it every time its read
This commit is contained in:
@@ -453,7 +453,7 @@ class SensorEntity(Entity):
|
||||
return self._sensor_option_unit_of_measurement
|
||||
|
||||
# Second priority, for non registered entities: unit suggested by integration
|
||||
if not self.unique_id and (
|
||||
if not self.registry_entry and (
|
||||
suggested_unit_of_measurement := self.suggested_unit_of_measurement
|
||||
):
|
||||
return suggested_unit_of_measurement
|
||||
|
Reference in New Issue
Block a user