Deprecate the Ambiclimate integration (#111627)

Deprecate Ambiclimate integration
pull/111483/head^2
Erik Montnemery 2024-02-27 13:45:12 +01:00 committed by GitHub
parent 458c5ae657
commit 8fb542917b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 64 additions and 1 deletions

View File

@ -4,7 +4,7 @@ import voluptuous as vol
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_CLIENT_ID, CONF_CLIENT_SECRET, Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers import config_validation as cv, issue_registry as ir
from homeassistant.helpers.typing import ConfigType
from . import config_flow
@ -41,5 +41,18 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up Ambiclimate from a config entry."""
ir.async_create_issue(
hass,
DOMAIN,
DOMAIN,
breaks_in_ha_version="2024.4.0",
is_fixable=False,
severity=ir.IssueSeverity.WARNING,
translation_key="integration_removed",
translation_placeholders={
"entries": "/config/integrations/integration/ambiclimate",
},
)
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
return True

View File

@ -19,6 +19,12 @@
"access_token": "Unknown error generating an access token."
}
},
"issues": {
"integration_removed": {
"title": "The Ambiclimate integration has been deprecated and will be removed",
"description": "All Ambiclimate services will be terminated, effective March 31, 2024, as Ambi Labs winds down business operations, and the Ambiclimate integration will be removed from Home Assistant.\n\nTo resolve this issue, please remove the integration entries from your Home Assistant setup. [Click here to see your existing Logi Circle integration entries]({entries})."
}
},
"services": {
"set_comfort_mode": {
"name": "Set comfort mode",

View File

@ -0,0 +1,44 @@
"""Tests for the Ambiclimate integration."""
from unittest.mock import patch
import pytest
from homeassistant.components.ambiclimate import DOMAIN
from homeassistant.config_entries import ConfigEntryState
from homeassistant.core import HomeAssistant
from homeassistant.helpers import issue_registry as ir
from tests.common import MockConfigEntry
@pytest.fixture(name="disable_platforms")
async def disable_platforms_fixture(hass):
"""Disable ambiclimate platforms."""
with patch("homeassistant.components.ambiclimate.PLATFORMS", []):
yield
async def test_repair_issue(
hass: HomeAssistant,
issue_registry: ir.IssueRegistry,
disable_platforms,
) -> None:
"""Test the Ambiclimate configuration entry loading handles the repair."""
config_entry = MockConfigEntry(
title="Example 1",
domain=DOMAIN,
)
config_entry.add_to_hass(hass)
await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
assert config_entry.state is ConfigEntryState.LOADED
assert issue_registry.async_get_issue(DOMAIN, DOMAIN)
# Remove the entry
await hass.config_entries.async_remove(config_entry.entry_id)
await hass.async_block_till_done()
# Ambiclimate does not implement unload
assert config_entry.state is ConfigEntryState.FAILED_UNLOAD
assert issue_registry.async_get_issue(DOMAIN, DOMAIN)