mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 14:27:07 +00:00
Add links to deprecation issue message for Home Connect Binary door (#129779)
This commit is contained in:
parent
f10063c9be
commit
ae1203336d
@ -12,6 +12,7 @@ from homeassistant.components.binary_sensor import (
|
|||||||
from homeassistant.components.script import scripts_with_entity
|
from homeassistant.components.script import scripts_with_entity
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers import entity_registry as er
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.issue_registry import (
|
from homeassistant.helpers.issue_registry import (
|
||||||
IssueSeverity,
|
IssueSeverity,
|
||||||
@ -192,11 +193,32 @@ class HomeConnectDoorBinarySensor(HomeConnectBinarySensor):
|
|||||||
async def async_added_to_hass(self) -> None:
|
async def async_added_to_hass(self) -> None:
|
||||||
"""Call when entity is added to hass."""
|
"""Call when entity is added to hass."""
|
||||||
await super().async_added_to_hass()
|
await super().async_added_to_hass()
|
||||||
entity_automations = automations_with_entity(self.hass, self.entity_id)
|
automations = automations_with_entity(self.hass, self.entity_id)
|
||||||
entity_scripts = scripts_with_entity(self.hass, self.entity_id)
|
scripts = scripts_with_entity(self.hass, self.entity_id)
|
||||||
items = entity_automations + entity_scripts
|
items = automations + scripts
|
||||||
if not items:
|
if not items:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
entity_reg: er.EntityRegistry = er.async_get(self.hass)
|
||||||
|
entity_automations = [
|
||||||
|
automation_entity
|
||||||
|
for automation_id in automations
|
||||||
|
if (automation_entity := entity_reg.async_get(automation_id))
|
||||||
|
]
|
||||||
|
entity_scripts = [
|
||||||
|
script_entity
|
||||||
|
for script_id in scripts
|
||||||
|
if (script_entity := entity_reg.async_get(script_id))
|
||||||
|
]
|
||||||
|
|
||||||
|
items_list = [
|
||||||
|
f"- [{item.original_name}](/config/automation/edit/{item.unique_id})"
|
||||||
|
for item in entity_automations
|
||||||
|
] + [
|
||||||
|
f"- [{item.original_name}](/config/script/edit/{item.unique_id})"
|
||||||
|
for item in entity_scripts
|
||||||
|
]
|
||||||
|
|
||||||
async_create_issue(
|
async_create_issue(
|
||||||
self.hass,
|
self.hass,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
@ -207,7 +229,7 @@ class HomeConnectDoorBinarySensor(HomeConnectBinarySensor):
|
|||||||
translation_key="deprecated_binary_common_door_sensor",
|
translation_key="deprecated_binary_common_door_sensor",
|
||||||
translation_placeholders={
|
translation_placeholders={
|
||||||
"entity": self.entity_id,
|
"entity": self.entity_id,
|
||||||
"items": "\n".join([f"- {item}" for item in items]),
|
"items": "\n".join(items_list),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user