Use pan/tilt function for TP-Link Tapo C200 from Home assistant?

I have no idea, nobody reported that yet.

So PTZ works with HA with this this integration? Tapo c200 ?

Yes, it does works.

tapo on my ha

translation for the italian gui:
sinistra -> left
destra -> right
su -> up
giu -> down
salva pos1/2 -> save position 1/2
vai pos1/2 -> go position 1/2

1 Like

Thanks for quick reply! Just got home from buying one :slight_smile:

Is it possible to share yout ptz config ? :smiley:

I added the camera in “Integrations”. It’s pretty straightforward.

This is the code for the card:

type: vertical-stack
cards:
  - aspect_ratio: 50%
    entity: camera.tapo_camera_f11f_hd
    type: picture-entity
    camera_view: live
  - type: horizontal-stack
    cards:
      - type: button
        tap_action:
          action: call-service
          service: tapo_control.ptz
          service_data:
            entity_id: camera.tapo_camera_f11f_hd
            pan: LEFT
            distance: 0.1
        entity: camera.tapo_camera_f11f_hd
        name: sinistra
        show_state: false
        show_icon: true
        icon_height: 32px
      - type: button
        tap_action:
          action: call-service
          service: tapo_control.ptz
          service_data:
            entity_id: camera.tapo_camera_f11f_hd
            pan: RIGHT
            distance: 0.1
        entity: camera.tapo_camera_f11f_hd
        name: destra
        show_state: false
        show_icon: true
        icon_height: 32px
      - type: button
        tap_action:
          action: call-service
          service: tapo_control.ptz
          service_data:
            entity_id: camera.tapo_camera_f11f_hd
            tilt: UP
            distance: 0.1
        entity: camera.tapo_camera_f11f_hd
        name: sù
        show_state: false
        show_icon: true
        icon_height: 32px
      - type: button
        tap_action:
          action: call-service
          service: tapo_control.ptz
          service_data:
            entity_id: camera.tapo_camera_f11f_hd
            tilt: DOWN
            distance: 0.1
        entity: camera.tapo_camera_f11f_hd
        name: giù
        show_state: false
        show_icon: true
        icon_height: 32px
  - type: horizontal-stack
    cards:
      - type: button
        tap_action:
          action: call-service
          service: tapo_control.save_preset
          service_data:
            entity_id: camera.tapo_camera_f11f_hd
            name: pos1
        entity: camera.tapo_camera_f11f_hd
        name: salva pos1
        show_state: false
        show_icon: true
        icon_height: 32px
      - type: button
        tap_action:
          action: call-service
          service: tapo_control.ptz
          service_data:
            entity_id: camera.tapo_camera_f11f_hd
            preset: pos1
        entity: camera.tapo_camera_f11f_hd
        name: vai pos1
        show_state: false
        show_icon: true
        icon_height: 32px
      - type: button
        tap_action:
          action: call-service
          service: tapo_control.save_preset
          service_data:
            entity_id: camera.tapo_camera_f11f_hd
            name: pos2
        entity: camera.tapo_camera_f11f_hd
        name: salva pos2
        show_state: false
        show_icon: true
        icon_height: 32px
      - type: button
        tap_action:
          action: call-service
          service: tapo_control.ptz
          service_data:
            entity_id: camera.tapo_camera_f11f_hd
            preset: pos2
        entity: camera.tapo_camera_f11f_hd
        name: vai pos2
        show_state: false
        show_icon: true
        icon_height: 32px

big note: there’s a considerable delay (around 8 seconds) between the “movement command” and the video on the camera. The PTZ command is executed immediatly, but the video is delayed. I still haven’t looked into it.

You can disable stream in options of integration for near instant video at the cost of hw resources. That’s just how home assistant works.

For me quality got much worse when i disable that. same for you? =)
And do you get any motion sensor entity from your C200? i got one but after a little while it no longer working. now i cant get it back even if i re add the camera.

Thank you! :slight_smile:
Do you get any motion sensor entity from your C200? i got one but after a little while it no longer working. now i cant get it back even if i re add the camera.

Yes it is the same. Go read FAQ on readme of the repo, all your questions are answered there :slight_smile:

Oh i see, Thank you! Works now :slight_smile:

First of all, thank you very much for the excellent work and dedication for this project. I would like to know if it was possible to disconnect the camera from the app and from its cloud once configured and connected to ha?

Hello no you cannot remove it from the app. You can block the cameras access to cloud via network firewall.

Hi, should this work for C310 as well?

i have tested it, but it returns: “error_code”: -40401

@JurajNyiri can give you a better answer. What is that error code? Has anybody tried it with a C310?

ok, full response from the camera is:

{

"error_code": -40401,

"result": {

    "data": {

        "code": -40407,

        "encrypt_type": [

            "1",

            "2"

        ],

        "key": "LONG_KEY",

        "nonce": "SHORT_STRING"

    }

}

}

You need to use cloud password hash with C310 (works with every camera).

1 Like

Your component has been tested with the C310? I cannot remember reading it somewhere.

@erlend_oyen, just try the custom component from HASS - Tapo Camera Control, It is @JurajNyiri’s great work.

tested both cloud and local pwd hash, and custom username/and admin, same result.

Then you must be doing something wrong as C310 works this way in GitHub - JurajNyiri/HomeAssistant-Tapo-Control: Control for Tapo cameras as a Home Assistant component . You can check the code there to see what you need to adjust.

1 Like

i have looked at these parts of the code to find the headers:

lass Tapo:
def init(self, host, user, password, cloudPassword=""):
self.host = host
self.user = user
self.password = password
self.cloudPassword = cloudPassword
self.stok = False
self.userID = False
self.headers = {
“Host”: self.host,
“Referer”: “https://{host}”.format(host=self.host),
“Accept”: “application/json”,
“Accept-Encoding”: “gzip, deflate”,
“User-Agent”: “Tapo CameraClient Android”,
“Connection”: “close”,
“requestByApp”: “true”,
“Content-Type”: “application/json; charset=UTF-8”,

and this to find the json body needed:

def refreshStok(self):
url = “https://{host}”.format(host=self.host)
data = {
“method”: “login”,
“params”: {
“hashed”: True,
“password”: self.hashedPassword,
“username”: self.user,
},
}
res = requests.post(
url, data=json.dumps(data), headers=self.headers, verify=False

stil not receiving a token in return

using postman.

camera firmware 1.0.13