MicroPython RGBWW Smart Bulb code for MQTT
subDesTagesMitExtraKaese f26ac0d7ce added default values to config | 3 жил өмнө | |
---|---|---|
.vscode | 3 жил өмнө | |
W60X_MicroPython_1.10_B1.3_IMG | 3 жил өмнө | |
images | 3 жил өмнө | |
.gitignore | 3 жил өмнө | |
README.md | 3 жил өмнө | |
boot.py | 3 жил өмнө | |
config.py | 3 жил өмнө | |
dev-requirements.txt | 3 жил өмнө | |
leds.py | 3 жил өмнө | |
main.py | 3 жил өмнө | |
micropy.json | 3 жил өмнө | |
requirements.txt | 3 жил өмнө | |
umqttsimple.py | 3 жил өмнө |
tested on a Tuya WinnerMicro W600-B800 Smart Bulb
erase secboot and old image
python3 -m w600tool -e -p /dev/ttyUSB0
connect PA0 (BOOT) to GND and reset chip by pulling RST low
flash MicroPython firmware
python3 -m w600tool -p /dev/ttyUSB0 -u W60X_MicroPython_1.10_B1.3_IMG/wm_w600.fls
Opening device: /dev/ttyUSB0
Erasing secboot
Switched speed to 2000000
Uploading W60X_MicroPython_1.10_B1.3_IMG/wm_w600.fls
0% [##############################] 100% | ETA: 00:00:00
Total time elapsed: 00:00:15
Reset board to run user code...
disconnect PA0 (BOOT) and reset the device
test Python shell with screen /dev/ttyUSB0 115200
(press CTRL-A
+ k
to quit)
__ __
\ \ /\ / /
\ \ / \ / /
\ \/ /\ \/ /
\ / \ /
/ /\ / /\
/ /\ \/ /\ \
/ / \ / \ \
/_/ \/ \_\
WinnerMicro W600
MicroPython v1.10-284-g2eee4e2-dirty on 2019-11-08; WinnerMicro module with W600
Type "help()" for more information.
>>>
In the python shell, connect to wifi and start FTP server:
>>> import easyw600
>>> easyw600.scan()
>>> easyw600.connect("<SSID>", "<PASSWORD>")
conneting...
connected, ip is 192.168.1.234
>>> easyw600.ftpserver()
ftpserver is running.
ftp server port is 21, username is root, password is root
Copy python files to the board. For example via ftp://root:root@192.168.1.234
Reset the uC
Create wifi_config.py
with following content:
WIFI_SSID="<SSID>"
WIFI_PASSWD="<PASSWORD>"
This can also be done via the Python shell:
>>> f = open("wifi_config.py")
>>> f.write('WIFI_SSID="<SSID>"\n')
>>> f.write('WIFI_PASS="<PASSWORD>"\n')
>>> f.close()
Reboot the M600 and connect to bulb via FTP without username and password