Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion homeassistant/components/ecobee/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"name": "ecobee",
"codeowners": [],
"config_flow": true,
"dependencies": ["http", "repairs"],
"documentation": "https://www.home-assistant.io/integrations/ecobee",
"homekit": {
"models": ["EB", "ecobee*"]
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/ecobee/notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
ATTR_TARGET,
BaseNotificationService,
NotifyEntity,
migrate_notify_issue,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
Expand All @@ -18,7 +19,6 @@
from . import Ecobee, EcobeeData
from .const import DOMAIN
from .entity import EcobeeBaseEntity
from .repairs import migrate_notify_issue


def get_service(
Expand All @@ -43,7 +43,7 @@ def __init__(self, ecobee: Ecobee) -> None:

async def async_send_message(self, message: str = "", **kwargs: Any) -> None:
"""Send a message and raise issue."""
migrate_notify_issue(self.hass)
migrate_notify_issue(self.hass, DOMAIN, "Ecobee", "2024.11.0")
await self.hass.async_add_executor_job(
partial(self.send_message, message, **kwargs)
)
Expand Down
13 changes: 0 additions & 13 deletions homeassistant/components/ecobee/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,18 +163,5 @@
}
}
}
},
"issues": {
"migrate_notify": {
"title": "Migration of Ecobee notify service",
"fix_flow": {
"step": {
"confirm": {
"description": "The Ecobee `notify` service has been migrated. A new `notify` entity per Thermostat is available now.\n\nUpdate any automations to use the new `notify.send_message` exposed by these new entities. When this is done, fix this issue and restart Home Assistant.",
"title": "Disable legacy Ecobee notify service"
}
}
}
}
}
}
2 changes: 1 addition & 1 deletion homeassistant/components/knx/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"after_dependencies": ["panel_custom"],
"codeowners": ["@Julius2342", "@farmio", "@marvin-w"],
"config_flow": true,
"dependencies": ["file_upload", "repairs", "websocket_api"],
"dependencies": ["file_upload", "websocket_api"],
"documentation": "https://www.home-assistant.io/integrations/knx",
"integration_type": "hub",
"iot_class": "local_push",
Expand Down
9 changes: 6 additions & 3 deletions homeassistant/components/knx/notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@
from xknx.devices import Notification as XknxNotification

from homeassistant import config_entries
from homeassistant.components.notify import BaseNotificationService, NotifyEntity
from homeassistant.components.notify import (
BaseNotificationService,
NotifyEntity,
migrate_notify_issue,
)
from homeassistant.const import CONF_ENTITY_CATEGORY, CONF_NAME, CONF_TYPE, Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType

from .const import DATA_KNX_CONFIG, DOMAIN, KNX_ADDRESS
from .knx_entity import KnxEntity
from .repairs import migrate_notify_issue


async def async_get_service(
Expand Down Expand Up @@ -57,7 +60,7 @@ def targets(self) -> dict[str, str]:

async def async_send_message(self, message: str = "", **kwargs: Any) -> None:
"""Send a notification to knx bus."""
migrate_notify_issue(self.hass)
migrate_notify_issue(self.hass, DOMAIN, "KNX", "2024.11.0")
if "target" in kwargs:
await self._async_send_to_device(message, kwargs["target"])
else:
Expand Down
36 changes: 0 additions & 36 deletions homeassistant/components/knx/repairs.py

This file was deleted.

13 changes: 0 additions & 13 deletions homeassistant/components/knx/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -384,18 +384,5 @@
"name": "[%key:common::action::reload%]",
"description": "Reloads the KNX integration."
}
},
"issues": {
"migrate_notify": {
"title": "Migration of KNX notify service",
"fix_flow": {
"step": {
"confirm": {
"description": "The KNX `notify` service has been migrated. New `notify` entities are available now.\n\nUpdate any automations to use the new `notify.send_message` exposed by these new entities. When this is done, fix this issue and restart Home Assistant.",
"title": "Disable legacy KNX notify service"
}
}
}
}
}
}
1 change: 1 addition & 0 deletions homeassistant/components/notify/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
async_setup_legacy,
check_templates_warn,
)
from .repairs import migrate_notify_issue # noqa: F401

# mypy: disallow-any-generics

Expand Down
1 change: 1 addition & 0 deletions homeassistant/components/notify/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"domain": "notify",
"name": "Notifications",
"codeowners": ["@home-assistant/core"],
"dependencies": ["repairs"],
"documentation": "https://www.home-assistant.io/integrations/notify",
"integration_type": "entity",
"quality_scale": "internal"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
"""Repairs support for Ecobee."""
"""Repairs support for notify integration."""

from __future__ import annotations

from homeassistant.components.notify import DOMAIN as NOTIFY_DOMAIN
from homeassistant.components.repairs import RepairsFlow
from homeassistant.components.repairs.issue_handler import ConfirmRepairFlow
from homeassistant.core import HomeAssistant, callback
Expand All @@ -12,17 +11,23 @@


@callback
def migrate_notify_issue(hass: HomeAssistant) -> None:
def migrate_notify_issue(
hass: HomeAssistant, domain: str, integration_title: str, breaks_in_ha_version: str
) -> None:
"""Ensure an issue is registered."""
ir.async_create_issue(
hass,
DOMAIN,
"migrate_notify",
breaks_in_ha_version="2024.11.0",
issue_domain=NOTIFY_DOMAIN,
f"migrate_notify_{domain}",
breaks_in_ha_version=breaks_in_ha_version,
issue_domain=domain,
is_fixable=True,
is_persistent=True,
translation_key="migrate_notify",
translation_placeholders={
"domain": domain,
"integration_title": integration_title,
},
severity=ir.IssueSeverity.WARNING,
)

Expand All @@ -33,5 +38,5 @@ async def async_create_fix_flow(
data: dict[str, str | int | float | None] | None,
) -> RepairsFlow:
"""Create flow."""
assert issue_id == "migrate_notify"
assert issue_id.startswith("migrate_notify_")
return ConfirmRepairFlow()
13 changes: 13 additions & 0 deletions homeassistant/components/notify/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,18 @@
}
}
}
},
"issues": {
"migrate_notify": {
"title": "Migration of {integration_title} notify service",
"fix_flow": {
"step": {
"confirm": {
"description": "The {integration_title} `notify` service(s) are migrated. A new `notify` entity is available now to replace each legacy `notify` service.\n\nUpdate any automations to use the new `notify.send_message` service exposed with this new entity. When this is done, fix this issue and restart Home Assistant.",
"title": "Migrate legacy {integration_title} notify service for domain `{domain}`"
}
}
}
}
}
}
8 changes: 4 additions & 4 deletions tests/components/ecobee/test_repairs.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ async def test_ecobee_repair_flow(

# Assert the issue is present
assert issue_registry.async_get_issue(
domain=DOMAIN,
issue_id="migrate_notify",
domain="notify",
issue_id=f"migrate_notify_{DOMAIN}",
)
assert len(issue_registry.issues) == 1

url = RepairsFlowIndexView.url
resp = await http_client.post(
url, json={"handler": DOMAIN, "issue_id": "migrate_notify"}
url, json={"handler": "notify", "issue_id": f"migrate_notify_{DOMAIN}"}
)
assert resp.status == HTTPStatus.OK
data = await resp.json()
Expand All @@ -73,7 +73,7 @@ async def test_ecobee_repair_flow(

# Assert the issue is no longer present
assert not issue_registry.async_get_issue(
domain=DOMAIN,
domain="notify",
issue_id="migrate_notify",
)
assert len(issue_registry.issues) == 0
2 changes: 1 addition & 1 deletion tests/components/file/test_notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
async def test_bad_config(hass: HomeAssistant) -> None:
"""Test set up the platform with bad/missing config."""
config = {notify.DOMAIN: {"name": "test", "platform": "file"}}
with assert_setup_component(0) as handle_config:
with assert_setup_component(0, domain="notify") as handle_config:
assert await async_setup_component(hass, notify.DOMAIN, config)
await hass.async_block_till_done()
assert not handle_config[notify.DOMAIN]
Expand Down
6 changes: 3 additions & 3 deletions tests/components/homematic/test_notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ async def test_setup_full(hass: HomeAssistant) -> None:
"homematic",
{"homematic": {"hosts": {"ccu2": {"host": "127.0.0.1"}}}},
)
with assert_setup_component(1) as handle_config:
with assert_setup_component(1, domain="notify") as handle_config:
assert await async_setup_component(
hass,
"notify",
Expand All @@ -40,7 +40,7 @@ async def test_setup_without_optional(hass: HomeAssistant) -> None:
"homematic",
{"homematic": {"hosts": {"ccu2": {"host": "127.0.0.1"}}}},
)
with assert_setup_component(1) as handle_config:
with assert_setup_component(1, domain="notify") as handle_config:
assert await async_setup_component(
hass,
"notify",
Expand All @@ -61,6 +61,6 @@ async def test_setup_without_optional(hass: HomeAssistant) -> None:
async def test_bad_config(hass: HomeAssistant) -> None:
"""Test invalid configuration."""
config = {notify_comp.DOMAIN: {"name": "test", "platform": "homematic"}}
with assert_setup_component(0) as handle_config:
with assert_setup_component(0, domain="notify") as handle_config:
assert await async_setup_component(hass, notify_comp.DOMAIN, config)
assert not handle_config[notify_comp.DOMAIN]
10 changes: 5 additions & 5 deletions tests/components/knx/test_repairs.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ async def test_knx_notify_service_issue(
# Assert the issue is present
assert len(issue_registry.issues) == 1
assert issue_registry.async_get_issue(
domain=DOMAIN,
issue_id="migrate_notify",
domain="notify",
issue_id=f"migrate_notify_{DOMAIN}",
)

# Test confirm step in repair flow
resp = await http_client.post(
RepairsFlowIndexView.url,
json={"handler": DOMAIN, "issue_id": "migrate_notify"},
json={"handler": "notify", "issue_id": f"migrate_notify_{DOMAIN}"},
)
assert resp.status == HTTPStatus.OK
data = await resp.json()
Expand All @@ -78,7 +78,7 @@ async def test_knx_notify_service_issue(

# Assert the issue is no longer present
assert not issue_registry.async_get_issue(
domain=DOMAIN,
issue_id="migrate_notify",
domain="notify",
issue_id=f"migrate_notify_{DOMAIN}",
)
assert len(issue_registry.issues) == 0
Loading