Remove deprecated services from AVM Fritz!Box Tools (#118108)

This commit is contained in:
Michael 2024-05-25 13:52:28 +02:00 committed by GitHub
parent 0182bfcc81
commit 73f9234107
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 4 additions and 102 deletions

View file

@ -5,7 +5,7 @@ from __future__ import annotations
from collections.abc import Callable from collections.abc import Callable
from dataclasses import dataclass from dataclasses import dataclass
import logging import logging
from typing import Final from typing import Any, Final
from homeassistant.components.button import ( from homeassistant.components.button import (
ButtonDeviceClass, ButtonDeviceClass,
@ -30,7 +30,7 @@ _LOGGER = logging.getLogger(__name__)
class FritzButtonDescription(ButtonEntityDescription): class FritzButtonDescription(ButtonEntityDescription):
"""Class to describe a Button entity.""" """Class to describe a Button entity."""
press_action: Callable press_action: Callable[[AvmWrapper], Any]
BUTTONS: Final = [ BUTTONS: Final = [

View file

@ -57,9 +57,6 @@ ERROR_UPNP_NOT_CONFIGURED = "upnp_not_configured"
ERROR_UNKNOWN = "unknown_error" ERROR_UNKNOWN = "unknown_error"
FRITZ_SERVICES = "fritz_services" FRITZ_SERVICES = "fritz_services"
SERVICE_REBOOT = "reboot"
SERVICE_RECONNECT = "reconnect"
SERVICE_CLEANUP = "cleanup"
SERVICE_SET_GUEST_WIFI_PW = "set_guest_wifi_password" SERVICE_SET_GUEST_WIFI_PW = "set_guest_wifi_password"
SWITCH_TYPE_DEFLECTION = "CallDeflection" SWITCH_TYPE_DEFLECTION = "CallDeflection"

View file

@ -46,9 +46,6 @@ from .const import (
DEFAULT_USERNAME, DEFAULT_USERNAME,
DOMAIN, DOMAIN,
FRITZ_EXCEPTIONS, FRITZ_EXCEPTIONS,
SERVICE_CLEANUP,
SERVICE_REBOOT,
SERVICE_RECONNECT,
SERVICE_SET_GUEST_WIFI_PW, SERVICE_SET_GUEST_WIFI_PW,
MeshRoles, MeshRoles,
) )
@ -730,30 +727,6 @@ class FritzBoxTools(DataUpdateCoordinator[UpdateCoordinatorDataType]):
) )
try: try:
if service_call.service == SERVICE_REBOOT:
_LOGGER.warning(
'Service "fritz.reboot" is deprecated, please use the corresponding'
" button entity instead"
)
await self.async_trigger_reboot()
return
if service_call.service == SERVICE_RECONNECT:
_LOGGER.warning(
'Service "fritz.reconnect" is deprecated, please use the'
" corresponding button entity instead"
)
await self.async_trigger_reconnect()
return
if service_call.service == SERVICE_CLEANUP:
_LOGGER.warning(
'Service "fritz.cleanup" is deprecated, please use the'
" corresponding button entity instead"
)
await self.async_trigger_cleanup(config_entry)
return
if service_call.service == SERVICE_SET_GUEST_WIFI_PW: if service_call.service == SERVICE_SET_GUEST_WIFI_PW:
await self.async_trigger_set_guest_password( await self.async_trigger_set_guest_password(
service_call.data.get("password"), service_call.data.get("password"),

View file

@ -11,14 +11,7 @@ from homeassistant.core import HomeAssistant, ServiceCall
from homeassistant.exceptions import HomeAssistantError from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers.service import async_extract_config_entry_ids from homeassistant.helpers.service import async_extract_config_entry_ids
from .const import ( from .const import DOMAIN, FRITZ_SERVICES, SERVICE_SET_GUEST_WIFI_PW
DOMAIN,
FRITZ_SERVICES,
SERVICE_CLEANUP,
SERVICE_REBOOT,
SERVICE_RECONNECT,
SERVICE_SET_GUEST_WIFI_PW,
)
from .coordinator import AvmWrapper from .coordinator import AvmWrapper
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -32,9 +25,6 @@ SERVICE_SCHEMA_SET_GUEST_WIFI_PW = vol.Schema(
) )
SERVICE_LIST: list[tuple[str, vol.Schema | None]] = [ SERVICE_LIST: list[tuple[str, vol.Schema | None]] = [
(SERVICE_CLEANUP, None),
(SERVICE_REBOOT, None),
(SERVICE_RECONNECT, None),
(SERVICE_SET_GUEST_WIFI_PW, SERVICE_SCHEMA_SET_GUEST_WIFI_PW), (SERVICE_SET_GUEST_WIFI_PW, SERVICE_SCHEMA_SET_GUEST_WIFI_PW),
] ]

View file

@ -1,31 +1,3 @@
reconnect:
fields:
device_id:
required: true
selector:
device:
integration: fritz
entity:
device_class: connectivity
reboot:
fields:
device_id:
required: true
selector:
device:
integration: fritz
entity:
device_class: connectivity
cleanup:
fields:
device_id:
required: true
selector:
device:
integration: fritz
entity:
device_class: connectivity
set_guest_wifi_password: set_guest_wifi_password:
fields: fields:
device_id: device_id:

View file

@ -144,42 +144,12 @@
} }
}, },
"services": { "services": {
"reconnect": {
"name": "[%key:component::fritz::entity::button::reconnect::name%]",
"description": "Reconnects your FRITZ!Box internet connection.",
"fields": {
"device_id": {
"name": "Fritz!Box Device",
"description": "Select the Fritz!Box to reconnect."
}
}
},
"reboot": {
"name": "Reboot",
"description": "Reboots your FRITZ!Box.",
"fields": {
"device_id": {
"name": "[%key:component::fritz::services::reconnect::fields::device_id::name%]",
"description": "Select the Fritz!Box to reboot."
}
}
},
"cleanup": {
"name": "Remove stale device tracker entities",
"description": "Remove FRITZ!Box stale device_tracker entities.",
"fields": {
"device_id": {
"name": "[%key:component::fritz::services::reconnect::fields::device_id::name%]",
"description": "Select the Fritz!Box to check."
}
}
},
"set_guest_wifi_password": { "set_guest_wifi_password": {
"name": "Set guest Wi-Fi password", "name": "Set guest Wi-Fi password",
"description": "Sets a new password for the guest Wi-Fi. The password must be between 8 and 63 characters long. If no additional parameter is set, the password will be auto-generated with a length of 12 characters.", "description": "Sets a new password for the guest Wi-Fi. The password must be between 8 and 63 characters long. If no additional parameter is set, the password will be auto-generated with a length of 12 characters.",
"fields": { "fields": {
"device_id": { "device_id": {
"name": "[%key:component::fritz::services::reconnect::fields::device_id::name%]", "name": "Fritz!Box Device",
"description": "Select the Fritz!Box to configure." "description": "Select the Fritz!Box to configure."
}, },
"password": { "password": {