Add persistent repair items for deprecated Guardian services (#76312)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>pull/76578/head
parent
0edf82fcb4
commit
e0d8f0cc95
|
@ -10,6 +10,7 @@ from aioguardian import Client
|
|||
from aioguardian.errors import GuardianError
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.repairs import IssueSeverity, async_create_issue
|
||||
from homeassistant.config_entries import ConfigEntry, ConfigEntryState
|
||||
from homeassistant.const import (
|
||||
ATTR_DEVICE_ID,
|
||||
|
@ -116,14 +117,34 @@ def async_log_deprecated_service_call(
|
|||
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 a future version; '
|
||||
'use the "%s" service and pass it a target entity ID of "%s"'
|
||||
'The "%s" service is deprecated and will be removed in %s; use the "%s" '
|
||||
'service and pass it a target entity ID of "%s"'
|
||||
),
|
||||
f"{call.domain}.{call.service}",
|
||||
deprecated_service,
|
||||
breaks_in_ha_version,
|
||||
alternate_service,
|
||||
alternate_target,
|
||||
)
|
||||
|
@ -235,6 +256,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||
call,
|
||||
"button.press",
|
||||
f"button.guardian_valve_controller_{data.entry.data[CONF_UID]}_reboot",
|
||||
"2022.10.0",
|
||||
)
|
||||
await data.client.system.reboot()
|
||||
|
||||
|
@ -248,6 +270,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||
call,
|
||||
"button.press",
|
||||
f"button.guardian_valve_controller_{data.entry.data[CONF_UID]}_reset_valve_diagnostics",
|
||||
"2022.10.0",
|
||||
)
|
||||
await data.client.valve.reset()
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"name": "Elexa Guardian",
|
||||
"config_flow": true,
|
||||
"documentation": "https://www.home-assistant.io/integrations/guardian",
|
||||
"dependencies": ["repairs"],
|
||||
"requirements": ["aioguardian==2022.07.0"],
|
||||
"zeroconf": ["_api._udp.local."],
|
||||
"codeowners": ["@bachya"],
|
||||
|
|
|
@ -17,5 +17,18 @@
|
|||
"already_in_progress": "[%key:common::config_flow::abort::already_in_progress%]",
|
||||
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]"
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"deprecated_service": {
|
||||
"title": "The {deprecated_service} service is being removed",
|
||||
"fix_flow": {
|
||||
"step": {
|
||||
"confirm": {
|
||||
"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 a target entity ID of `{alternate_target}`. Then, click SUBMIT below to mark this issue as resolved."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,5 +17,18 @@
|
|||
"description": "Configure a local Elexa Guardian device."
|
||||
}
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"deprecated_service": {
|
||||
"fix_flow": {
|
||||
"step": {
|
||||
"confirm": {
|
||||
"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}`. Then, click SUBMIT below to mark this issue as resolved.",
|
||||
"title": "The {deprecated_service} service is being removed"
|
||||
}
|
||||
}
|
||||
},
|
||||
"title": "The {deprecated_service} service is being removed"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue