tuya2mqtt
Tuya Devices to MQTT Bridge
2.8K
tuya2mqtt is a Python script that connects Tuya smart devices to an MQTT broker. It acts as a backend service that maintains a 24-hour TCP connection with registered Tuya devices. This allows it to instantly publish state changes to MQTT and enable device control via MQTT commands.
The simplest way to run tuya2mqtt. By default, it connects to a broker at localhost:1883 and starts the Web UI on port 8373.
-d, --restart=unless-stopped: to run the bridge as a background service.
--network=host: to communicate with Tuya devices.
docker run -d \
--name tuya2mqtt \
--restart=unless-stopped \
--network=host \
3735943886/tuya2mqtt:stable
http://<ip>:8373Use this method if the MQTT broker requires authentication or is hosted on a different IP address.
docker run -d \
--name tuya2mqtt \
--restart=unless-stopped \
--network=host \
-e BROKER_HOSTNAME="192.168.0.100" \
-e BROKER_PORT=1883 \
-e BROKER_USERNAME="username" \
-e BROKER_PASSWORD="password" \
3735943886/tuya2mqtt:stable
To save system resources, the backend bridge service can run independently by disabling the Web UI. Set UI_PORT to 0 to prevent the UI from starting automatically.
docker run -d \
--name tuya2mqtt \
--restart=unless-stopped \
--network=host \
-e UI_PORT=0 \
3735943886/tuya2mqtt:stable
When running in Headless mode (UI_PORT=0), the Web UI can still be launched temporarily for device addition or configuration.
Run the following command:
docker exec -it tuya2mqtt python3 tuya2mqtt_ui.py --ui-port 8373
Ctrl+C to stop the UI process. The bridge service will continue to run in the background.| Variable | Description | Default |
|---|---|---|
BROKER_HOSTNAME | MQTT Broker IP or Hostname | localhost |
BROKER_PORT | MQTT Broker Port | 1883 |
BROKER_USERNAME | MQTT Broker Username | |
BROKER_PASSWORD | MQTT Broker Password | |
UI_PORT | Web UI Port (Set to 0 to disable auto-start) | 8373 |
For detailed usage instructions, please refer to the main repository.
GitHub Repository: https://github.com/3735943886/tuya2mqtt
Content type
Image
Digest
sha256:58d0dd8d2…
Size
111.3 MB
Last updated
7 months ago
docker pull 3735943886/tuya2mqtt