diff --git a/custom_components/eufy_security/const.py b/custom_components/eufy_security/const.py index 207eade..dc2860f 100644 --- a/custom_components/eufy_security/const.py +++ b/custom_components/eufy_security/const.py @@ -82,6 +82,8 @@ class PropertyToEntityDescription(Enum): stream_url = EntityDescription(id=auto(), category=EntityCategory.DIAGNOSTIC) stream_status = EntityDescription(id=auto(), category=EntityCategory.DIAGNOSTIC) video_queue_size = EntityDescription(id=auto(), category=EntityCategory.DIAGNOSTIC) + audio_queue_size = EntityDescription(id=auto(), category=EntityCategory.DIAGNOSTIC) + # device binary sensor motionDetected = EntityDescription(id=auto(), device_class=BinarySensorDeviceClass.MOTION) diff --git a/custom_components/eufy_security/eufy_security_api/p2p_streamer.py b/custom_components/eufy_security/eufy_security_api/p2p_streamer.py index 67282ec..2044dd9 100644 --- a/custom_components/eufy_security/eufy_security_api/p2p_streamer.py +++ b/custom_components/eufy_security/eufy_security_api/p2p_streamer.py @@ -23,7 +23,7 @@ async def chunk_generator(self, queue): while True: try: item = await asyncio.wait_for(queue.get(), timeout=2.5) - _LOGGER.debug(f"chunk_generator yield data - {len(item)}") + #_LOGGER.debug(f"chunk_generator yield data - {len(item)}") yield bytearray(item) except TimeoutError as te: _LOGGER.debug(f"chunk_generator timeout Exception %s - traceback: %s", te, traceback.format_exc()) diff --git a/custom_components/eufy_security/sensor.py b/custom_components/eufy_security/sensor.py index 18f06a4..18ebe41 100644 --- a/custom_components/eufy_security/sensor.py +++ b/custom_components/eufy_security/sensor.py @@ -23,6 +23,8 @@ class CameraSensor(Enum): stream_url = "Stream URL" stream_status = "Stream Status" video_queue_size = "Video Queue Size" + audio_queue_size = "Audio Queue Size" + async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities: AddEntitiesCallback) -> None: @@ -51,9 +53,11 @@ def __init__(self, coordinator: EufySecurityDataUpdateCoordinator, metadata: Met def native_value(self): """Return the value reported by the sensor.""" if self.metadata.name in CameraSensor.__members__: - if self.metadata.name == "video_queue_size": + if self.metadata.name == CameraSensor.video_queue_size.name: return self.product.video_queue.qsize() - if self.metadata.name == "stream_provider": + if self.metadata.name == CameraSensor.audio_queue_size.name: + return self.product.audio_queue.qsize() + if self.metadata.name == CameraSensor.stream_provider.name: return self.product.stream_provider.name return get_child_value(self.product.__dict__, self.metadata.name)