Remove deprecated reject_call service from modem_callerid (#69019)
This commit is contained in:
parent
c6cd474312
commit
39cc91dec6
2 changed files with 3 additions and 20 deletions
|
@ -8,7 +8,6 @@ DATA_KEY_API = "api"
|
|||
DEFAULT_NAME = "Phone Modem"
|
||||
DOMAIN = "modem_callerid"
|
||||
ICON = "mdi:phone-classic"
|
||||
SERVICE_REJECT_CALL = "reject_call"
|
||||
|
||||
EXCEPTIONS: Final = (
|
||||
FileNotFoundError,
|
||||
|
|
|
@ -7,11 +7,11 @@ from phone_modem import PhoneModem
|
|||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_DEVICE, EVENT_HOMEASSISTANT_STOP, STATE_IDLE
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_STOP, STATE_IDLE
|
||||
from homeassistant.core import Event, HomeAssistant, callback
|
||||
from homeassistant.helpers import entity_platform
|
||||
|
||||
from .const import CID, DATA_KEY_API, DOMAIN, ICON, SERVICE_REJECT_CALL
|
||||
from .const import CID, DATA_KEY_API, DOMAIN, ICON
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -28,7 +28,6 @@ async def async_setup_entry(
|
|||
ModemCalleridSensor(
|
||||
api,
|
||||
entry.title,
|
||||
entry.data[CONF_DEVICE],
|
||||
entry.entry_id,
|
||||
)
|
||||
]
|
||||
|
@ -43,9 +42,6 @@ async def async_setup_entry(
|
|||
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, _async_on_hass_stop)
|
||||
)
|
||||
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
platform.async_register_entity_service(SERVICE_REJECT_CALL, {}, "async_reject_call")
|
||||
|
||||
|
||||
class ModemCalleridSensor(SensorEntity):
|
||||
"""Implementation of USB modem caller ID sensor."""
|
||||
|
@ -53,11 +49,8 @@ class ModemCalleridSensor(SensorEntity):
|
|||
_attr_icon = ICON
|
||||
_attr_should_poll = False
|
||||
|
||||
def __init__(
|
||||
self, api: PhoneModem, name: str, device: str, server_unique_id: str
|
||||
) -> None:
|
||||
def __init__(self, api: PhoneModem, name: str, server_unique_id: str) -> None:
|
||||
"""Initialize the sensor."""
|
||||
self.device = device
|
||||
self.api = api
|
||||
self._attr_name = name
|
||||
self._attr_unique_id = server_unique_id
|
||||
|
@ -85,12 +78,3 @@ class ModemCalleridSensor(SensorEntity):
|
|||
self._attr_extra_state_attributes[CID.CID_TIME] = self.api.cid_time
|
||||
self._attr_native_value = self.api.state
|
||||
self.async_write_ha_state()
|
||||
|
||||
async def async_reject_call(self) -> None:
|
||||
"""Reject Incoming Call."""
|
||||
_LOGGER.warning(
|
||||
"Calling reject_call service is deprecated and will be removed after 2022.4; "
|
||||
"A new button entity is now available with the same function "
|
||||
"and replaces the existing service"
|
||||
)
|
||||
await self.api.reject_call(self.device)
|
||||
|
|
Loading…
Add table
Reference in a new issue