Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled exception when trying to view recordings if no SD card inserted #446

Open
codyc1515 opened this issue Nov 7, 2023 · 1 comment
Labels
Bug Something isn't working

Comments

@codyc1515
Copy link

Description

When trying to view recordings in the Media area of HA, if you have no SD card inserted you will received an unhandled exception.

image

Reproduction Steps

  1. Have no SD card inserted in the camera
  2. Browse to Media -> Tapo: Recordings -> Camera Name
  3. Receieve "Unknown error"

Expected behavior

See a message to insert SD card.

If applicable, add error logs.

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/tapo_control/media_source.py:135
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 10:08:59 (2 occurrences)
Last logged: 10:09:03

[546705404608] Error handling message: Unknown error (unknown_error) Cody Cooper from 103.216.189.25 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 26, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/src/homeassistant/homeassistant/components/media_source/__init__.py", line 174, in websocket_browse_media
    media = await async_browse_media(hass, msg.get("media_content_id", ""))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/media_source/__init__.py", line 125, in async_browse_media
    item = await _get_media_item(hass, media_content_id, None).async_browse()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/media_source/models.py", line 79, in async_browse
    return await self.async_media_source().async_browse_media(self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/tapo_control/media_source.py", line 135, in async_browse_media
    recordingsList = await self.hass.async_add_executor_job(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pytapo/__init__.py", line 945, in getRecordingsList
    result = self.executeFunction(
             ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pytapo/__init__.py", line 315, in executeFunction
    raise Exception(
Exception: Error: -71105, Response: {"method": "searchDateWithVideo", "result": {}, "error_code": -71105}

Device Firmware

1.3.6 Build 230424 Rel.77225n(4555)

Integration Version

5.4.2

Using stream component

Yes

Does camera work via official integrations?

Yes

Camera has all attributes filled out in developer tools

Yes

HASS Environment

OS

Search for similar issues

Yes

Additional information

access_token: xxx
model_name: C200
brand: TP-Link
motion_detection: on
frontend_stream_type: hls
device_type: SMART.IPCAMERA
device_model: C200
device_name: C200 1.0
device_info: C200 1.0 IPC
hw_version: 1.0
sw_version: 1.3.6 Build 230424 Rel.77225n(4555)
device_alias: Dining Room Camera
avatar: camera c212
longitude: 0
latitude: 0
has_set_location_info: 0
features: 3
barcode: 
mac: 28-EE-52-93-E9-D3
dev_id: 80215ACBBFF1B116E989BD4366B7BBF31E273DDA
oem_id: 8902D2F34FCE407721DE92F5759839C2
hw_desc: 48574445534300000000000000000001
alarm: off
user: homeassistant
presets: 
{}

record_plan: 
sunday: '["0000-2400:2"]'
monday: '["0000-2400:2"]'
tuesday: '["0000-2400:2"]'
wednesday: '["0000-2400:2"]'
thursday: '["0000-2400:2"]'
friday: '["0000-2400:2"]'
saturday: '["0000-2400:2"]'

entity_picture: /api/camera_proxy/camera.dining_room?token=xxx
icon: mdi:webcam
friendly_name: Dining Room Camera
supported_features: 3
@JurajNyiri JurajNyiri added the Bug Something isn't working label Nov 7, 2023
@HausnerR
Copy link

Have similar issue but right after I click for Media -> Tapo: recordings:

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/tapo_control/media_source.py:111
Integration: Home Assistant WebSocket API ([documentation](https://www.home-assistant.io/integrations/websocket_api), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+websocket_api%22))
First occurred: 21:55:52 (1 occurrences)
Last logged: 21:55:52

[281472670478784] Error handling message: Unknown error (unknown_error) Jakub from 192.168.66.144 (Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2.1 Safari/605.1.15)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 26, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/src/homeassistant/homeassistant/components/media_source/__init__.py", line 174, in websocket_browse_media
    media = await async_browse_media(hass, msg.get("media_content_id", ""))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/media_source/__init__.py", line 125, in async_browse_media
    item = await _get_media_item(hass, media_content_id, None).async_browse()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/media_source/models.py", line 79, in async_browse
    return await self.async_media_source().async_browse_media(self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/tapo_control/media_source.py", line 105, in async_browse_media
    children=[
             ^
  File "/config/custom_components/tapo_control/media_source.py", line 111, in <listcomp>
    title=self.hass.data[DOMAIN][entry]["name"],
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
KeyError: 'name'

Maybe it help to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants