Remove unreferenced issues (#96264)
* Remove unreferenced issues * Remove outdated testspull/96358/head
parent
7d2559e6a5
commit
2257e7454a
|
@ -25,7 +25,6 @@ from homeassistant.exceptions import HomeAssistantError
|
|||
from homeassistant.helpers import config_validation as cv, device_registry as dr
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||
from homeassistant.helpers.entity import DeviceInfo, EntityDescription
|
||||
from homeassistant.helpers.issue_registry import IssueSeverity, async_create_issue
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
from .const import (
|
||||
|
@ -107,45 +106,6 @@ def async_get_entry_id_for_service_call(hass: HomeAssistant, call: ServiceCall)
|
|||
raise ValueError(f"No config entry for device ID: {device_id}")
|
||||
|
||||
|
||||
@callback
|
||||
def async_log_deprecated_service_call(
|
||||
hass: HomeAssistant,
|
||||
call: ServiceCall,
|
||||
alternate_service: str,
|
||||
alternate_target: str,
|
||||
breaks_in_ha_version: str,
|
||||
) -> None:
|
||||
"""Log a warning about a deprecated service call."""
|
||||
deprecated_service = f"{call.domain}.{call.service}"
|
||||
|
||||
async_create_issue(
|
||||
hass,
|
||||
DOMAIN,
|
||||
f"deprecated_service_{deprecated_service}",
|
||||
breaks_in_ha_version=breaks_in_ha_version,
|
||||
is_fixable=True,
|
||||
is_persistent=True,
|
||||
severity=IssueSeverity.WARNING,
|
||||
translation_key="deprecated_service",
|
||||
translation_placeholders={
|
||||
"alternate_service": alternate_service,
|
||||
"alternate_target": alternate_target,
|
||||
"deprecated_service": deprecated_service,
|
||||
},
|
||||
)
|
||||
|
||||
LOGGER.warning(
|
||||
(
|
||||
'The "%s" service is deprecated and will be removed in %s; use the "%s" '
|
||||
'service and pass it a target entity ID of "%s"'
|
||||
),
|
||||
deprecated_service,
|
||||
breaks_in_ha_version,
|
||||
alternate_service,
|
||||
alternate_target,
|
||||
)
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Set up Elexa Guardian from a config entry."""
|
||||
client = Client(entry.data[CONF_IP_ADDRESS], port=entry.data[CONF_PORT])
|
||||
|
|
|
@ -18,19 +18,6 @@
|
|||
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]"
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"deprecated_service": {
|
||||
"title": "The {deprecated_service} service will be removed",
|
||||
"fix_flow": {
|
||||
"step": {
|
||||
"confirm": {
|
||||
"title": "The {deprecated_service} service will be removed",
|
||||
"description": "Update any automations or scripts that use this service to instead use the `{alternate_service}` service with a target entity ID of `{alternate_target}`."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"binary_sensor": {
|
||||
"leak": {
|
||||
|
|
|
@ -25,12 +25,6 @@
|
|||
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]"
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"migrated_attributes": {
|
||||
"title": "Litter-Robot attributes are now their own sensors",
|
||||
"description": "The vacuum entity attributes are now available as diagnostic sensors.\n\nPlease adjust any automations or scripts you may have that use these attributes."
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"binary_sensor": {
|
||||
"sleeping": {
|
||||
|
|
|
@ -37,16 +37,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"deprecated_service_multiple_alternate_targets": {
|
||||
"title": "The {deprecated_service} service is being removed",
|
||||
"description": "Update any automations or scripts that use this service to instead use the `{alternate_service}` service with one of these entity IDs as the target: `{alternate_targets}`."
|
||||
},
|
||||
"deprecated_service_single_alternate_target": {
|
||||
"title": "The {deprecated_service} service is being removed",
|
||||
"description": "Update any automations or scripts that use this service to instead use the `{alternate_service}` service with `{alternate_targets}` as the target."
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"binary_sensor": {
|
||||
"protection_window": {
|
||||
|
|
|
@ -75,10 +75,6 @@
|
|||
"ea_setup_failed": {
|
||||
"title": "Setup error using Early Access version",
|
||||
"description": "You are using v{version} of UniFi Protect which is an Early Access version. An unrecoverable error occurred while trying to load the integration. Please [downgrade to a stable version](https://www.home-assistant.io/integrations/unifiprotect#downgrading-unifi-protect) of UniFi Protect to continue using the integration.\n\nError: {error}"
|
||||
},
|
||||
"deprecate_smart_sensor": {
|
||||
"title": "Smart Detection Sensor Deprecated",
|
||||
"description": "The unified \"Detected Object\" sensor for smart detections is now deprecated. It has been replaced with individual smart detection binary sensors for each smart detection type.\n\nBelow are the detected automations or scripts that use one or more of the deprecated entities:\n{items}\nThe above list may be incomplete and it does not include any template usages inside of dashboards. Please update any templates, automations or scripts accordingly."
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
|
|
|
@ -5,7 +5,7 @@ from copy import copy
|
|||
from http import HTTPStatus
|
||||
from unittest.mock import Mock
|
||||
|
||||
from pyunifiprotect.data import Camera, Version
|
||||
from pyunifiprotect.data import Version
|
||||
|
||||
from homeassistant.components.repairs.issue_handler import (
|
||||
async_process_repairs_platforms,
|
||||
|
@ -15,9 +15,7 @@ from homeassistant.components.repairs.websocket_api import (
|
|||
RepairsFlowResourceView,
|
||||
)
|
||||
from homeassistant.components.unifiprotect.const import DOMAIN
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from .utils import MockUFPFixture, init_entry
|
||||
|
||||
|
@ -127,59 +125,3 @@ async def test_ea_warning_fix(
|
|||
data = await resp.json()
|
||||
|
||||
assert data["type"] == "create_entry"
|
||||
|
||||
|
||||
async def test_deprecate_smart_default(
|
||||
hass: HomeAssistant,
|
||||
ufp: MockUFPFixture,
|
||||
hass_ws_client: WebSocketGenerator,
|
||||
doorbell: Camera,
|
||||
) -> None:
|
||||
"""Test Deprecate Sensor repair does not exist by default (new installs)."""
|
||||
|
||||
await init_entry(hass, ufp, [doorbell])
|
||||
|
||||
await async_process_repairs_platforms(hass)
|
||||
ws_client = await hass_ws_client(hass)
|
||||
|
||||
await ws_client.send_json({"id": 1, "type": "repairs/list_issues"})
|
||||
msg = await ws_client.receive_json()
|
||||
|
||||
assert msg["success"]
|
||||
issue = None
|
||||
for i in msg["result"]["issues"]:
|
||||
if i["issue_id"] == "deprecate_smart_sensor":
|
||||
issue = i
|
||||
assert issue is None
|
||||
|
||||
|
||||
async def test_deprecate_smart_no_automations(
|
||||
hass: HomeAssistant,
|
||||
ufp: MockUFPFixture,
|
||||
hass_ws_client: WebSocketGenerator,
|
||||
doorbell: Camera,
|
||||
) -> None:
|
||||
"""Test Deprecate Sensor repair exists for existing installs."""
|
||||
|
||||
registry = er.async_get(hass)
|
||||
registry.async_get_or_create(
|
||||
Platform.SENSOR,
|
||||
DOMAIN,
|
||||
f"{doorbell.mac}_detected_object",
|
||||
config_entry=ufp.entry,
|
||||
)
|
||||
|
||||
await init_entry(hass, ufp, [doorbell])
|
||||
|
||||
await async_process_repairs_platforms(hass)
|
||||
ws_client = await hass_ws_client(hass)
|
||||
|
||||
await ws_client.send_json({"id": 1, "type": "repairs/list_issues"})
|
||||
msg = await ws_client.receive_json()
|
||||
|
||||
assert msg["success"]
|
||||
issue = None
|
||||
for i in msg["result"]["issues"]:
|
||||
if i["issue_id"] == "deprecate_smart_sensor":
|
||||
issue = i
|
||||
assert issue is None
|
||||
|
|
Loading…
Reference in New Issue