Deprecate the Deutsche Bahn ()

This commit is contained in:
Franck Nijhof 2022-08-05 10:59:43 +02:00 committed by GitHub
parent 3b29cbcd61
commit babb3d10a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 1 deletions
homeassistant/components/deutsche_bahn

View file

@ -3,6 +3,7 @@
"name": "Deutsche Bahn",
"documentation": "https://www.home-assistant.io/integrations/deutsche_bahn",
"requirements": ["schiene==0.23"],
"dependencies": ["repairs"],
"codeowners": [],
"iot_class": "cloud_polling",
"loggers": ["schiene"]

View file

@ -2,10 +2,12 @@
from __future__ import annotations
from datetime import timedelta
import logging
import schiene
import voluptuous as vol
from homeassistant.components.repairs import IssueSeverity, create_issue
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import CONF_OFFSET
from homeassistant.core import HomeAssistant
@ -33,6 +35,8 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
}
)
_LOGGER = logging.getLogger(__name__)
def setup_platform(
hass: HomeAssistant,
@ -45,7 +49,18 @@ def setup_platform(
destination = config[CONF_DESTINATION]
offset = config[CONF_OFFSET]
only_direct = config[CONF_ONLY_DIRECT]
create_issue(
hass,
"deutsche_bahn",
"pending_removal",
breaks_in_ha_version="2022.11.0",
is_fixable=False,
severity=IssueSeverity.WARNING,
translation_key="pending_removal",
)
_LOGGER.warning(
"The Deutsche Bahn sensor component is deprecated and will be removed in Home Assistant 2022.11"
)
add_entities([DeutscheBahnSensor(start, destination, offset, only_direct)], True)

View file

@ -0,0 +1,8 @@
{
"issues": {
"pending_removal": {
"title": "The Deutsche Bahn integration is being removed",
"description": "The Deutsche Bahn integration is pending removal from Home Assistant and will no longer be available as of Home Assistant 2022.11.\n\nThe integration is being removed, because it relies on webscraping, which is not allowed.\n\nRemove the Deutsche Bahn YAML configuration from your configuration.yaml file and restart Home Assistant to fix this issue."
}
}
}

View file

@ -0,0 +1,8 @@
{
"issues": {
"pending_removal": {
"description": "The Deutsche Bahn integration is pending removal from Home Assistant and will no longer be available as of Home Assistant 2022.11.\n\nThe integration is being removed, because it relies on webscraping, which is not allowed.\n\nRemove the Deutsche Bahn YAML configuration from your configuration.yaml file and restart Home Assistant to fix this issue.",
"title": "The Deutsche Bahn integration is being removed"
}
}
}