Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .env-template
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Attention: "host" means your computer where you are running docker on

WLAN=wlan0 #must match the name of your wlan-interface on your host, you may find it with ifconfig
AP=vtrust-flash #the name of the created AP, can be anything you want
GATEWAY=10.42.42.1 #gateway address, leave it here
LOCALBACKUPDIR=./data/backups #location on your host where you want to store backuos of the old firmware & logs
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,9 @@ node_modules/
device-info.txt
scripts/smartconfig/package-lock.json

# firmware backups directory
# firmware backups directory and data-file
backups/
data

# flag files
eula_accepted
Expand Down
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
FROM phusion/baseimage:master
FROM alpine:3.13

RUN apt-get update && apt-get install -y sudo iproute2 iputils-ping
RUN apk add --update bash git iw dnsmasq hostapd screen curl py3-pip py3-wheel python3-dev mosquitto haveged net-tools openssl openssl-dev gcc musl-dev linux-headers sudo coreutils grep iproute2

RUN echo '* libraries/restart-without-asking boolean true' | sudo debconf-set-selections
RUN python3 -m pip install --upgrade paho-mqtt tornado git+https://github.com/drbild/sslpsk.git pycryptodomex

COPY docker/bin /usr/bin/

COPY . /usr/bin/tuya-convert

RUN cd /usr/bin/tuya-convert && ./install_prereq.sh
WORKDIR "/usr/bin/tuya-convert"

RUN mkdir -p /etc/service/tuya && cd /etc/service/tuya && ln -s /usr/bin/config.sh run
ENTRYPOINT ["tuya-start"]
34 changes: 16 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,26 +83,24 @@ Requirements:
* docker is installed
* docker-compose is installed

Create docker image:
Preparations:
* git clone https://github.com/ct-Open-Source/tuya-convert
* cd tuya-convert
* docker build -t tuya:latest .

Setup docker-compose:
* copy docker/docker-compose.sample.yml to a new folder you created, the file should be named docker-compose.yml
* you may adjust this docker-compose.yml, if necessary:
* environment-variables may be different, for example network-adapter may be different from wlan0
* adjust the volume folder, where you want your backups stored

Run the image:
* go into the folder you copied docker-compose.yml
* docker-compose up -d
* docker-compose exec tuya start
* tuya-convert now starts within docker

Stop the image:
* docker-compose exec tuya stop
* docker-compose down
* if you have already cloned this repo just cd into the directory and execute `git pull`
* cp .env-template .env
* adjust the created .env-file, it contains usage information as comments

Building and running your container:
* `docker-compose build && docker-compose run --rm tuya`
* This directly starts into tuya. If you press ctrl+break or exit tuya after flashing, your container is closed and deleted

Troubleshooting:
* Q: Where are my logs after flashing? A: The folder can be adjusted in .env with LOCALBACKUPDIR, the path here may be relative or absolute
* Q: I don't want that my container is deleted after running tuya, I need this for troubleshooting! How do I accomplish this? A: Just remove --rm from `docker-compose run --rm tuya`
* Q: I want to start the container, but instead of starting tuya immediately I want to get into bash. Is this possible? A: Yes just start the container with `docker-compose run --entrypoint bash tuya`.
* Q: I want to rebuild my docker-image, even if there are no changes. Is this possible? A: Just start `docker-compose build --no-cache` instead of `docker-compose build`! Don't do this all the time, this is a time consuming process ...
* Q: I can't connect to my USB, PCI, ... network card. How do I get this working? A: You may have an error in your .env-File. The WLAN-variable should reflect the name of your network interface on your host. Execute ifconfig and look through your interfaces.
* Q: I can't get an IP-address and or connection on my phone, what's the problem? A: You may look into smarthack-wifi.log (location is set in .env with LOCALBACKUPDIR) or possible stop your firewall (e.g. NixOS seems to have a problem here). It may be a problem with a wrongly set network interface (see previous question)

## CONTRIBUTING

Expand Down
12 changes: 12 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '3'
services:
tuya:
build: .
privileged: true
network_mode: "host"
environment:
WLAN: ${WLAN}
AP: ${AP}
GATEWAY: ${GATEWAY}
volumes:
- $LOCALBACKUPDIR:/usr/bin/tuya-convert/backups
File renamed without changes.
2 changes: 0 additions & 2 deletions docker/bin/stop

This file was deleted.

2 changes: 1 addition & 1 deletion docker/bin/start → docker/bin/tuya-start
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash
cd /usr/bin/tuya-convert
config-tuya.sh
./start_flash.sh
12 changes: 0 additions & 12 deletions docker/docker-compose.sample.yml

This file was deleted.

2 changes: 1 addition & 1 deletion install_prereq.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

sudo apt-get update
sudo apt-get install -y git iw dnsmasq rfkill hostapd screen curl build-essential python3-pip python3-setuptools python3-wheel python3-dev mosquitto haveged net-tools libssl-dev
sudo apt-get install -y git iw dnsmasq rfkill hostapd screen curl build-essential python3-pip python3-setuptools python3-wheel python3-dev mosquitto haveged net-tools libssl-dev iproute2 iputils-ping

sudo -H python3 -m pip install --upgrade paho-mqtt tornado git+https://github.com/drbild/sslpsk.git pycryptodomex

Expand Down