Add a repair issue for Shelly devices with unsupported firmware (#109076)
Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
parent
e1576d5998
commit
d4c91bd0b7
6 changed files with 101 additions and 6 deletions
|
@ -22,7 +22,7 @@ from homeassistant.components.http import HomeAssistantView
|
|||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
|
||||
from homeassistant.core import Event, HomeAssistant, callback
|
||||
from homeassistant.helpers import singleton
|
||||
from homeassistant.helpers import issue_registry as ir, singleton
|
||||
from homeassistant.helpers.device_registry import (
|
||||
CONNECTION_NETWORK_MAC,
|
||||
async_get as dr_async_get,
|
||||
|
@ -38,6 +38,7 @@ from .const import (
|
|||
DEFAULT_COAP_PORT,
|
||||
DEVICES_WITHOUT_FIRMWARE_CHANGELOG,
|
||||
DOMAIN,
|
||||
FIRMWARE_UNSUPPORTED_ISSUE_ID,
|
||||
GEN1_RELEASE_URL,
|
||||
GEN2_RELEASE_URL,
|
||||
LOGGER,
|
||||
|
@ -426,3 +427,23 @@ def get_release_url(gen: int, model: str, beta: bool) -> str | None:
|
|||
return None
|
||||
|
||||
return GEN1_RELEASE_URL if gen in BLOCK_GENERATIONS else GEN2_RELEASE_URL
|
||||
|
||||
|
||||
@callback
|
||||
def async_create_issue_unsupported_firmware(
|
||||
hass: HomeAssistant, entry: ConfigEntry
|
||||
) -> None:
|
||||
"""Create a repair issue if the device runs an unsupported firmware."""
|
||||
ir.async_create_issue(
|
||||
hass,
|
||||
DOMAIN,
|
||||
FIRMWARE_UNSUPPORTED_ISSUE_ID.format(unique=entry.unique_id),
|
||||
is_fixable=False,
|
||||
is_persistent=False,
|
||||
severity=ir.IssueSeverity.ERROR,
|
||||
translation_key="unsupported_firmware",
|
||||
translation_placeholders={
|
||||
"device_name": entry.title,
|
||||
"ip_address": entry.data["host"],
|
||||
},
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue