How to connect a Tuya Smart camera to an Anjielo video doorbell via Home Assistant?

Option 1: Direct Streaming via ONVIF/RTSP (Highly Recommended)

This is the most stable and lowest-latency local connection method. If the camera supports it, this is the preferred option.

Enable ONVIF in the App: Open the "Smart Life" or "Tuya Smart" app on your phone. Go to the camera's settings page and find and enable the "ONVIF" function.

Key Step: Set a dedicated ONVIF password. Please note that the username is usually fixed as "admin," and the password is not your app account password; it needs to be set separately.

Configure in Home Assistant:

Method A (Recommended): Using "ONVIF" Integration
Add "ONVIF" integration in Home Assistant's "Devices & Services." It usually discovers the camera automatically. Enter the username "admin" and the ONVIF password you just set.

Method B: Using "General Camera" Integration

If Method A doesn't work, you can manually add an RTSP link. The RTSP address format for a camera is typically as follows: Main stream (HD): rtsp://admin:password@cameraIP:8554/main Sub stream (smooth): rtsp://admin:password@cameraIP:8554/sub Please replace "password" with your ONVIF password and "camera IP" with the camera's actual address on your local network.

Method C (Reducing Latency): Using "WebRTC Camera"

If high latency is required, you can install the "WebRTC Camera" integration via HACS and then add it to the dashboard using the above RTSP address, achieving near real-time video.

Option Two: Using LocalTuya Custom Integration (Alternative)

If your camera does not support ONVIF, or if you want to control the camera's pan/tilt function in Home Assistant, you can try this method. It communicates directly with the graffiti device via the local network.

Install LocalTuya: Search for and install the "LocalTuya" integration via HACS.

Obtaining Key Device Information:

Device ID and Local Key: These can be obtained in two ways:
* Online: Go to the Tuya IoT platform, find the device details page in your cloud project, and copy these two pieces of information.
* Python Script: If the above doesn't work, you can run a small script from the tinytuya library on your computer, which can also scan for the device.
* IP Address: In your router's management interface, find the static internal network IP address assigned to the camera and write it down.
* Configuration in Home Assistant:
Add LocalTuya integration and select "Manual Configuration".
* Enter the camera's IP address, Device ID, and Local Key in sequence.
* Important! When configuring the entity type, because LocalTuya doesn't natively support camera video streams, we only configure the PTZ control-related entities in this step. This way, you can control the camera's rotation in HA.
* Special Note: Separate Video Stream and Control: Even if local control is achieved through Solution 2, the video stream usually still needs to be accessed via ONVIF/RTSP as in Solution 1.
* A static IP address is necessary: To ensure the configuration remains effective, it's best to assign a static internal IP address to the camera in the router settings.

Try Solution 1 first; most cameras supporting ONVIF will succeed. If you can't find the ONVIF switch or the RTSP address is incorrect, these are indeed the two most common problems encountered when connecting a Tuya camera. Don't worry, we'll troubleshoot and resolve them step by step. This usually means your camera model may not support ONVIF, or its RTSP address format is unusual.

Step 1: In-depth troubleshooting to confirm if the camera supports local RTSP

First, we need to confirm whether your camera supports local RTSP streaming. Tuya's solutions have two possibilities:

**Supports "Local RTSP":** Some newer or specific Tuya camera models have a built-in RTSP switch in the app. When turned on, the app will directly generate a complete RTSP address with a temporary password for your use.

**Supports "Cloud RTSP Only":** This is the default for most Tuya cameras. It does support RTSP, but the stream can only be obtained through Tuya's cloud forwarding, not directly from the camera. In this case, you won't find the switch in the app. How to differentiate?

In the Tuya Smart App, carefully look for switches like "Local RTSP," "ONVIF," or "LAN communication protocol" in the camera settings. If you find them, congratulations, it's the first scenario.

If you can't find them anywhere, your camera likely only supports the second mode, "Cloud RTSP." In this mode, the RTSP address needs to be dynamically generated via the Tuya developer platform's API and has an expiration time; it cannot be directly used for long-term Home Assistant configuration.

Step Two: Try solutions for different scenarios

Based on the findings in the previous step, choose the corresponding method:

Scenario A: RTSP switch found in the App

This is the simplest. After turning on the switch, the App will usually directly display an RTSP address or ask you to set an RTSP password.

If the full address is displayed: simply copy that address to the "General Camera" integration in Home Assistant. The address format might be as mentioned in the forum, simply rtsp://IP:8554/, or it might be like the Aqara camera, with a long token, such as rtsp://[IP]:554/live/ch00_1?token=[AUTH_TOKEN].

If you only need to set a username and password: the RTSP address format will likely be rtsp://[username]:[password]@[camera IP]:[port]/[path]. You'll need to combine them yourself. Common paths include /live/0, /main, /h264, etc. The port is usually 554 or 8554.

Scenario B: The app has no RTSP switch at all.

This is the most likely scenario. Since a direct connection is impossible, let's try a different approach, using a powerful Home Assistant plugin as a workaround.

Core solution: Use the tuya-connector plugin.
This plugin is specifically designed to solve this type of problem. It runs within Home Assistant and mimics the behavior of the official app, retrieving real-time video streams from the cloud using your Tuya account and playing them locally.

The specific steps are as follows:
* **Install Plugin:**
**Ensure you have HACS (Home Assistant Community Store) installed.**
**Search for "tuya-connector" on the "Integrations" page of HACS, download and install it.**
**After installation, restart Home Assistant.**
* **Configure Plugin:**
**On the "Device & Services" page of Home Assistant, click "+ Add Integration".**
**Search for and select "tuya-connector".**
**It will ask you to enter your Tuya IoT platform Access ID and Access Secret.** You need to create a cloud development project on the Tuya IoT platform to obtain these; the steps are the same as when you obtained your Local Key.**

After successful configuration, the plugin will automatically discover all camera devices under your account.

**Add to Dashboard:**
**After successfully adding the plugin, it will create an entity for your camera.**

In dashboard editing mode, add an "Image Entity" card, select this newly generated camera entity, and you will see the live feed on the interface.** The advantage of this solution is that you don't need to worry about whether the camera supports ONVIF or guess the RTSP address, as it completely reuses Tuya's official video transmission protocol.

If you encounter difficulties installing the tuya-connector plugin, or if the camera is added successfully but there is no video feed, this is usually due to some minor configuration or network issues.

I. Encountering difficulties during plugin installation

If you cannot find tuya-connector in HACS, or if you encounter authentication failure during configuration, please follow these steps to troubleshoot:

 Frequently Asked Questions Possible reasons Solution
Not found in HACS
  1. Plugin not updated to the latest version
  2. Inaccurate search keywords
  1. Click the "Reload" button in the upper right corner of the HACS page to update the repository list.
  2. Try searching for the full name tuya-connector or tuya.
Authentication failed during configuration.
  1. Access ID/Secret error on Tuya IoT platform
  2. Cloud project not correctly associated with device
  1. Log back into the Tuya IoT platform and check if the Access ID/Secret in your project is correct.
  2. Confirm that you can see your camera device on the "Device" page. If not, you need to "Associate Device".
Configuration successful but no devices discovered The cloud project is not linked to the correct App account. In the Tuya IoT platform project, go to "Device" → "Connect Devices", select "Connect More App Accounts", and use your Tuya Smart App to scan the QR code to complete the binding.

II. Camera Added Successfully, But No Video Stream

This is the most common problem. Although the plugin detects the camera, the video stream cannot be played correctly. We can troubleshoot from the following directions:

1. Network Environment Check (Most Common Cause)
The Tuya camera's P2P video transmission has certain network requirements, especially router settings.

Wi-Fi Band: Ensure the camera is connected to a 2.4GHz Wi-Fi network. Some cameras do not fully support the 5GHz band, which may cause P2P connection failure.

Router Encryption Mode: In the router settings, set the wireless encryption mode to WPA/WPA2 mixed mode, avoiding the use of the newer WPA3 mode.

Bandwidth Test: At the camera's location, connect your phone to the same Wi-Fi network and test the speed, ensuring that the upload and download speeds are at least 2MB/s (approximately 16Mbps). A camera with all functions enabled requires approximately 8Mbps of upload bandwidth.

Simple Troubleshooting: Try turning off Wi-Fi and viewing the camera feed using your phone's 4G/5G data (via the Tuya app). 1. If streaming works under mobile data but not under Wi-Fi, it's almost certainly a router settings issue.

2. P2P Channel Connection Issues

The tuya-connector plugin essentially uses Tuya's P2P technology to establish a local connection. If the connection fails, the video won't display.

Refer to the official development documentation: According to Tuya's official startPreview call instructions, possible reasons for the video not displaying include:

P2P Channel Not Ready: The plugin may need a callback after the camera connection is successful before it can successfully capture the stream. Try restarting Home Assistant and the camera to re-establish the connection.

p2pType Incompatibility: This is a deeper issue. If the plugin's debugging information shows p2pType as 1, it means the camera is using an older P2P protocol, which may require the manufacturer to update the camera firmware for compatibility. In this case, try contacting the camera manufacturer for a firmware update.

3. Camera Status Check

Firmware Version: Log in to the Tuya Smart App and check if the camera firmware is the latest version. If not, it is recommended to upgrade to the latest version.

Restart Device: Try powering off and restarting the camera. If there is still no video feed after restarting, and no video stream data is visible in the plugin logs, a hardware issue (such as a faulty camera module) may need to be considered.

III. Troubleshooting Suggestions
If the above methods have been tried and there is still no video feed, you can try the following:

Check the Home Assistant logs: Go to "Settings" → "System" → "Logs," and search for error messages related to "tuya-connector" or "camera." This information is very helpful in diagnosing the problem.

Try other cameras: If you have other doodle cameras, try them to see if they can stream normally to determine whether the problem is with a single device or the overall configuration.

Back to blog

Leave a comment