Avoid duplicate property lookups in camera state_attributes (#107627)
This commit is contained in:
parent
955c70b8f1
commit
a0b00d78b1
1 changed files with 8 additions and 8 deletions
|
@ -726,17 +726,17 @@ class Camera(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
|
|||
"""Return the camera state attributes."""
|
||||
attrs = {"access_token": self.access_tokens[-1]}
|
||||
|
||||
if self.model:
|
||||
attrs["model_name"] = self.model
|
||||
if model := self.model:
|
||||
attrs["model_name"] = model
|
||||
|
||||
if self.brand:
|
||||
attrs["brand"] = self.brand
|
||||
if brand := self.brand:
|
||||
attrs["brand"] = brand
|
||||
|
||||
if self.motion_detection_enabled:
|
||||
attrs["motion_detection"] = self.motion_detection_enabled
|
||||
if motion_detection_enabled := self.motion_detection_enabled:
|
||||
attrs["motion_detection"] = motion_detection_enabled
|
||||
|
||||
if self.frontend_stream_type:
|
||||
attrs["frontend_stream_type"] = self.frontend_stream_type
|
||||
if frontend_stream_type := self.frontend_stream_type:
|
||||
attrs["frontend_stream_type"] = frontend_stream_type
|
||||
|
||||
return attrs
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue