From e449f8e0e5ba0fe97770cffc3914ca88c10e4a12 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Wed, 19 Jul 2023 14:40:00 +0200 Subject: [PATCH] Remove Reolink event connection sensor (#96903) --- homeassistant/components/reolink/host.py | 9 ----- homeassistant/components/reolink/sensor.py | 34 ++----------------- homeassistant/components/reolink/strings.json | 8 ----- 3 files changed, 2 insertions(+), 49 deletions(-) diff --git a/homeassistant/components/reolink/host.py b/homeassistant/components/reolink/host.py index dac02b91315..81fbda63fef 100644 --- a/homeassistant/components/reolink/host.py +++ b/homeassistant/components/reolink/host.py @@ -432,15 +432,6 @@ class ReolinkHost: webhook.async_unregister(self._hass, self.webhook_id) self.webhook_id = None - @property - def event_connection(self) -> str: - """Return the event connection type.""" - if self._webhook_reachable: - return "onvif_push" - if self._long_poll_received: - return "onvif_long_poll" - return "fast_poll" - async def _async_long_polling(self, *_) -> None: """Use ONVIF long polling to immediately receive events.""" # This task will be cancelled once _async_stop_long_polling is called diff --git a/homeassistant/components/reolink/sensor.py b/homeassistant/components/reolink/sensor.py index 42758dc9929..af8d049dbc6 100644 --- a/homeassistant/components/reolink/sensor.py +++ b/homeassistant/components/reolink/sensor.py @@ -9,7 +9,6 @@ from decimal import Decimal from reolink_aio.api import Host from homeassistant.components.sensor import ( - SensorDeviceClass, SensorEntity, SensorEntityDescription, SensorStateClass, @@ -63,13 +62,11 @@ async def async_setup_entry( """Set up a Reolink IP Camera.""" reolink_data: ReolinkData = hass.data[DOMAIN][config_entry.entry_id] - entities: list[ReolinkHostSensorEntity | EventConnectionSensorEntity] = [ + async_add_entities( ReolinkHostSensorEntity(reolink_data, entity_description) for entity_description in HOST_SENSORS if entity_description.supported(reolink_data.host.api) - ] - entities.append(EventConnectionSensorEntity(reolink_data)) - async_add_entities(entities) + ) class ReolinkHostSensorEntity(ReolinkHostCoordinatorEntity, SensorEntity): @@ -92,30 +89,3 @@ class ReolinkHostSensorEntity(ReolinkHostCoordinatorEntity, SensorEntity): def native_value(self) -> StateType | date | datetime | Decimal: """Return the value reported by the sensor.""" return self.entity_description.value(self._host.api) - - -class EventConnectionSensorEntity(ReolinkHostCoordinatorEntity, SensorEntity): - """Reolink Event connection sensor.""" - - def __init__( - self, - reolink_data: ReolinkData, - ) -> None: - """Initialize Reolink binary sensor.""" - super().__init__(reolink_data) - self.entity_description = SensorEntityDescription( - key="event_connection", - translation_key="event_connection", - icon="mdi:swap-horizontal", - device_class=SensorDeviceClass.ENUM, - entity_category=EntityCategory.DIAGNOSTIC, - entity_registry_enabled_default=False, - options=["onvif_push", "onvif_long_poll", "fast_poll"], - ) - - self._attr_unique_id = f"{self._host.unique_id}_{self.entity_description.key}" - - @property - def native_value(self) -> str: - """Return the value reported by the sensor.""" - return self._host.event_connection diff --git a/homeassistant/components/reolink/strings.json b/homeassistant/components/reolink/strings.json index c0c2094eeb9..7d8c3a213eb 100644 --- a/homeassistant/components/reolink/strings.json +++ b/homeassistant/components/reolink/strings.json @@ -95,14 +95,6 @@ } }, "sensor": { - "event_connection": { - "name": "Event connection", - "state": { - "onvif_push": "ONVIF push", - "onvif_long_poll": "ONVIF long poll", - "fast_poll": "Fast poll" - } - }, "wifi_signal": { "name": "Wi-Fi signal" }