mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Remove deprecated services from Huawei LTE (#107578)
This commit is contained in:
parent
71dcbb95ab
commit
3141b92027
@ -13,7 +13,6 @@ from xml.parsers.expat import ExpatError
|
||||
|
||||
from huawei_lte_api.Client import Client
|
||||
from huawei_lte_api.Connection import Connection
|
||||
from huawei_lte_api.enums.device import ControlModeEnum
|
||||
from huawei_lte_api.exceptions import (
|
||||
LoginErrorInvalidCredentialsException,
|
||||
ResponseErrorException,
|
||||
@ -51,7 +50,6 @@ from homeassistant.helpers.device_registry import DeviceInfo
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect, dispatcher_send
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.event import async_track_time_interval
|
||||
from homeassistant.helpers.issue_registry import IssueSeverity, create_issue
|
||||
from homeassistant.helpers.service import async_register_admin_service
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
@ -59,8 +57,6 @@ from .const import (
|
||||
ADMIN_SERVICES,
|
||||
ALL_KEYS,
|
||||
ATTR_CONFIG_ENTRY_ID,
|
||||
BUTTON_KEY_CLEAR_TRAFFIC_STATISTICS,
|
||||
BUTTON_KEY_RESTART,
|
||||
CONF_MANUFACTURER,
|
||||
CONF_UNAUTHENTICATED_MODE,
|
||||
CONNECTION_TIMEOUT,
|
||||
@ -84,8 +80,6 @@ from .const import (
|
||||
KEY_WLAN_WIFI_FEATURE_SWITCH,
|
||||
KEY_WLAN_WIFI_GUEST_NETWORK_SWITCH,
|
||||
NOTIFY_SUPPRESS_TIMEOUT,
|
||||
SERVICE_CLEAR_TRAFFIC_STATISTICS,
|
||||
SERVICE_REBOOT,
|
||||
SERVICE_RESUME_INTEGRATION,
|
||||
SERVICE_SUSPEND_INTEGRATION,
|
||||
UPDATE_SIGNAL,
|
||||
@ -533,45 +527,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
_LOGGER.error("%s: router %s unavailable", service.service, url)
|
||||
return
|
||||
|
||||
if service.service == SERVICE_CLEAR_TRAFFIC_STATISTICS:
|
||||
create_issue(
|
||||
hass,
|
||||
DOMAIN,
|
||||
"service_clear_traffic_statistics_moved_to_button",
|
||||
breaks_in_ha_version="2024.2.0",
|
||||
is_fixable=False,
|
||||
severity=IssueSeverity.WARNING,
|
||||
translation_key="service_changed_to_button",
|
||||
translation_placeholders={
|
||||
"service": service.service,
|
||||
"button": BUTTON_KEY_CLEAR_TRAFFIC_STATISTICS,
|
||||
},
|
||||
)
|
||||
if router.suspended:
|
||||
_LOGGER.debug("%s: ignored, integration suspended", service.service)
|
||||
return
|
||||
result = router.client.monitoring.set_clear_traffic()
|
||||
_LOGGER.debug("%s: %s", service.service, result)
|
||||
elif service.service == SERVICE_REBOOT:
|
||||
create_issue(
|
||||
hass,
|
||||
DOMAIN,
|
||||
"service_reboot_moved_to_button",
|
||||
breaks_in_ha_version="2024.2.0",
|
||||
is_fixable=False,
|
||||
severity=IssueSeverity.WARNING,
|
||||
translation_key="service_changed_to_button",
|
||||
translation_placeholders={
|
||||
"service": service.service,
|
||||
"button": BUTTON_KEY_RESTART,
|
||||
},
|
||||
)
|
||||
if router.suspended:
|
||||
_LOGGER.debug("%s: ignored, integration suspended", service.service)
|
||||
return
|
||||
result = router.client.device.set_control(ControlModeEnum.REBOOT)
|
||||
_LOGGER.debug("%s: %s", service.service, result)
|
||||
elif service.service == SERVICE_RESUME_INTEGRATION:
|
||||
if service.service == SERVICE_RESUME_INTEGRATION:
|
||||
# Login will be handled automatically on demand
|
||||
router.suspended = False
|
||||
_LOGGER.debug("%s: %s", service.service, "done")
|
||||
|
@ -19,14 +19,10 @@ UPDATE_SIGNAL = f"{DOMAIN}_update"
|
||||
CONNECTION_TIMEOUT = 10
|
||||
NOTIFY_SUPPRESS_TIMEOUT = 30
|
||||
|
||||
SERVICE_CLEAR_TRAFFIC_STATISTICS = "clear_traffic_statistics"
|
||||
SERVICE_REBOOT = "reboot"
|
||||
SERVICE_RESUME_INTEGRATION = "resume_integration"
|
||||
SERVICE_SUSPEND_INTEGRATION = "suspend_integration"
|
||||
|
||||
ADMIN_SERVICES = {
|
||||
SERVICE_CLEAR_TRAFFIC_STATISTICS,
|
||||
SERVICE_REBOOT,
|
||||
SERVICE_RESUME_INTEGRATION,
|
||||
SERVICE_SUSPEND_INTEGRATION,
|
||||
}
|
||||
|
@ -1,17 +1,3 @@
|
||||
clear_traffic_statistics:
|
||||
fields:
|
||||
url:
|
||||
example: http://192.168.100.1/
|
||||
selector:
|
||||
text:
|
||||
|
||||
reboot:
|
||||
fields:
|
||||
url:
|
||||
example: http://192.168.100.1/
|
||||
selector:
|
||||
text:
|
||||
|
||||
resume_integration:
|
||||
fields:
|
||||
url:
|
||||
|
@ -309,33 +309,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"service_changed_to_button": {
|
||||
"title": "Service changed to a button",
|
||||
"description": "The {service} service is deprecated, use the corresponding {button} button instead."
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"clear_traffic_statistics": {
|
||||
"name": "Clear traffic statistics",
|
||||
"description": "Clears traffic statistics.",
|
||||
"fields": {
|
||||
"url": {
|
||||
"name": "[%key:common::config_flow::data::url%]",
|
||||
"description": "URL of router to clear; optional when only one is configured."
|
||||
}
|
||||
}
|
||||
},
|
||||
"reboot": {
|
||||
"name": "Reboot",
|
||||
"description": "Reboots router.",
|
||||
"fields": {
|
||||
"url": {
|
||||
"name": "[%key:common::config_flow::data::url%]",
|
||||
"description": "URL of router to reboot; optional when only one is configured."
|
||||
}
|
||||
}
|
||||
},
|
||||
"resume_integration": {
|
||||
"name": "Resume integration",
|
||||
"description": "Resumes suspended integration.",
|
||||
|
Loading…
x
Reference in New Issue
Block a user