{"id":7610,"library":"pytapo","title":"PyTapo: Tapo Camera Communication Library","description":"PyTapo is an unofficial Python library designed for communication with Tapo Cameras. It facilitates interoperability by wrapping HTTP requests used to control and retrieve data from Tapo devices. The library is actively maintained, currently at version 3.4.13, and receives regular updates focused on bug fixes, performance enhancements, and support for new camera features such as dual-cam linkage.","status":"active","version":"3.4.13","language":"en","source_language":"en","source_url":"https://github.com/JurajNyiri/pytapo","tags":["Tapo","Camera","IoT","Smart Home","TP-Link","Home Automation"],"install":[{"cmd":"pip install pytapo","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"HTTP client for network requests.","package":"urllib3","optional":false},{"reason":"Likely related to real-time protocol handling for streams.","package":"rtp","optional":false},{"reason":"HTTP client for network requests.","package":"requests","optional":false},{"reason":"Interoperability with TP-Link Kasa devices, often related to Tapo's parent ecosystem.","package":"python-kasa","optional":false},{"reason":"Cryptographic operations for secure communication with cameras.","package":"pycryptodome","optional":false},{"reason":"Required for converting recording streams to watchable video files.","package":"ffmpeg","optional":true}],"imports":[{"note":"The primary class for interacting with Tapo cameras.","symbol":"Tapo","correct":"from pytapo import Tapo"}],"quickstart":{"code":"import os\nfrom pytapo import Tapo\n\n# It's recommended to store sensitive information in environment variables.\nhost = os.environ.get('TAPO_CAMERA_HOST', '192.168.1.100') # Replace with your camera's IP\nuser = os.environ.get('TAPO_CAMERA_USER', 'camera_username') # Camera Account username from Tapo App\npassword = os.environ.get('TAPO_CAMERA_PASSWORD', 'camera_password') # Camera Account password from Tapo App\n\ntry:\n    tapo = Tapo(host, user, password)\n    basic_info = tapo.getBasicInfo()\n    print(f\"Successfully connected to Tapo camera {host}.\")\n    print(f\"Device Name: {basic_info['device_name']}\")\n    print(f\"Device ID: {basic_info['device_id']}\")\nexcept Exception as e:\n    print(f\"Failed to connect to Tapo camera: {e}\")\n    print(\"Please ensure the host, username, and password are correct.\")\n    print(\"For authentication, use the 'Camera Account' created in the Tapo App (Settings > Advanced settings > Camera account).\")\n","lang":"python","description":"Initialize the `Tapo` class with your camera's IP address, username, and password, then retrieve basic device information. Ensure you use the 'Camera Account' credentials set up in the Tapo mobile application."},"warnings":[{"fix":"Always use the 'Camera Account' credentials established within the Tapo App (Settings > Advanced settings > Camera account). For some specific camera models or firmware, 'admin' with the TP-Link cloud password might be a fallback but is not the recommended method.","message":"Authentication often fails due to incorrect credentials. Users frequently attempt to use their TP-Link cloud account password or an 'admin' username not configured as a local camera account.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Install `ffmpeg` on your operating system. For example, on Ubuntu: `sudo apt-get install ffmpeg`, or on macOS: `brew install ffmpeg`.","message":"Downloading recordings requires `ffmpeg` to be installed and available in your system's PATH, as `pytapo` uses it for stream conversion.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Regularly update `pytapo` to the latest version. If using a Home Assistant integration, ensure the integration version is compatible with your `pytapo` version and camera firmware. Check the GitHub issues for known firmware-related problems.","message":"New Tapo camera firmware versions can introduce changes that break compatibility with `pytapo` functions, requiring updates to the library or dependent integrations.","severity":"breaking","affected_versions":"All versions, especially with new camera firmware."},{"fix":"Upgrade `pytapo` to version 3.4.5 or newer, which includes fixes for `urllib3` compatibility. Ensure your `urllib3` library is also up to date.","message":"Users of `urllib3` versions 2.0 or higher might encounter `SSLV3_ALERT_HANDSHAKE_FAILURE` errors due to underlying changes in SSL/TLS handling.","severity":"gotcha","affected_versions":"Versions prior to 3.4.5 (where an internal fix was noted)"},{"fix":"Ensure the camera is fully set up and initialized via the official Tapo app. Explicitly enable and configure the local 'Camera Account' within the Tapo App. Avoid using 'admin' as a local RTSP username if not explicitly supported or advised by the camera's local account settings.","message":"KLAP camera models (e.g., C206, C212) can exhibit 'Server disconnected' errors, particularly if the camera hasn't been fully initialized through the official app or if the local authentication service isn't active.","severity":"gotcha","affected_versions":"All versions, affecting KLAP-enabled cameras."}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Verify the host IP, username, and password. Create or use the 'Camera Account' credentials from the Tapo App (Settings > Advanced settings > Camera account). These are distinct from your TP-Link cloud account.","cause":"The username or password provided to the `Tapo` class constructor is incorrect, or you are attempting to use TP-Link cloud credentials instead of the local 'Camera Account' credentials.","error":"Exception: Invalid authentication data"},{"fix":"Complete the camera's setup process through the official Tapo mobile application. Ensure the 'Camera Account' is enabled and configured correctly. Verify network connectivity and that the camera IP is reachable.","cause":"A connection issue specific to KLAP-protocol cameras, often occurring when the camera's local authentication service isn't fully active, or the camera hasn't completed initial setup via the official Tapo app.","error":"PyTapo KLAP Error #3: ('Device connection error: XXX.XXX.XXX.XXX: Server disconnected', ServerDisconnectedError('Server disconnected'))"},{"fix":"Upgrade `pytapo` to the exact required version (Y.Y.Y) or the latest version if the integration allows. Use `pip install --upgrade pytapo` or `pip install pytapo==Y.Y.Y`.","cause":"An integration (e.g., Home Assistant) explicitly requires a different or newer version of `pytapo` than what is currently installed in your environment.","error":"DependencyError: Could not setup dependencies: Incorrect pytapo version installed: X.X.X. Required: Y.Y.Y."},{"fix":"Update `pytapo` to version 3.4.9 or later, as this specific issue was addressed in that release.","cause":"An internal error code indicating a failure when trying to retrieve or browse media from the camera.","error":"Error code -71112 when browsing media"}]}