From c426806124204389f617813df8ad4e892d7856a6 Mon Sep 17 00:00:00 2001 From: Jan-Philipp Benecke Date: Mon, 8 Jan 2024 20:20:52 +0100 Subject: [PATCH] Remove deprecated services from Huawei LTE --- .../components/huawei_lte/__init__.py | 46 +------------------ homeassistant/components/huawei_lte/const.py | 4 -- .../components/huawei_lte/services.yaml | 14 ------ .../components/huawei_lte/strings.json | 26 ----------- 4 files changed, 1 insertion(+), 89 deletions(-) diff --git a/homeassistant/components/huawei_lte/__init__.py b/homeassistant/components/huawei_lte/__init__.py index 42a1e066ac7762..ba276625730666 100644 --- a/homeassistant/components/huawei_lte/__init__.py +++ b/homeassistant/components/huawei_lte/__init__.py @@ -13,7 +13,6 @@ 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.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 @@ 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 @@ 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 @@ def service_handler(service: ServiceCall) -> None: _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") diff --git a/homeassistant/components/huawei_lte/const.py b/homeassistant/components/huawei_lte/const.py index eba0f3ce90bc22..af9bfd330e9836 100644 --- a/homeassistant/components/huawei_lte/const.py +++ b/homeassistant/components/huawei_lte/const.py @@ -19,14 +19,10 @@ 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, } diff --git a/homeassistant/components/huawei_lte/services.yaml b/homeassistant/components/huawei_lte/services.yaml index 9d0cf5d91e658d..a90b0b1df7407b 100644 --- a/homeassistant/components/huawei_lte/services.yaml +++ b/homeassistant/components/huawei_lte/services.yaml @@ -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: diff --git a/homeassistant/components/huawei_lte/strings.json b/homeassistant/components/huawei_lte/strings.json index 225146799a3e94..a1a3f5c9416f08 100644 --- a/homeassistant/components/huawei_lte/strings.json +++ b/homeassistant/components/huawei_lte/strings.json @@ -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.",