mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Remove YAML configuration from Simplepush (#76175)
This commit is contained in:
parent
0ffdf9fb6e
commit
0df4642b62
@ -1,7 +1,6 @@
|
||||
"""Config flow for simplepush integration."""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from simplepush import UnknownError, send, send_encrypted
|
||||
@ -13,8 +12,6 @@ from homeassistant.data_entry_flow import FlowResult
|
||||
|
||||
from .const import ATTR_ENCRYPTED, CONF_DEVICE_KEY, CONF_SALT, DEFAULT_NAME, DOMAIN
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def validate_input(entry: dict[str, str]) -> dict[str, str] | None:
|
||||
"""Validate user input."""
|
||||
@ -76,13 +73,3 @@ class SimplePushFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
),
|
||||
errors=errors,
|
||||
)
|
||||
|
||||
async def async_step_import(self, import_config: dict[str, str]) -> FlowResult:
|
||||
"""Import a config entry from configuration.yaml."""
|
||||
_LOGGER.warning(
|
||||
"Configuration of the simplepush integration in YAML is deprecated and "
|
||||
"will be removed in a future release; Your existing configuration "
|
||||
"has been imported into the UI automatically and can be safely removed "
|
||||
"from your configuration.yaml file"
|
||||
)
|
||||
return await self.async_step_user(import_config)
|
||||
|
@ -5,34 +5,24 @@ import logging
|
||||
from typing import Any
|
||||
|
||||
from simplepush import BadRequest, UnknownError, send, send_encrypted
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.notify import (
|
||||
ATTR_TITLE,
|
||||
ATTR_TITLE_DEFAULT,
|
||||
PLATFORM_SCHEMA,
|
||||
PLATFORM_SCHEMA as BASE_PLATFORM_SCHEMA,
|
||||
BaseNotificationService,
|
||||
)
|
||||
from homeassistant.components.notify.const import ATTR_DATA
|
||||
from homeassistant.components.repairs.issue_handler import async_create_issue
|
||||
from homeassistant.components.repairs.models import IssueSeverity
|
||||
from homeassistant.config_entries import SOURCE_IMPORT
|
||||
from homeassistant.const import CONF_EVENT, CONF_PASSWORD
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
from .const import ATTR_ENCRYPTED, ATTR_EVENT, CONF_DEVICE_KEY, CONF_SALT, DOMAIN
|
||||
from .const import ATTR_EVENT, CONF_DEVICE_KEY, CONF_SALT, DOMAIN
|
||||
|
||||
# Configuring simplepush under the notify platform will be removed in 2022.9.0
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||
{
|
||||
vol.Required(CONF_DEVICE_KEY): cv.string,
|
||||
vol.Optional(CONF_EVENT): cv.string,
|
||||
vol.Inclusive(CONF_PASSWORD, ATTR_ENCRYPTED): cv.string,
|
||||
vol.Inclusive(CONF_SALT, ATTR_ENCRYPTED): cv.string,
|
||||
}
|
||||
)
|
||||
# Configuring Simplepush under the notify has been removed in 2022.9.0
|
||||
PLATFORM_SCHEMA = BASE_PLATFORM_SCHEMA
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -47,16 +37,11 @@ async def async_get_service(
|
||||
async_create_issue(
|
||||
hass,
|
||||
DOMAIN,
|
||||
"deprecated_yaml",
|
||||
"removed_yaml",
|
||||
breaks_in_ha_version="2022.9.0",
|
||||
is_fixable=False,
|
||||
severity=IssueSeverity.WARNING,
|
||||
translation_key="deprecated_yaml",
|
||||
)
|
||||
hass.async_create_task(
|
||||
hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_IMPORT}, data=config
|
||||
)
|
||||
translation_key="removed_yaml",
|
||||
)
|
||||
return None
|
||||
|
||||
|
@ -19,9 +19,9 @@
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"deprecated_yaml": {
|
||||
"title": "The Simplepush YAML configuration is being removed",
|
||||
"description": "Configuring Simplepush using YAML is being removed.\n\nYour existing YAML configuration has been imported into the UI automatically.\n\nRemove the Simplepush YAML configuration from your configuration.yaml file and restart Home Assistant to fix this issue."
|
||||
"removed_yaml": {
|
||||
"title": "The Simplepush YAML configuration has been removed",
|
||||
"description": "Configuring Simplepush using YAML has been removed.\n\nYour existing YAML configuration is not used by Home Assistant.\n\nRemove the Simplepush YAML configuration from your configuration.yaml file and restart Home Assistant to fix this issue."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,9 +19,9 @@
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"deprecated_yaml": {
|
||||
"description": "Configuring Simplepush using YAML is being removed.\n\nYour existing YAML configuration has been imported into the UI automatically.\n\nRemove the Simplepush YAML configuration from your configuration.yaml file and restart Home Assistant to fix this issue.",
|
||||
"title": "The Simplepush YAML configuration is being removed"
|
||||
"removed_yaml": {
|
||||
"description": "Configuring Simplepush using YAML has been removed.\n\nYour existing YAML configuration is not used by Home Assistant.\n\nRemove the Simplepush YAML configuration from your configuration.yaml file and restart Home Assistant to fix this issue.",
|
||||
"title": "The Simplepush YAML configuration has been removed"
|
||||
}
|
||||
}
|
||||
}
|
@ -129,16 +129,3 @@ async def test_error_on_connection_failure(hass: HomeAssistant) -> None:
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
async def test_flow_import(hass: HomeAssistant) -> None:
|
||||
"""Test an import flow."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_IMPORT},
|
||||
data=MOCK_CONFIG,
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "simplepush"
|
||||
assert result["data"] == MOCK_CONFIG
|
||||
|
Loading…
x
Reference in New Issue
Block a user