1
0
mirror of https://github.com/Sthopeless/74757961.git synced 2025-04-03 23:13:39 +02:00
This commit is contained in:
Sthope 2021-07-21 22:33:27 +02:00
parent f8cc6beb1e
commit 44910447a8
4 changed files with 39 additions and 22 deletions

View File

@ -5,21 +5,20 @@ LABEL Maintainer="Sthope" \
version="0.1"
RUN apk --no-cache add \
bash \
nano \
mosquitto \
mosquitto-clients \
python3-dev \
build-base \
py3-pip \
patch
py3-pip
RUN pip3 install \
tuya-iot-py-sdk \
paho-mqtt \
pycryptodome
RUN mkdir -p /home/tuyactl
RUN mkdir -p /home/tuya_doorlock
ADD tuyactl/ /home/tuyactl/
ADD tuya_doorlock/ /home/tuya_doorlock/
ENTRYPOINT ["tail", "-f", "/dev/null"]

View File

@ -1,5 +1,5 @@
# Tuya Zigbee Doorlock using API
Install Python and the [pip requeriments are here](https://github.com/Sthopeless/74757961/blob/main/requirements.txt)
@ -14,7 +14,6 @@ PASSWORD | Tuya/Smartlife MobileAPP Password
COUNTRY_CODE | Tuya/Smartlife MobileAPP Country Code
SCHEMA | Which MobileAPP are you using Tuya or Smartlife
ASSET_ID | shouldn't be necessary
DEVICE_ID | shouldn't be necessary
ENDPOINT | Tuya url of your region (default Europe)
TUYA_UID | Tuya user UID
ZIGBEE_LOCK | Tuya Zigbee Doorlock UUID
@ -33,3 +32,25 @@ MQTT_PASSWORD | MQTT Password
| India | https://openapi.tuyain.com |
| Eastern America | https://openapi-ueaz.tuyaus.com |
| Western Europe | https://openapi-weaz.tuyaeu.com |
## Using Docker
1. Run the docker container with:
```
docker run -d --name tuya_doorlock ghcr.io/sthopeless/tuya_doorlock:latest
```
2. Exec into the container:
```
docker exec -it tuya_doorlock bash
```
3. Edit the env.py file with your details
```
nano /home/tuyactl/env.py
```
4. Run python file and test
```
python3 /home/tuyactl/Zigbee_Doorlock.py
```

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python3
# online
## iot.tuya.cloud
ACCESS_ID = ""
ACCESS_KEY = ""
## Mobile APP
@ -9,41 +9,38 @@ PASSWORD = ""
COUNTRY_CODE = "31"
SCHEMA = "smartlife"
ASSET_ID = ""
DEVICE_ID = ""
ENDPOINT = "https://openapi.tuyaeu.com"
TUYA_UID = ""
### Devices UUID
ZIGBEE_LOCK = ""
WIFI_LOCK = ""
BECK_LOCK = ""
WIFI_SCALE = ""
LOCKPINCODE = "123456"
### MQTT Broker
MQTT_BROKER = ''
MQTT_PORT = 1883
MQTT_CLIENT_ID = 'TuyaLock'
MQTT_USERNAME = ''
MQTT_PASSWORD = ''
MQTT_TOPIC = 'TuyaLock'
########################################
############# DON'T CHANGE #############
########################################
expired_token = "token is expired"
MQTT_CLIENT_ID = 'TuyaLock'
MQTT_TOPIC = 'TuyaLock'
MQTT_ZIGBEELOCK_TOPIC = "Doorlock"
MQTT_WIFI_SCALE_TOPIC = "WiFi_Scale"
MQTT_TOPIC_CMD = "cmd"
MQTT_TOPIC_LWT = "lwt"
MQTT_TOPIC_STATUS = "status"
### HA Autodiscovery MQTT-Topics
HA_DISCOVERY = "false"
HA_DISCOVERY_TOPIC = ""
HA_DISCOVERY_MSG = ''
### WiFi Scale Users_ID
SCALE_USER_ID = ''
expired_token = "token is expired"
DOORLOCK_TOPIC = MQTT_TOPIC + "/" + MQTT_ZIGBEELOCK_TOPIC
DOORLOCK_TOPIC_CMD = DOORLOCK_TOPIC + "/" + MQTT_TOPIC_CMD
DOORLOCK_TOPIC_STATUS = DOORLOCK_TOPIC + "/" + MQTT_TOPIC_STATUS