A Python integration package that enables streaming Tuya camera feeds into Home Assistant and Frigate NVR for advanced video monitoring, recording, and object detection.
This project provides seamless integration between Tuya smart cameras and popular home automation platforms:
- Home Assistant: Display live camera feeds in your HA dashboard
- Frigate NVR: Advanced video processing with object detection and recording
- RTSP Support: Convert Tuya proprietary streams to standard RTSP
- Configuration Management: Automated setup for both platforms
- ✅ Connect to multiple Tuya cameras simultaneously
- ✅ Stream live video feeds to Home Assistant
- ✅ Generate Frigate configuration automatically
- ✅ Support for motion detection and recording
- ✅ Object detection integration (person, car, bicycle)
- ✅ Configurable retention policies
- ✅ MQTT integration for real-time alerts
- Python 3.8+
- Home Assistant (optional)
- Frigate NVR (optional)
- MQTT broker (for Frigate integration)
- Tuya camera devices with local network access
-
Clone the repository:
git clone <repository-url> cd tuya-camera-ha-frigate
-
Install dependencies:
pip install -r requirements.txt
-
Install the package:
pip install -e .
Create a configuration file for your Tuya cameras:
from tuya_camera_integration import CameraConfig
# Configure your cameras
camera_configs = [
CameraConfig(
device_id="your-device-id",
device_key="your-device-key",
device_ip="192.168.1.100",
device_name="Front Door Camera"
),
CameraConfig(
device_id="another-device-id",
device_key="another-device-key",
device_ip="192.168.1.101",
device_name="Backyard Camera"
)
]from tuya_camera_integration import HomeAssistantIntegration
# Initialize HA integration
ha_integration = HomeAssistantIntegration()
# Add cameras
for config in camera_configs:
ha_integration.add_camera(config)
# Setup cameras
await ha_integration.setup_cameras()
# Get camera entities for configuration.yaml
entities = ha_integration.get_camera_entities()from tuya_camera_integration import FrigateIntegration
# Initialize Frigate integration
frigate = FrigateIntegration("/path/to/frigate.yml")
# Add cameras
for config in camera_configs:
frigate.add_camera(config)
# Generate and save Frigate configuration
frigate.save_frigate_config()tuya-camera-ha-frigate/
├── src/
│ └── tuya_camera_integration/
│ ├── __init__.py
│ ├── camera_client.py # Core Tuya camera client
│ ├── ha_integration.py # Home Assistant integration
│ └── frigate_integration.py # Frigate NVR integration
├── tests/ # Unit tests
├── docs/ # Documentation
├── config/ # Configuration templates
├── examples/ # Usage examples
├── requirements.txt # Python dependencies
├── pyproject.toml # Package configuration
└── README.md # This file
pytest tests/black src/ tests/
isort src/ tests/flake8 src/ tests/
mypy src/See the examples/ directory for complete usage examples:
basic_setup.py- Basic camera setupha_integration_example.py- Home Assistant integrationfrigate_setup_example.py- Frigate configurationmulti_camera_setup.py- Multiple camera management
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Run the test suite
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Issues: Report bugs on GitHub Issues
- Discussions: Join GitHub Discussions for questions
- Documentation: Check the
docs/directory
- Complete Tuya camera protocol implementation
- Add support for PTZ camera controls
- Implement camera settings management
- Add audio stream support
- Create Home Assistant custom component
- Add Docker support
- Implement webhook notifications
- Add camera health monitoring
This project is not officially associated with Tuya Smart. Use at your own risk and ensure compliance with your local laws and Tuya's terms of service.