Skip to content

Commit 43a321c

Browse files
Remove repair flow and related issue handling for missing calendar entity
1 parent abd251c commit 43a321c

File tree

4 files changed

+5
-139
lines changed

4 files changed

+5
-139
lines changed

custom_components/calendar_event/__init__.py

Lines changed: 5 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,11 @@
1414
from homeassistant.helpers import config_validation as cv
1515
from homeassistant.helpers import entity_registry as er
1616
from homeassistant.helpers.helper_integration import async_handle_source_entity_changes
17-
from homeassistant.helpers.issue_registry import (
18-
IssueSeverity,
19-
async_create_issue,
20-
async_delete_issue,
21-
)
2217
from homeassistant.helpers.typing import ConfigType
2318

2419
from .const import (
2520
CONF_CALENDAR_ENTITY_ID,
2621
DOMAIN,
27-
ISSUE_MISSING_CALENDAR_ENTITY,
2822
LOGGER,
2923
MIN_HA_VERSION,
3024
PLATFORMS,
@@ -61,52 +55,22 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
6155
entity_registry, entry.options[CONF_CALENDAR_ENTITY_ID]
6256
)
6357
except vol.Invalid:
64-
async_create_issue(
65-
hass,
66-
DOMAIN,
67-
f"{ISSUE_MISSING_CALENDAR_ENTITY}_{entry.entry_id}",
68-
is_fixable=True,
69-
severity=IssueSeverity.ERROR,
70-
translation_key="missing_calendar_entity",
71-
translation_placeholders={
72-
"calendar_entity": entry.options[CONF_CALENDAR_ENTITY_ID],
73-
"entry_title": entry.title or "Calendar Event",
74-
},
75-
data={"entry_id": entry.entry_id},
58+
LOGGER.error(
59+
"Failed to setup calendar_event for unknown entity %s",
60+
entry.options[CONF_CALENDAR_ENTITY_ID],
7661
)
7762

7863
return False
7964

80-
# Clean up any existing repair issues since the entity is now valid
81-
async_delete_issue(
82-
hass, DOMAIN, f"{ISSUE_MISSING_CALENDAR_ENTITY}_{entry.entry_id}"
83-
)
84-
8565
def set_source_entity_id_or_uuid(source_entity_id: str) -> None:
8666
hass.config_entries.async_update_entry(
8767
entry,
8868
options={**entry.options, CONF_CALENDAR_ENTITY_ID: source_entity_id},
8969
)
90-
# Clean up repair issue when entity is updated
91-
async_delete_issue(
92-
hass, DOMAIN, f"{ISSUE_MISSING_CALENDAR_ENTITY}_{entry.entry_id}"
93-
)
9470

9571
async def source_entity_removed() -> None:
96-
# The source entity has been removed, create a repair issue for the removed calendar entity.
97-
async_create_issue(
98-
hass,
99-
DOMAIN,
100-
f"{ISSUE_MISSING_CALENDAR_ENTITY}_{entry.entry_id}",
101-
is_fixable=True,
102-
severity=IssueSeverity.ERROR,
103-
translation_key="missing_calendar_entity",
104-
translation_placeholders={
105-
"calendar_entity": entry.options[CONF_CALENDAR_ENTITY_ID],
106-
"entry_title": entry.title or "Calendar Event",
107-
},
108-
data={"entry_id": entry.entry_id},
109-
)
72+
# The source entity has been removed, remove the config entry.
73+
await hass.config_entries.async_remove(entry.entry_id)
11074

11175
entry.async_on_unload(
11276
async_handle_source_entity_changes(
@@ -134,9 +98,4 @@ async def config_entry_update_listener(hass: HomeAssistant, entry: ConfigEntry)
13498
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
13599
"""Unload a config entry."""
136100

137-
# Clean up any repair issues when unloading the entry
138-
async_delete_issue(
139-
hass, DOMAIN, f"{ISSUE_MISSING_CALENDAR_ENTITY}_{entry.entry_id}"
140-
)
141-
142101
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)

custom_components/calendar_event/const.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,3 @@
2626
CONF_SUMMARY = "summary"
2727

2828
ATTR_DESCRIPTION = "description"
29-
30-
ISSUE_MISSING_CALENDAR_ENTITY = "missing_calendar_entity"

custom_components/calendar_event/repairs.py

Lines changed: 0 additions & 77 deletions
This file was deleted.

custom_components/calendar_event/translations/en.json

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,5 @@
3131
}
3232
}
3333
}
34-
},
35-
"issues": {
36-
"missing_calendar_entity": {
37-
"title": "Calendar entity missing for {entry_title}",
38-
"description": "The calendar entity `{calendar_entity}` is no longer available. Please select a new calendar entity to continue using this Calendar Event helper.",
39-
"fix_flow": {
40-
"step": {
41-
"confirm": {
42-
"title": "Update calendar entity",
43-
"description": "The calendar entity `{calendar_entity}` is no longer available for the Calendar Event helper '{entry_title}'. Click 'Submit' to open the configuration options and select a different calendar entity."
44-
}
45-
}
46-
}
47-
}
4834
}
4935
}

0 commit comments

Comments
 (0)