mirror of
https://github.com/home-assistant/core.git
synced 2025-04-26 18:27:51 +00:00
Use shorthand attributes in automation for name (#115246)
This commit is contained in:
parent
f8aec03c03
commit
59d92f16bd
@ -420,15 +420,10 @@ class UnavailableAutomationEntity(BaseAutomationEntity):
|
|||||||
raw_config: ConfigType | None,
|
raw_config: ConfigType | None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize an automation entity."""
|
"""Initialize an automation entity."""
|
||||||
self._name = name
|
self._attr_name = name
|
||||||
self._attr_unique_id = automation_id
|
self._attr_unique_id = automation_id
|
||||||
self.raw_config = raw_config
|
self.raw_config = raw_config
|
||||||
|
|
||||||
@property
|
|
||||||
def name(self) -> str:
|
|
||||||
"""Return the name of the entity."""
|
|
||||||
return self._name
|
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def referenced_labels(self) -> set[str]:
|
def referenced_labels(self) -> set[str]:
|
||||||
"""Return a set of referenced labels."""
|
"""Return a set of referenced labels."""
|
||||||
@ -488,7 +483,7 @@ class AutomationEntity(BaseAutomationEntity, RestoreEntity):
|
|||||||
trace_config: ConfigType,
|
trace_config: ConfigType,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize an automation entity."""
|
"""Initialize an automation entity."""
|
||||||
self._name = name
|
self._attr_name = name
|
||||||
self._trigger_config = trigger_config
|
self._trigger_config = trigger_config
|
||||||
self._async_detach_triggers: CALLBACK_TYPE | None = None
|
self._async_detach_triggers: CALLBACK_TYPE | None = None
|
||||||
self._cond_func = cond_func
|
self._cond_func = cond_func
|
||||||
@ -504,11 +499,6 @@ class AutomationEntity(BaseAutomationEntity, RestoreEntity):
|
|||||||
self._trace_config = trace_config
|
self._trace_config = trace_config
|
||||||
self._attr_unique_id = automation_id
|
self._attr_unique_id = automation_id
|
||||||
|
|
||||||
@property
|
|
||||||
def name(self) -> str:
|
|
||||||
"""Return the name of the entity."""
|
|
||||||
return self._name
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def extra_state_attributes(self) -> dict[str, Any]:
|
def extra_state_attributes(self) -> dict[str, Any]:
|
||||||
"""Return the entity state attributes."""
|
"""Return the entity state attributes."""
|
||||||
@ -732,7 +722,7 @@ class AutomationEntity(BaseAutomationEntity, RestoreEntity):
|
|||||||
translation_placeholders={
|
translation_placeholders={
|
||||||
"service": f"{err.domain}.{err.service}",
|
"service": f"{err.domain}.{err.service}",
|
||||||
"entity_id": self.entity_id,
|
"entity_id": self.entity_id,
|
||||||
"name": self.name or self.entity_id,
|
"name": self._attr_name or self.entity_id,
|
||||||
"edit": f"/config/automation/edit/{self.unique_id}",
|
"edit": f"/config/automation/edit/{self.unique_id}",
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user