mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00: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:
parent
51a7df162c
commit
260e00ffb4
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user