mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Small speedup to processing entity customize (#121271)
This commit is contained in:
parent
cdb2ec4231
commit
e71f6c5948
@ -1185,11 +1185,18 @@ class Entity(
|
||||
report_issue,
|
||||
)
|
||||
|
||||
# Overwrite properties that have been set in the config file.
|
||||
if (customize := hass.data.get(DATA_CUSTOMIZE)) and (
|
||||
custom := customize.get(entity_id)
|
||||
):
|
||||
attr.update(custom)
|
||||
try:
|
||||
# Most of the time this will already be
|
||||
# set and since try is near zero cost
|
||||
# on py3.11+ its faster to assume it is
|
||||
# set and catch the exception if it is not.
|
||||
customize = hass.data[DATA_CUSTOMIZE]
|
||||
except KeyError:
|
||||
pass
|
||||
else:
|
||||
# Overwrite properties that have been set in the config file.
|
||||
if custom := customize.get(entity_id):
|
||||
attr.update(custom)
|
||||
|
||||
if (
|
||||
self._context_set is not None
|
||||
|
Loading…
x
Reference in New Issue
Block a user