mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Add persistent repair items for deprecated Guardian services (#76312)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
parent
0edf82fcb4
commit
e0d8f0cc95
@ -10,6 +10,7 @@ from aioguardian import Client
|
|||||||
from aioguardian.errors import GuardianError
|
from aioguardian.errors import GuardianError
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
|
from homeassistant.components.repairs import IssueSeverity, async_create_issue
|
||||||
from homeassistant.config_entries import ConfigEntry, ConfigEntryState
|
from homeassistant.config_entries import ConfigEntry, ConfigEntryState
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_DEVICE_ID,
|
ATTR_DEVICE_ID,
|
||||||
@ -116,14 +117,34 @@ def async_log_deprecated_service_call(
|
|||||||
call: ServiceCall,
|
call: ServiceCall,
|
||||||
alternate_service: str,
|
alternate_service: str,
|
||||||
alternate_target: str,
|
alternate_target: str,
|
||||||
|
breaks_in_ha_version: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Log a warning about a deprecated service call."""
|
"""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(
|
LOGGER.warning(
|
||||||
(
|
(
|
||||||
'The "%s" service is deprecated and will be removed in a future version; '
|
'The "%s" service is deprecated and will be removed in %s; use the "%s" '
|
||||||
'use the "%s" service and pass it a target entity ID of "%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_service,
|
||||||
alternate_target,
|
alternate_target,
|
||||||
)
|
)
|
||||||
@ -235,6 +256,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
call,
|
call,
|
||||||
"button.press",
|
"button.press",
|
||||||
f"button.guardian_valve_controller_{data.entry.data[CONF_UID]}_reboot",
|
f"button.guardian_valve_controller_{data.entry.data[CONF_UID]}_reboot",
|
||||||
|
"2022.10.0",
|
||||||
)
|
)
|
||||||
await data.client.system.reboot()
|
await data.client.system.reboot()
|
||||||
|
|
||||||
@ -248,6 +270,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
call,
|
call,
|
||||||
"button.press",
|
"button.press",
|
||||||
f"button.guardian_valve_controller_{data.entry.data[CONF_UID]}_reset_valve_diagnostics",
|
f"button.guardian_valve_controller_{data.entry.data[CONF_UID]}_reset_valve_diagnostics",
|
||||||
|
"2022.10.0",
|
||||||
)
|
)
|
||||||
await data.client.valve.reset()
|
await data.client.valve.reset()
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
"name": "Elexa Guardian",
|
"name": "Elexa Guardian",
|
||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/integrations/guardian",
|
"documentation": "https://www.home-assistant.io/integrations/guardian",
|
||||||
|
"dependencies": ["repairs"],
|
||||||
"requirements": ["aioguardian==2022.07.0"],
|
"requirements": ["aioguardian==2022.07.0"],
|
||||||
"zeroconf": ["_api._udp.local."],
|
"zeroconf": ["_api._udp.local."],
|
||||||
"codeowners": ["@bachya"],
|
"codeowners": ["@bachya"],
|
||||||
|
@ -17,5 +17,18 @@
|
|||||||
"already_in_progress": "[%key:common::config_flow::abort::already_in_progress%]",
|
"already_in_progress": "[%key:common::config_flow::abort::already_in_progress%]",
|
||||||
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]"
|
"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."
|
"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…
x
Reference in New Issue
Block a user