From 39cc91dec64501381ef120e32f98bf06f22230d2 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Thu, 31 Mar 2022 23:12:11 +0200 Subject: [PATCH] Remove deprecated reject_call service from modem_callerid (#69019) --- .../components/modem_callerid/const.py | 1 - .../components/modem_callerid/sensor.py | 22 +++---------------- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/homeassistant/components/modem_callerid/const.py b/homeassistant/components/modem_callerid/const.py index 0b01c3b761f..d144e2afd5c 100644 --- a/homeassistant/components/modem_callerid/const.py +++ b/homeassistant/components/modem_callerid/const.py @@ -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, diff --git a/homeassistant/components/modem_callerid/sensor.py b/homeassistant/components/modem_callerid/sensor.py index f4b2f3c3e44..e50eabb17aa 100644 --- a/homeassistant/components/modem_callerid/sensor.py +++ b/homeassistant/components/modem_callerid/sensor.py @@ -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)