[Custom Component] Tapo: Cameras Control

You can store recording local now(in HA), but i dont know what’s best, viewing the SD card, might not be the right usecase do to usage(if possible at all ), if the Cam is on (streams), i can’t see where/how you would “stream” a stored file at the same time

Well i dont know either whats best and how to solve this. I think maybe the best is to let the camera start recording on detection. But I am not sure, been reading here, on github and have also been reading a lot in the discord channel. A lot of information, and I haven been able to sort out the information I need yet. But I probably get there sooner than later.

Depending upon where your cam is located, yes you could use “motion” (and narrow the “field” down to the upper half of your entree-door), another cam i have i use “Sound” trigger(in cam), and another motion-sensor at the staircase “small focused”( could be a Door-Bell ), which triggers a sound ( high volume siren close to the outdoor-cam ( to avoid “normal noise” to trigger this cam, that covers the driveway )( it works ok, only thunder-strike above house have triggered it :slight_smile: ) no Deer or Damn Birds :slight_smile:
EDIT: Bonus is i hear the Siren if im in the backyard , or the Garage where it’s located :slight_smile:
There are several alternative ways to “record on demand” in ha, with i.e Agent DVR etc , or HA native “Camera” integration ( Records a “Stream” )

I’m running my HA 2023.7.3 in a Proxmox VM on a Lenovo M93 mini PC with an Intel i5 and 8GB of RAM. I have 5 cameras integrated and they all work okay in HA. However, whenever I restart HA following an update etc, the Tapo Camera Control always delays startup. Here’s a typical log entry:

Logger: homeassistant.components.select
Source: helpers/entity_platform.py:287
Integration: Select (documentation, issues)
First occurred: 07:56:52 (3 occurrences)
Last logged: 07:56:52

Setup of platform tapo_control is taking longer than 60 seconds. Startup will proceed without waiting any longer.

It gets there eventually, but my average startup time is about 8 minutes and I’m wondering if there is a better way of integrating these cameras now that I have Proxmox running?

Are this/these helpers involved in any way in you camera-setup/configuration

I think that refers to the homeassistant/helpers/entity.py in home assistant core, so not something I’ve configured, or the camera config has.

This bit:

    # Entry in the entity registry 
     registry_entry: er.RegistryEntry | None = None 
  
     # The device entry for this entity 
     device_entry: dr.DeviceEntry | None = None 
  
     # Hold list for functions to call on remove. 
     _on_remove: list[CALLBACK_TYPE] | None = None 
  
     _unsub_device_updates: CALLBACK_TYPE | None = None 
  
     # Context 
     _context: Context | None = None 
     _context_set: datetime | None = None 
  
     # If entity is added to an entity platform 
     _platform_state = EntityPlatformState.NOT_ADDED

i don’t know what that is, or why you show it , but i was thinking if you had “any” helpers configured.
if you have helpers or other configs, referring or involving your cams, and this/these are started Before the cam integration is setup, the startup will need to “struggle” abit (forth and back) but eventually start (with some delay"

Best would be to check your logfiles, if nothing obvious in it, set " logger: default debug (temporary) " in your config yaml

If you don’t know what the link I posted was may I politely ask you to have a look at it when you have time. It’s an important part of Home Assistant…in fact it is the source code for Home Assistant. From my limited research, the error log I posted refers to line 287 of a Python script that is part of that source code. I have no helpers associated with these cameras. The helpers referred to are these:

They are part of Home Assistant core, not part of the “Helpers” you can create from within Home Assistant.

It’s okay, every day is a school day for me too :laughing:

I did look at the first link, it points towards GitHub - home-assistant/core: 🏡 Open source home automation that puts local control and privacy first. (i dont intend to go through that)

Helpers as showed in your log “snippet” as well as other thing are started in “order”, in this case seems before started the tapo-cam integration (not unusual ) , but if you have i.e helpers, automations, scripts etc. (other integrations) pointing to an integration which have not started yet ( was what i mean, forth and back, startup delay ) , thou the “snipet” of log you show there is no timestamp , so i don’t really know, thats why i suggested, your logfiles and debug

PS: However i do also see “some” errors from the tapo_controller integration during startup, but less than a minute for this integration, with 4 cams(seems like same “calls/errors” to each cams recording list folder: " /config/local/tapo_control" )

Relevant Example of logfile:

2023-07-22 10:15:53.286 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/config/custom_components/tapo_control/utils.py", line 151, in findMedia
recordingsList = await hass.async_add_executor_job(tapoController.getRecordingsList)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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 569, in getRecordingsList
result = self.executeFunction(
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pytapo/__init__.py", line 138, in executeFunction
raise Exception(
Exception: Error: -71105, Response: {"method": "searchDateWithVideo", "result": {}, "error_code": -71105}
2023-07-22 10:15:56.198 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/config/custom_components/tapo_control/utils.py", line 151, in findMedia
recordingsList = await hass.async_add_executor_job(tapoController.getRecordingsList)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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 569, in getRecordingsList
result = self.executeFunction(
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pytapo/__init__.py", line 138, in executeFunction
raise Exception(
Exception: Error: -71105, Response: {"method": "searchDateWithVideo", "result": {}, "error_code": -71105}
2023-07-22 10:15:57.269 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/config/custom_components/tapo_control/utils.py", line 151, in findMedia
recordingsList = await hass.async_add_executor_job(tapoController.getRecordingsList)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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 569, in getRecordingsList
result = self.executeFunction(
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pytapo/__init__.py", line 138, in executeFunction
raise Exception(
Exception: Error: -71105, Response: {"method": "searchDateWithVideo", "result": {}, "error_code": -71105}
[u]**2023-07-22 10:15:59.282 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.tpc1_recordings_synchronization is taking over 10 seconds**[/u]
2023-07-22 10:16:19.286 WARNING (MainThread) [homeassistant.components.sensor] Updating tapo_control sensor took longer than the scheduled update interval 0:00:30
2023-07-22 10:16:23.675 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/config/custom_components/tapo_control/utils.py", line 151, in findMedia
recordingsList = await hass.async_add_executor_job(tapoController.getRecordingsList)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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 569, in getRecordingsList
result = self.executeFunction(
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pytapo/__init__.py", line 138, in executeFunction
raise Exception(
Exception: Error: -71105, Response: {"method": "searchDateWithVideo", "result": {}, "error_code": -71105}

I’ll start a debug. The logfiles are not much help unfortunately. They’re just full off:

2023-07-24 07:57:31.669 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: tapo_control
2023-07-24 07:57:52.351 WARNING (MainThread) [homeassistant.components.camera] Updating tapo_control camera took longer than the scheduled update interval 0:00:30
2023-07-24 07:57:52.480 WARNING (MainThread) [homeassistant.components.camera] Updating tapo_control camera took longer than the scheduled update interval 0:00:30
2023-07-24 07:57:52.481 WARNING (MainThread) [homeassistant.components.switch] Updating tapo_control switch took longer than the scheduled update interval 0:00:30
2023-07-24 07:57:52.677 WARNING (MainThread) [homeassistant.components.camera] Updating tapo_control camera took longer than the scheduled update interval 0:00:30
2023-07-24 07:57:53.031 WARNING (MainThread) [homeassistant.components.switch] Updating tapo_control switch took longer than the scheduled update interval 0:00:30
2023-07-24 07:57:53.130 WARNING (MainThread) [homeassistant.components.switch] Updating tapo_control switch took longer than the scheduled update interval 0:00:30
2023-07-24 07:58:22.352 WARNING (MainThread) [homeassistant.components.camera] Updating tapo_control camera took longer than the scheduled update interval 0:00:30
2023-07-24 07:58:22.481 WARNING (MainThread) [homeassistant.components.camera] Updating tapo_control camera took longer than the scheduled update interval 0:00:30
2023-07-24 07:58:22.482 WARNING (MainThread) [homeassistant.components.switch] Updating tapo_control switch took longer than the scheduled update interval 0:00:30
2023-07-24 07:58:22.677 WARNING (MainThread) [homeassistant.components.camera] Updating tapo_control camera took longer than the scheduled update interval 0:00:30
2023-07-24 07:58:23.032 WARNING (MainThread) [homeassistant.components.switch] Updating tapo_control switch took longer than the scheduled update interval 0:00:30
2023-07-24 07:58:23.131 WARNING (MainThread) [homeassistant.components.switch] Updating tapo_control switch took longer than the scheduled update interval 0:00:30
2023-07-24 07:58:31.732 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: tapo_control

is it wifi cams or wired ?

They’re all wifi (5 of them) and the streams are okay when running. It’s just the startup time that annoys me. My WiFi network is strong and well set up by the way.

1 Like

I only has this 1 “warning” and it’s on the cam Edit: (where i had forgotten to put in the sd-card :grinning_face_with_smiling_eyes:, and “motion detection on” and also indicating "Update of sensor.tpc1_recordings_synchronization is taking over 10 seconds
( and only during startup )

Thou still i only have about 30seconds for the integration to start, where you are up in +6 min only for the update: camera/switch
Thou i wonder why you have 6 camera + 6 switches , but only 5 Cams, you say

EDIT: How did you setup/configured your cams ? did you enabled “webhooks” and running your HA over https ?

So, this morning’s issue is one camera that stubbornly does not want to Initialise.

I have 6 cameras all wifi connected including 1 x TC70 and 5 x TC60. One of my TC60s just does not want to play today despite multiple attempts at reloading. All the others are fine. They have all been working until a HA restart this morning to update some HACS integrations. Now I have 1 camera not initialising. The other 5 are working fine. Logs show:

2023-08-10 07:10:02.261 ERROR (stream_worker) [homeassistant.components.stream.stream.camera.seans_room_camera_sd_stream] Error from stream worker: Error opening stream (HTTP_OTHER_4XX, Server returned 4XX Client Error, but not one of 40{0,1,3,4}) rtsp://****:****@192.168.0.107:554/stream2
2023-08-10 07:11:42.640 ERROR (stream_worker) [homeassistant.components.stream.stream.camera.seans_room_camera_sd_stream] Error from stream worker: Error opening stream (HTTP_OTHER_4XX, Server returned 4XX Client Error, but not one of 40{0,1,3,4}) rtsp://****:****@192.168.0.107:554/stream2
2023-08-10 07:13:33.048 ERROR (stream_worker) [homeassistant.components.stream.stream.camera.seans_room_camera_sd_stream] Error from stream worker: Error opening stream (HTTP_OTHER_4XX, Server returned 4XX Client Error, but not one of 40{0,1,3,4}) rtsp://****:****@192.168.0.107:554/stream2
2023-08-10 07:13:59.186 WARNING (SyncWorker_58) [homeassistant.components.waze_travel_time.sensor] Error on retrieving data: empty response
2023-08-10 07:15:33.383 ERROR (stream_worker) [homeassistant.components.stream.stream.camera.seans_room_camera_sd_stream] Error from stream worker: Error opening stream (HTTP_OTHER_4XX, Server returned 4XX Client Error, but not one of 40{0,1,3,4}) rtsp://****:****@192.168.0.107:554/stream2
2023-08-10 07:17:43.748 ERROR (stream_worker) [homeassistant.components.stream.stream.camera.seans_room_camera_sd_stream] Error from stream worker: Error opening stream (HTTP_OTHER_4XX, Server returned 4XX Client Error, but not one of 40{0,1,3,4}) rtsp://****:****@192.168.0.107:554/stream2
2023-08-10 07:18:59.209 WARNING (SyncWorker_63) [homeassistant.components.waze_travel_time.sensor] Error on retrieving data: empty response
2023-08-10 07:20:04.139 ERROR (stream_worker) [homeassistant.components.stream.stream.camera.seans_room_camera_sd_stream] Error from stream worker: Error opening stream (HTTP_OTHER_4XX, Server returned 4XX Client Error, but not one of 40{0,1,3,4}) rtsp://****:****@192.168.0.107:554/stream2
2023-08-10 07:22:34.458 ERROR (stream_worker) [homeassistant.components.stream.stream.camera.seans_room_camera_sd_stream] Error from stream worker: Error opening stream (HTTP_OTHER_4XX, Server returned 4XX Client Error, but not one of 40{0,1,3,4}) rtsp://****:****@192.168.0.107:554/stream2
2023-08-10 07:23:42.821 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry 192.168.0.103 for tapo_control
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 388, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/tapo_control/__init__.py", line 196, in async_setup_entry
tapoController = await hass.async_add_executor_job(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
asyncio.exceptions.CancelledError: aiohttp connection lost
2023-08-10 07:24:42.860 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry 192.168.0.103 for tapo_control
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 388, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/tapo_control/__init__.py", line 196, in async_setup_entry
tapoController = await hass.async_add_executor_job(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
asyncio.exceptions.CancelledError: aiohttp connection lost
2023-08-10 07:25:14.808 ERROR (stream_worker) [homeassistant.components.stream.stream.camera.seans_room_camera_sd_stream] Error from stream worker: Error opening stream (HTTP_OTHER_4XX, Server returned 4XX Client Error, but not one of 40{0,1,3,4}) rtsp://****:****@192.168.0.107:554/stream2

Hi, since I got my new C510w this week I have trouble building an automation that skips through my presets every x seconds.

The preset selection works fine when I select it manually in the dropdwon of the tapo cam entity.

When trying to implement the preset circulation in an automation the cam is moved to a specific preset (which is the first preset of the dropdown in ha, and the last preset in the tapo app) and then remains in that preset although the automation is triggered again.

I also tried with service input_select and select, both with next option leading to the same result.

This is my not working automation code

alias: Kamera Einfahrt
description: ""
trigger:
  - platform: time_pattern
    seconds: /20
condition: []
action:
  - device_id: da13f68b865a51202027f54388e51a67
    domain: select
    entity_id: 60f9332ee818790d6210bf9f03153df8
    type: select_next
    cycle: true
mode: single

you are triggering ones every hour (20 seconds past whole) Sorry im wrong here :wink:

Beside maybe you get more “answers” if you create a “Topic” in regards to “Automations” , there are bunch of more people using automations, than there are people having Tapo-Cams

1 Like

Thx for the reply, but since the automation is actually really simple I assume the missbehaviour is more tapo integration related than a general automation problem. Since the angle of the area to surveill is very assymetric I want the cam to stray from one preset to the next, because the normal patrol mode doesn’t really do the job.

ok, i was about to suggest “patrol” , but as i havent tried it i don’t know whether it swipes or move (in sections), also i don’t know whether 20 seconds is too short interval, and have you “manually” tried firing “select next” every 20 seconds,
in your ha-card ? ( do you have an entity called select_next_preset.your_tp_cam ? ) other vice you have to call each “Attribute” ( options: Marked position 1, Marked position 2, Marked position 3 )

Edit: maybe this will help (select.select_next)

1 Like

I can fired it manually way faster than a 20 seconds interval and it works fine. As mentioned in my first post I already tried select and input select - same result.

As for now I just manually programmed ever preset into the automation with delays in between, which works fine. Either there is an issue with the implementation of the tapo controller or there is a setting or condition/state which I don’t see.

Working automation:

alias: Kamera Einfahrt
description: ""
trigger:
  - platform: time_pattern
    minutes: /2
condition: []
action:
  - device_id: da13f68b865a51202027f54388e51a67
    domain: select
    entity_id: 60f9332ee818790d6210bf9f03153df8
    type: select_option
    option: Hoftor
  - delay:
      hours: 0
      minutes: 0
      seconds: 20
      milliseconds: 0
  - device_id: da13f68b865a51202027f54388e51a67
    domain: select
    entity_id: 60f9332ee818790d6210bf9f03153df8
    type: select_option
    option: Eingang
  - delay:
      hours: 0
      minutes: 0
      seconds: 20
      milliseconds: 0
  - device_id: da13f68b865a51202027f54388e51a67
    domain: select
    entity_id: 60f9332ee818790d6210bf9f03153df8
    type: select_option
    option: Tritt
  - delay:
      hours: 0
      minutes: 0
      seconds: 20
      milliseconds: 0
  - device_id: da13f68b865a51202027f54388e51a67
    domain: select
    entity_id: 60f9332ee818790d6210bf9f03153df8
    type: select_option
    option: Haustür
  - delay:
      hours: 0
      minutes: 0
      seconds: 20
      milliseconds: 0
mode: single

1 Like

And you did ofcause read the whole post/topic i linked to, and “followed” up upon those “threads” there right ? … ohh ok i see you still have 3 hours read time since you signed up, i fact since you “jumped in here”. so maybe you should “hold back” on your “assumptions” until you’ve read more about automations, service-calls etc.

And as i said, open a Topic, or feature request

1 Like