[Custom Component] Tapo: Cameras Control

Thank you for your quick reply :). I have 2 routers in the apartment. (Xiaomi Mesh network - wifi). Then it shouldn’t be a problem if I think about it.

Excellent work of integration! Years ago, I chose a different brand. Partly with successful integration. But I’m not happy with them. I plan to get a C200 and C100 camera soon. Your integration is what I need :). And … Is lan in complete control? I mean if Tapo app / cloud stops then HomeAssistant will continue to control?

Yes, you can completely block the camera from the cloud after initial setup.

1 Like

Thank you very much! That’s great.

I have a TP-Link Tapo C110 in use for watching a birdhouse :wink: and I am using this Tapo: Cameras Control integration to view the HD stream. Unfortunately, in the majority of cases, a snapshot created by the camera.snapshot service from the stream produces a distorted image file like this:

grafik

It makes no difference whether the service is triggered by the camera’s motion sensor or manually by pushing a button from within a view or for automated snapshots (currently 1 per hour). In Home Assistant, I am using 2 picture-glance cards for both the live stream and the last snapshot (i.e. still picture) within the same view.

This is my motion-triggered automation:

(please expand)
  - mode: single
    max_exceeded: silent

    variables:
      snapshot_file: '/config/www/images/snapshot.jpg'

    trigger:

      - platform: state
        entity_id: binary_sensor.birdhouse_motion
        to: 'on'

    action:

      - service: input_datetime.set_datetime
        target:
          entity_id: input_datetime.birdhouse_last_snapshot
        data:
          timestamp: "{{ now().timestamp() }}"

      - service: camera.snapshot
        entity_id: camera.birdhouse_hd
        data:
          filename: "/config/www/images/snapshot_{{ (states('input_datetime.birdhouse_last_snapshot') | as_datetime).strftime('%Y.%m.%d_%H.%M.%S') }}.jpg"

When I have to restart Home Assistant (i.e. after core updates or other issues requiring it), the whole thing becomes quite unreliable, i.e. the snapshots are distorted. Sometimes, one or more hard or soft reboots will fix it so that I get proper snapshots again but this is neither deterministic nor sustainable because sometimes it may work for a while but later it will fail again.

What I have tried so far:

  • soft reboots of the camera (using tapo_control.reboot service)
  • hard reboots of the camera (i.e. disconnection from the power supply)
  • automatic reboots of the camera after Home Assistant restart (after a delay)
  • checked firmware version of the camera (is most recent: 1.1.12 Build 211028 Rel.22161n(4555))

Does anybody experience a similar issue and has an idea how to solve it? Thank you!

had this problem some time ago - wi-fi network quality/bandwidth was the issue for me - nothing to do with HA or the component - for me at least.

I came to this conclusion based on having 2 of the same Tapo cameras in different parts of the house - one never had any issues. The other pretty much always a problem demonstrating the very symptoms you describe. I also noticed that if I switch to the Low def stream on that camera the problems reduced considerably.

Stuck in a new new 2.4 ghz extender and no more issues.

Check if you have same issues with SD stream. If you don’t try moving the camera nearer your router and see if things improve. then at least you’ll know.

Hope that helps

1 Like

Hey, anyone around with firmware update available? I am developing updating directly through Home Assistant and unfortunately all my cameras are updated to latest so I am looking for tester.

If anyone has a few minutes, please come to discord. :slight_smile:

Update

Detecting the new versions is available in updateEntity branch on github. Install button restarts camera for now without updating it.

Thank to Lossberg on discord I got necessary data for detecting new firmware version. Now I am looking for someone who is also willing to update their camera using the script I send to implement the Install functionality :slight_smile:

Sorry, my 4 “c200” is on latest , thou next time i will be among the last who “update” the cams :slight_smile:

Testers needed!

Do you have outdated camera firmware and want to help out test new release? Then:

  • Download this PR and manually install files over your current files. You can also use HACS, enable beta versions and download 3.5.0-rc2.
  • Update to Home Assistant 2022.04.x
  • Restart Home Assistant, and you should see an available update for your camera(s) in Configuration.

  • Click Install and see if the camera updates successfully.
  • Report results

*Camera needs internet access while checking for new firmware(once per 24 hours or on reboot) and while updating

Thank you!

1 Like

Upgraded to Beta (thank you)
Rebooted and shortly afterwards an update was flagged as available…see below

took a few minutes to download, install and reboot and then
image

so looks like it’s all good :smiley:

does take a while to install, etc and there’s no indication of activity from the HA side of things but that’s prob not coming from this component…

If you need anything else re testing, etc let me know :+1:t2:

Update:
Camera went unavailable in HA after the firmware update (though was online in the Tapo App). Reboot HA and all back to normal.

1 Like

Thank you for testing!

I wasn’t able to test the whole flow since all my 8 cameras are up to date, so it was all based on estimates and data gathered from people here and on discord.

There should be an animation after you hit install that disappears after camera is updated. Camera should also become available shortly after (similarly to how it does when you reboot camera), not sure why it didn’t for you. :thinking:

I released a stable version since it seems to work and will test this myself when there is a next update released and will fix any bugs I find during updates.

Thank you again @GSzabados, Lossberg and @Gav_in for testing and providing necessary data!

4 Likes

Did you have anything in the log regarding Tapo Control?

If the camera goes unavailable, then you can use the HA service to reload the Tapo camera’s config entity. No need to reboot/restart HA.

@JurajNyiri, thanks for your outstanding work again.

Just need to nail that download video feature finally as a next step. :wink:

Just kidding! All is it amazing work, how these cameras started to work with HA.

1 Like

Thanks, had tried that alright but just gave the “Need to Restart HA” to reload this component :man_shrugging:t2:

Regarding the Logs, yes there was mention of the component but really only to say that the camera was unavailable and needed to be restarted

ERROR (MainThread) [custom_components.tapo_control] Authentication to Tapo camera failed. Please restart the camera and try again

five minutes after that msg, in the log there is also

ERROR (MainThread) [homeassistant.config_entries] Error unloading entry 192.168.X.X Location for tapo_control
File “/config/custom_components/tapo_control/init.py”, line 124, in async_unload_entry

Didn’t make too much sense to me and as I say a restart sorted it out so all good. Also the possibility that I didn’t wait long enough for HA to recognise the camera again after it appeared in the App and just restarted so could be something (impatience :thinking:) on my end
If you need me to share anything else just shout

1 Like

@JurajNyiri
That was the point probably where the camera updated the firmware.

I think that was visible in my log as well regarding the update (and that was caught as an exception by the code and stopped).

Then I tried to get the firmware state, and I hit an error first, because the camera was rebooting and not responding (I haven’t sent that through because I assumed that is normal due to a restart should happen on the camera), then on the next try the firmware state was empty as it has already updated.

1 Like

It is weird;

This error is logged inside update listener, which is generally executed when component is updated - entity is added, deleted, modified via config flow, which I thought would not be triggered by this.

This error is logged inside a function which is called when component is being unloaded, because of removal of the entity by the user or by restarting Home Assistant.

Generally, the function which is getting the data has a failover, if the access token expires it tries to generate new one. Only if that fails, it fails. Which might happen during the update as camera is offline (and thus is really unavailable). It should however recover on the next periodic update of data (every 30sec approximately).

Lets wait and see if people report this and I can debug further, the latest it will be fixed will be on the next time a new update is released and I get an opportunity to update myself.

2 Likes

Tried tonight the updated component with camera firmware update management. It warned me a new firmware is available for my C210. Clicked on Install, it started to show a kind of progress…Then…nothing. Checked the camera, it was upgrading, and the upgrade went well.

Negative point, the update window was still there even after the update… Keep nagging ! I clicked on pass and I guess it won’t come from now :slight_smile:

That’s good job !

1 Like

The firmware update feature sounds great.

I am wondering whether it is possible to use the new update mechanism to allow the camera to update the firmware without access to the outside internet. I currently block the access to the outside at the router, apart from exatly the moment when I want to update the firmware. Could (or indeed does?) the update service allow HA to act as a sort of proxy?

2 Likes

No its not possible, this integration just tells camera to update, just like when you are clicking the button in the official app.

1 Like

Hello,
sorry, I am thinking about buying a C210 and was wondering if auto tracking is working properly in Home Assistant.
There is mention of the firmware version being important, but if I buy a new one, it will have new firmware. Will I hence not be able to use all features?

And does this integration require me to have an internet connection for the camera or is it completely local?