pytapo Documentation

repository·main·Indexed 19 days ago

https://github.com/jurajnyiri/pytapo

A Python library for communicating with TP-Link Tapo cameras, serving as the underlying engine for the HomeAssistant-Tapo-Control integration. It provides functionality to retrieve basic camera information and download recordings from SD cards using ffmpeg.

Tokens
514
Snippets
2
Records
4
Agent score
16%

What's inside pytapo

  1. Download recordings from SD card

    main

    PyTapo supports downloading recordings saved on the camera's SD card. This requires ffmpeg to be installed on your system to convert streams into watchable files.

    To use the recording download functionality (referencing the example script), you must set the following environment variables:

    • HOST: IP Address of your camera
    • PASSWORD_CLOUD: Tapo cloud account password (required to access recordings; processing remains local)
    • OUTPUT: Directory where you wish to save all the recordings
    • DATE: Date for which to download recordings in YYYYMMDD format (e.g., 20230221)
  2. Initialize the Tapo library

    main

    To interact with your camera, import the Tapo class and instantiate it with the camera's IP address, the camera account username, and the camera account password. The camera account is created via the Tapo App under Settings > Advanced settings > Camera account.

    from pytapo import Tapo
    
    user = "" # user you set in Advanced Settings -> Camera Account
    password = "" # password you set in Advanced Settings -> Camera Account
    host = "" # ip of the camera, example: 192.168.1.52
    
    tapo = Tapo(host, user, password)
    
    print(tapo.getBasicInfo())
  3. Troubleshoot authentication errors

    main

    If you encounter an Exception: Invalid authentication data error, it means the provided credentials failed to authenticate.

    Depending on your camera model and firmware, you may need to use your TP-Link cloud account credentials instead of the camera account. Try using admin as the user and your TP-Link cloud account password as the password.