mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Deprecate Linear Garage Door integration (#137502)
This commit is contained in:
parent
c4454ad5ea
commit
e93451a195
@ -2,9 +2,10 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.config_entries import ConfigEntry, ConfigEntryState
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import issue_registry as ir
|
||||
|
||||
from .const import DOMAIN
|
||||
from .coordinator import LinearUpdateCoordinator
|
||||
@ -15,6 +16,21 @@ PLATFORMS: list[Platform] = [Platform.COVER, Platform.LIGHT]
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Set up Linear Garage Door from a config entry."""
|
||||
|
||||
ir.async_create_issue(
|
||||
hass,
|
||||
DOMAIN,
|
||||
DOMAIN,
|
||||
breaks_in_ha_version="2025.8.0",
|
||||
is_fixable=False,
|
||||
issue_domain=DOMAIN,
|
||||
severity=ir.IssueSeverity.WARNING,
|
||||
translation_key="deprecated_integration",
|
||||
translation_placeholders={
|
||||
"nice_go": "https://www.home-assistant.io/integrations/linear_garage_door",
|
||||
"entries": "/config/integrations/integration/linear_garage_door",
|
||||
},
|
||||
)
|
||||
|
||||
coordinator = LinearUpdateCoordinator(hass)
|
||||
|
||||
await coordinator.async_config_entry_first_refresh()
|
||||
@ -27,6 +43,13 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
|
||||
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Unload a config entry."""
|
||||
if all(
|
||||
config_entry.state is ConfigEntryState.NOT_LOADED
|
||||
for config_entry in hass.config_entries.async_entries(DOMAIN)
|
||||
if config_entry.entry_id != entry.entry_id
|
||||
):
|
||||
ir.async_delete_issue(hass, DOMAIN, DOMAIN)
|
||||
|
||||
if unload_ok := await hass.config_entries.async_unload_platforms(entry, PLATFORMS):
|
||||
hass.data[DOMAIN].pop(entry.entry_id)
|
||||
|
||||
|
@ -23,5 +23,11 @@
|
||||
"name": "[%key:component::light::title%]"
|
||||
}
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"deprecated_integration": {
|
||||
"title": "The Linear Garage Door integration will be removed",
|
||||
"description": "The Linear Garage Door integration will be removed as it has been replaced by the [Nice G.O.]({nice_go}) integration. Please migrate to the new integration.\n\nTo resolve this issue, please remove all Linear Garage Door entries from your configuration and add the new Nice G.O. integration. [Click here to see your existing Linear Garage Door integration entries]({entries})."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,8 +5,10 @@ from unittest.mock import AsyncMock
|
||||
from linear_garage_door import InvalidLoginError
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.linear_garage_door.const import DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import issue_registry as ir
|
||||
|
||||
from . import setup_integration
|
||||
|
||||
@ -51,3 +53,23 @@ async def test_setup_failure(
|
||||
|
||||
await setup_integration(hass, mock_config_entry, [])
|
||||
assert mock_config_entry.state == entry_state
|
||||
|
||||
|
||||
async def test_repair_issue(
|
||||
hass: HomeAssistant,
|
||||
mock_linear: AsyncMock,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
issue_registry: ir.IssueRegistry,
|
||||
) -> None:
|
||||
"""Test reauth trigger setup."""
|
||||
|
||||
await setup_integration(hass, mock_config_entry, [])
|
||||
assert mock_config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
assert issue_registry.async_get_issue(DOMAIN, DOMAIN)
|
||||
|
||||
await hass.config_entries.async_remove(mock_config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert mock_config_entry.state is ConfigEntryState.NOT_LOADED
|
||||
assert issue_registry.async_get_issue(DOMAIN, DOMAIN) is None
|
||||
|
Loading…
x
Reference in New Issue
Block a user