Fix unnecessary calls to update entity display_precision (#118159)

This commit is contained in:
J. Nick Koston 2024-05-26 01:32:59 -10:00 committed by GitHub
parent 80371d3a73
commit dff8c06166
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -787,10 +787,10 @@ class SensorEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
display_precision = max(0, display_precision + ratio_log)
sensor_options: Mapping[str, Any] = self.registry_entry.options.get(DOMAIN, {})
if (
"suggested_display_precision" in sensor_options
and sensor_options["suggested_display_precision"] == display_precision
):
if "suggested_display_precision" not in sensor_options:
if display_precision is None:
return
elif sensor_options["suggested_display_precision"] == display_precision:
return
registry = er.async_get(self.hass)