diff --git a/homeassistant/components/unifiprotect/binary_sensor.py b/homeassistant/components/unifiprotect/binary_sensor.py index fb60158580e..e35eb6f48f3 100644 --- a/homeassistant/components/unifiprotect/binary_sensor.py +++ b/homeassistant/components/unifiprotect/binary_sensor.py @@ -437,9 +437,6 @@ EVENT_SENSORS: tuple[ProtectBinaryEventEntityDescription, ...] = ( ufp_enabled="is_motion_detection_on", ufp_event_obj="last_motion_event", ), -) - -SMART_EVENT_SENSORS: tuple[ProtectBinaryEventEntityDescription, ...] = ( ProtectBinaryEventEntityDescription( key="smart_obj_any", name="Object detected", @@ -711,26 +708,6 @@ class ProtectEventBinarySensor(EventEntityMixin, BinarySensorEntity): entity_description: ProtectBinaryEventEntityDescription _state_attrs = ("_attr_available", "_attr_is_on", "_attr_extra_state_attributes") - @callback - def _async_update_device_from_protect(self, device: ProtectModelWithId) -> None: - super()._async_update_device_from_protect(device) - description = self.entity_description - event = self.entity_description.get_event_obj(device) - if is_on := bool(description.get_ufp_value(device)): - if event: - self._set_event_attrs(event) - else: - self._attr_extra_state_attributes = {} - self._attr_is_on = is_on - - -class ProtectSmartEventBinarySensor(EventEntityMixin, BinarySensorEntity): - """A UniFi Protect Device Binary Sensor for smart events.""" - - device: Camera - entity_description: ProtectBinaryEventEntityDescription - _state_attrs = ("_attr_available", "_attr_is_on", "_attr_extra_state_attributes") - @callback def _set_event_done(self) -> None: self._attr_is_on = False @@ -749,7 +726,10 @@ class ProtectSmartEventBinarySensor(EventEntityMixin, BinarySensorEntity): if not ( event - and description.has_matching_smart(event) + and ( + description.ufp_obj_type is None + or description.has_matching_smart(event) + ) and not self._event_already_ended(prev_event, prev_event_end) ): self._set_event_done() @@ -774,11 +754,6 @@ def _async_event_entities( ) -> list[ProtectDeviceEntity]: entities: list[ProtectDeviceEntity] = [] for device in data.get_cameras() if ufp_device is None else [ufp_device]: - entities.extend( - ProtectSmartEventBinarySensor(data, device, description) - for description in SMART_EVENT_SENSORS - if description.has_required(device) - ) entities.extend( ProtectEventBinarySensor(data, device, description) for description in EVENT_SENSORS diff --git a/tests/components/unifiprotect/test_binary_sensor.py b/tests/components/unifiprotect/test_binary_sensor.py index 42782d10429..af8ce015955 100644 --- a/tests/components/unifiprotect/test_binary_sensor.py +++ b/tests/components/unifiprotect/test_binary_sensor.py @@ -25,7 +25,6 @@ from homeassistant.components.unifiprotect.binary_sensor import ( LIGHT_SENSORS, MOUNTABLE_SENSE_SENSORS, SENSE_SENSORS, - SMART_EVENT_SENSORS, ) from homeassistant.components.unifiprotect.const import ( ATTR_EVENT_SCORE, @@ -453,7 +452,7 @@ async def test_binary_sensor_package_detected( doorbell.smart_detect_settings.object_types.append(SmartDetectObjectType.PACKAGE) _, entity_id = ids_from_device_description( - Platform.BINARY_SENSOR, doorbell, SMART_EVENT_SENSORS[4] + Platform.BINARY_SENSOR, doorbell, EVENT_SENSORS[6] ) event = Event(