A powerful CLI tool to connect Tuya Smart Cameras to RTSP clients through reverse-engineered Tuya browser client APIs. Stream your Tuya cameras directly to any RTSP-compatible media player or home automation system.
- π Dual Authentication: QR code scanning OR email/password login
- π Multi-Region Support: Support for all Tuya regions (EU, US, China, India)
- π₯ Multi-User Management: Handle multiple Tuya Smart accounts simultaneously
- π‘ Session Persistence: Automatic session management with validation
- π₯ Camera Discovery: Automatic detection of all cameras from authenticated accounts
- π¬ RTSP Server: WebRTC-to-RTSP bridge for universal compatibility
- π Real-time Streaming: Direct camera access with minimal latency
- π Multi-Client Support: Multiple RTSP clients per camera stream
- π― H265/HEVC Ready: Advanced codec support for optimal performance
- π€ Two-Way Audio: Bidirectional audio for compatible cameras
git clone <repository-url>
cd tuya-ipc-terminal
chmod +x build.sh
./build.sh
# 1. Add your Tuya account (interactive)
./tuya-ipc-terminal auth add eu-central user@example.com
# 2. Discover your cameras
./tuya-ipc-terminal cameras refresh
# 3. Start streaming
./tuya-ipc-terminal rtsp start --port 8554
# 4. Watch your cameras
ffplay rtsp://localhost:8554/MyCamera
π― QR Code
./tuya-ipc-terminal auth add eu-central user@example.com
# Scan QR code with Tuya Smart/Smart Life app
π Email/Password
./tuya-ipc-terminal auth add eu-central user@example.com --password
# Enter password and select country code interactively
# List all authenticated users
./tuya-ipc-terminal auth list
# Remove user authentication
./tuya-ipc-terminal auth remove eu-central user@example.com
# Refresh expired session
./tuya-ipc-terminal auth refresh eu-central user@example.com
# Test session validity
./tuya-ipc-terminal auth test eu-central user@example.com
# Show all available regions
./tuya-ipc-terminal auth show-regions
# Show country codes for password authentication
./tuya-ipc-terminal auth show-country-codes
./tuya-ipc-terminal auth show-country-codes --search germany
Available Regions:
Region | Endpoint | Description |
---|---|---|
eu-central |
protect-eu.ismartlife.me | Central Europe |
eu-east |
protect-we.ismartlife.me | East Europe |
us-west |
protect-us.ismartlife.me | West America |
us-east |
protect-ue.ismartlife.me | East America |
china |
protect.ismartlife.me | China |
india |
protect-in.ismartlife.me | India |
# List all discovered cameras
./tuya-ipc-terminal cameras list
# List cameras for specific user
./tuya-ipc-terminal cameras list --user eu-central_user_at_example_com
# Refresh camera discovery
./tuya-ipc-terminal cameras refresh
# Get detailed camera information
./tuya-ipc-terminal cameras info [camera-id-or-name]
# Start RTSP server
./tuya-ipc-terminal rtsp start --port 8554
# Start as background daemon
./tuya-ipc-terminal rtsp start --port 8554 --daemon
# Stop RTSP server
./tuya-ipc-terminal rtsp stop
# Check server status
./tuya-ipc-terminal rtsp status
# List all available camera endpoints
./tuya-ipc-terminal rtsp list-endpoints
Camera streams are available at:
rtsp://localhost:[port]/[camera-name]
rtsp://localhost:[port]/[camera-name]/sd # Sub-stream (lower quality)
Home Assistant
camera:
- platform: generic
stream_source: rtsp://localhost:8554/LivingRoomCamera
name: "Living Room Camera"
- platform: generic
stream_source: rtsp://localhost:8554/FrontDoor
name: "Front Door Camera"
Go2RTC Integration
streams:
living_room:
- rtsp://localhost:8554/LivingRoomCamera
front_door:
- rtsp://localhost:8554/FrontDoor
Create systemd service:
sudo tee /etc/systemd/system/tuya-rtsp.service > /dev/null <<EOF
[Unit]
Description=Tuya IPC Terminal RTSP Server
After=network.target
[Service]
Type=simple
User=$USER
WorkingDirectory=$PWD
ExecStart=$PWD/tuya-ipc-terminal rtsp start --port 8554
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable tuya-rtsp
sudo systemctl start tuya-rtsp
# Different ports for different purposes
./tuya-ipc-terminal rtsp start --port 8554 --daemon # Main cameras
./tuya-ipc-terminal rtsp start --port 8555 --daemon # Backup/secondary
# Add accounts from different regions
./tuya-ipc-terminal auth add eu-central home@example.com # European account
./tuya-ipc-terminal auth add --password us-west work@company.com # US business account
./tuya-ipc-terminal auth add china personal@example.cn # Chinese account
# Discover all cameras
./tuya-ipc-terminal cameras refresh
# List everything
./tuya-ipc-terminal auth list
./tuya-ipc-terminal cameras list
- Authentication β Tuya Cloud API
- Discovery β MQTT + Tuya API
- WebRTC Connection β Direct camera stream
- RTP Processing β Video/audio packet handling
- RTSP Server β Standard protocol output
.tuya-data/
βββ user_eu-central_user_at_example_com.json # User sessions
βββ user_us-west_business_at_company_com.json # Multiple accounts
βββ cameras.json # Camera registry
Feature | Status | Notes |
---|---|---|
H.264 Video | β | Universal support |
H.265/HEVC | β | Better compression |
PCMU Audio | β | Standard quality |
PCMA Audio | β | Alternative codec |
HD Streams | β | Main camera stream |
SD Streams | β | Sub-stream, lower bandwidth |
Multi-client | β | Multiple viewers per camera |
Two-way Audio | β | Camera dependent |
Category | Description | Compatibility |
---|---|---|
sp |
Smart cameras | β Full support |
dghsxj |
Additional camera type | β Full support |
Others | Generic Tuya cameras |
Problem: Login fails
# 1. Check session status
./tuya-ipc-terminal auth test eu-central user@example.com
# 2. Try refreshing
./tuya-ipc-terminal auth refresh eu-central user@example.com
# 3. Re-authenticate if needed
./tuya-ipc-terminal auth remove eu-central user@example.com
./tuya-ipc-terminal auth add eu-central user@example.com
Problem: Country code not found (password login)
# Search for your country
./tuya-ipc-terminal auth show-country-codes --search germany
./tuya-ipc-terminal auth show-country-codes --search "united states"
Problem: No cameras found
# 1. Verify authentication
./tuya-ipc-terminal auth list
# 2. Force refresh
./tuya-ipc-terminal cameras refresh
# 3. Check if cameras are online in Tuya Smart app
./tuya-ipc-terminal cameras list --verbose
Problem: Can't connect to stream
# 1. Check server status
./tuya-ipc-terminal rtsp status
# 2. List available streams
./tuya-ipc-terminal rtsp list-endpoints
# 3. Test with simple player
ffplay rtsp://localhost:8554/CameraName
Problem: Poor stream quality
# Try sub-stream for lower bandwidth
ffplay rtsp://localhost:8554/CameraName/sd
# Check camera capabilities
./tuya-ipc-terminal cameras info "Camera Name"
git clone <repository-url>
cd tuya-ipc-terminal
go mod download
go run main.go --help
- π Requires active internet connection to Tuya servers
- βοΈ Dependent on Tuya Cloud availability
- π± QR authentication requires mobile app
- π§ Some advanced camera features may not be supported
- π Sessions stored locally in JSON files
- π‘οΈ No additional encryption beyond Tuya's implementation
- π₯ Firewall configuration recommended for external access
- π Consider network security for RTSP streams
MIT License - See LICENSE for details.
This tool is created through reverse engineering of Tuya's web client APIs. Use responsibly and ensure compliance with:
- Tuya's Terms of Service
- Local privacy laws and regulations
- Camera usage regulations in your jurisdiction
The authors are not responsible for any issues arising from the use of this software.
Having issues? Here's how to get help:
- π Check this README for common solutions
- π Search existing GitHub Issues
- π¬ Create a new issue with:
- Your operating system
- Go version (
go version
) - Error messages
- Steps to reproduce
β If this project helps you, please consider giving it a star on GitHub!