GithubHelp home page GithubHelp logo

tuyota's People

Contributors

synackfin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tuyota's Issues

Stuck at FinalStage Detected / Connected to FinalStage

I'm stuck at the FinalStage and I can see the Wifi network FinalStage on my phone but no joy. I have tried rebooting the Pi and the device. I've started the script over with the -b 2 option and still no joy. Any help appreciated. BTW the is an eMylo switch https://www.amazon.com/Switches-Wireless-Control-Automation-Compatible/dp/B07FPCJ1L4/ref=pd_day0_hl_60_1?_encoding=UTF8&pd_rd_i=B07FPCJ1L4&pd_rd_r=9b0356b0-1b58-11e9-8ebd-0d418ae6b851&pd_rd_w=njOJl&pd_rd_wg=j6KRn&pf_rd_p=ad07871c-e646-4161-82c7-5ed0d4c85b07&pf_rd_r=GFDKZ95B17Z0NGY7B9S0&psc=1&refRID=GFDKZ95B17Z0NGY7B9S0

Working with Lonsonho

Hey, i wanted to update the wiki, but get an error i think because im new to GitHub in that way that i registered myself only to add this comment.
Got your TuyOTA working on the Lonsonho Smart Plug (https://www.aliexpress.com/item/Lonsonho-Smart-Plug-Wifi-Smart-Socket-Power-Monitor-EU-France-US-AU-UK-Korea-Plug-Outlet/32901221191.html?spm=a2g0s.9042311.0.0.27424c4ddsotkv)

works like charm (switch and power monitoring works with the Tasmota BlitzWolf build) only inbuilt rgb led won't work=)

Problem Flashing Gosund WP3

Set up Raspberry Pi 3B per the Walkthrough. The output corresponded word for word.

I plugged in the plug and set it up with the Smart Life app and then ran the script.

~/TuyOTA $ sudo ./tuyota.pl -ip myIP -s mySSID -p myPassword
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Using WiFi device wlan0 for Access Point
Starting Access Point with SSID ZAGDU-789
Giving Access Point IP address 10.44.57.1, pid is 1895
Redirecting device 192.168.1.36 to use Access Point ZAGDU-789
DHCP Request <remoteTerminalPCMAC> 10.44.57.90
DHCP Discover <routerMAC>
Bad arg length for Socket::pack_sockaddr_in, length is 0, should be 4 at /usr/lib/arm-linux-gnueabihf/perl/5.24/Socket.pm line 157, <$fh> line 1.
Exiting....
Shutting down...
`

***** FinalStage Detected ****** Stuck

Device : SHP-6
Rasp PI3

Stuck on Flinalstage detected / Connecting to Finalstage
***** Receiving FinalStage Request ****
REQ: Client closed connection while receiving request:
etc etc etc ...

I can ping the client

64 bytes from 192.168.4.1: icmp_seq=201 ttl=128 time=3.99 ms
64 bytes from 192.168.4.1: icmp_seq=202 ttl=128 time=21.3 ms
64 bytes from 192.168.4.1: icmp_seq=203 ttl=128 time=86.2 ms

But after many many tries it will not send sonoff.bin
Anything else i can try ?

Still need wired and wireless connected?

Just coming back around after being away from this for a while and the other thread is a bit crazy but does this still have the same requirements as the older script? wired/wireless connection etc?

Cheers.

Lonsonho Switch with RGB Led Ring, rgb led doesnt work

Hey there,
Like i posted a time ago, i got my lonsonho switch working, but the switch has an integrated rgb led light ring which doesnt work - i set the device to blitzwolf sp6 whom also had led but it doesnt show a led - curriosious (dont know if that word exist) but id i toggle the switch the led goes from violet to red and vis versa.

Do anyone has an idea how to fix my light?

Greetibgs to all of you - and really great work with that script 🤗

Gosund Flashing issue (Stuck at dev.timer.count)

This is my second gosund outlet. First flashed fine, and this one gets stuck at dev.timer.count stage.

Hardware: PI (v1.2) with wifi adapter

Device firmware: 1.0.0

What have I tried:

  • Old tuya2sonoff.pl scrip - same issue
  • increasing timer by using -t 300 (used different amount without success)
  • tuya app and smartlife app
  • resetting the device to defaults in the app
  • unplug/plug prior to running firmware
  • Changed firmware version in the script to 9.9.0

Other observations:

  • There are couple of instances of "Accepting MQTT connection, forwarding to not set". Could that be the issue?

Log:

pi@raspberrypi:~/TuyOTA $ sudo ./tuyota.pl -ip 192.168.1.8 -t 120
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
RTNETLINK answers: Cannot assign requested address
Done
Using WiFi device wlan0 for Access Point
Starting Access Point with SSID ZAGDU-789
Giving Access Point IP address 10.44.57.1, pid is 1063
Redirecting device 192.168.1.8 to use Access Point ZAGDU-789
Unable to open socket to 192.168.1.8: No route to host
The device might be at the next stage, ignoring for now
DHCP Discover b4:e6:2d:0c:be:c3 10.44.57.155
DHCP Discover b4:e6:2d:0c:be:c3 10.44.57.155
DHCP Request b4:e6:2d:0c:be:c3 10.44.57.155
Accepting MQTT connection, forwarding to
not set
**** New device detected. ID: 03200329b4e62d0cbec3 IP:10.44.57.155
**** New device looks to be part way through upgrading
**** Forcing it to retry the upgrade
Redirecting device 10.44.57.155 to use Access Point ZAGDU-789
**** Redirect appears successful
Accepting MQTT connection, forwarding to
not set
DHCP Discover b4:e6:2d:0c:be:c3 10.44.57.155
DHCP Discover b4:e6:2d:0c:be:c3 10.44.57.155
DHCP Request b4:e6:2d:0c:be:c3 10.44.57.155
Received DNS query for mq.gw.tuyaus.com.
Sending 10.44.57.1 as response
Accepting MQTT connection, forwarding to mq.gw.tuyaus.com.
Received DNS query for a.tuyaus.com.
Sending 10.44.57.1 as response
Receiving www request
URL: /gw.json?a=s.gw.update
Response: HTTP/1.1 200 OK
{"t":1547906672,"e":false,"success":true}
Receiving www request
URL: /gw.json?a=s.gw.dev.update
Response: HTTP/1.1 200 OK
{"t":1547906672,"e":false,"success":true}
Receiving www request
Fetching Request Content
URL: /gw.json?a=atop.online.debug.log
Response: HTTP/1.1 200 OK
{"result":true,"t":1547906674,"e":false,"success":true}
Receiving www request
Fetching Request Content
URL: /gw.json?a=s.gw.dev.timer.count
Response: HTTP/1.1 200 OK
{"result":{"devId":"03200329b4e62d0cbec3","count":0,"lastFetchTime":1533399266},"t":1547906686,"e":false,"success":true}
Shutting down...
Setting up IP Address 192.168.4.2 for Final Stages
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Setting up wifi scan
Setting up listener for FinalStage
Shutting down...
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Finished
Exiting....
Shutting down...

Method works for a Teckin SP23

Not an issue per se, just thought you might want to start to compile a list of devices and configs required to get them working.

Teckin SP23s bought from Amazon UK Jan 2019 flashed successfully and need the Sonoff BlitzWolf SHP2 configuration.

Might need voltage calibration as noted by some other users and myself.

This can be done so via:

  1. Prerequisites
    • Calibrated multimeter 😉
    • Optional calibrated power meter 😉
    • 60W light bulb
  2. Connect the Pow to the optional power meter.
  3. Connect the 60W light bulb
  4. Open a webbrowser to Pow showing the main page and another webbrowser showing the Console
  5. Turn power on and wait a few seconds for the pow to settle on a stable power reading
  6. Verify the power reading with the power meter or expected 60W and if needed change the power offset in W with command PowerSet 60.0.
  7. Verify the voltage reading with the multimeter and if needed change the voltage offset in V with command VoltageSet 235.5.
  8. Verify the current reading with the calculated value of P (step 6) / U (step 7)) and if needed change the current offset in mA with command CurrentSet 254.777.
    Example:
    P/U=I
    Volt/Watt=Ampere (A)
    A*1000=mA
    (60.0/235.5)*1000=254.777

"Globe" Branded Smart Bulb

Trying to get this bulb updated tonight with the latest version. I think it's the token expire that's the issue, but not sure on how to resolve that one. The script does make the bulb go into pairing mode it seems though.

pi@raspberrypi:~/TuyOTA $ sudo ./tuyota.pl
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
RTNETLINK answers: Cannot assign requested address
Done
Using WiFi device wlan0 for Access Point
Starting Access Point with SSID ZAGDU-789
Giving Access Point IP address 10.44.57.1, pid is 1598
Redirecting device 192.168.1.10 to use Access Point ZAGDU-789
Unable to open socket to 192.168.1.10: No route to host
The device might be at the next stage, ignoring for now
DHCP Discover 80:7d:3a:3a:ce:ba 10.44.57.230
DHCP Discover 80:7d:3a:3a:ce:ba 10.44.57.230
DHCP Request 80:7d:3a:3a:ce:ba 10.44.57.230
Received DNS query for a.gw.tuyaeu.com.
Sending 10.44.57.1 as response
Receiving www request
URL: /gw.json?a=s.gw.token.get
Response: HTTP/1.1 200 OK
{"t":1547951445,"e":false,"success":false,"errorCode":"SING_VALIDATE_FALED_TOKEN_EXPIRE","errorMsg":"非法请求"}
Shutting down...
Setting up IP Address 192.168.4.2 for Final Stages
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Setting up wifi scan
Setting up listener for FinalStage
Shutting down...
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Finished
Exiting....
Shutting down...

had final stage for a minute, now gone.

So the first of two Hyleton-311's went fine. Running tasmota nicely now. The second one no luck. I got to see a final stage AP, but a couple cycles of the script and power cycling the device and no luck. Now i lost the final stage ap, it isn't response to holding the button to factory reset, however, when i run the script, it does see a device request a dhcp. Nothing ever comes of it though. The script eventually goes to listen to final stage, and then closes when it gets no reply. toggling the power on the device gets it to send another dhcp request. No devices are ever listed as found by the script.

Thats really puzzling considering how cut and dry the first one went and it was successful.

Unable to create DHCP Listener socket!

Device is a Teckin SP22. I ran the script via SSH. Session hung, so I ran it again locally and receive the following error.

The 192.168.1.12 address is the address of the plug, and can be pinged.

pi@raspberrypi:~/TuyOTA $ sudo ./tuyota.pl -ip 192.168.1.12 -s my_ssid -p my_ssid_password
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Using WiFi device wlan0 for Access Point
Starting Access Point with SSID ZAGDU-789
Giving Access Point IP address 10.44.57.1, pid is 1395
Unable to create DHCP Listener socket! Address already in use at ./tuyota.pl line 188.
Exiting....
Shutting down...

Any advice how to get further?

Happy to provide any further details, thanks!

Teckin SP23 stuck at FinalStage

I'm stuck at the FinalStage trying to flash a Teckin SP23. I've actually tried two with the same result. Everything seems to run fine until the last part. I've run it over and over with -b 2. Sometimes it will find and connect to FinalStage but then nothing happens. If I increase the timeout it will detect and connect every minute or two but still nothing. I've tried keeping a ping to 192.168.48.1 running but there is never a reply.

Couldn't flash device

root@orangepiplus:~/TuyOTA# ./tuyota.pl -ip 192.168.2.82 -s myWiFi -p mypassword
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
RTNETLINK answers: Cannot assign requested address
Done
Using WiFi device wlan0 for Access Point
Starting Access Point with SSID ZAGDU-789
Giving Access Point IP address 10.44.57.1, pid is 13343
Redirecting device 192.168.2.82 to use Access Point ZAGDU-789
**** Redirect appears successful
Shutting down...
Setting up IP Address 192.168.4.2 for Final Stages
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address

The script freezes there for

I use orange pi Plus 2 with armbian ubuntu 18.04. I already kill wpa_supplicant process. I also make sure that I did't open tuya app on my mobile devices. Homeassistant instance was also stopped
192.168.2.82 is IP address when my 3 gangs wifi switch connects to myWiFi network.
the orange pi box is on the same network of 192.168.2.82. I couldn't find dhcpd on my OS. Is that maybe issue? I also have my DHCP service on my router on 192.168.2.x network. Do I need to disable it or something?
When the script froze and stopped at that. The led on my 3 gangs wifi switch indicated that it is working with static green led. Flashing green led is connecting/searching wifi. Gang is turned on: red led, gang is turned off: blue led. Since the device is at static green led, I need to hold the button for 20 seconds to reset it, I then can add it to tuya app.
Device info: https://www.aliexpress.com/item/Alexa-compatible-Tuya-smart-life-app-control-WiFi-light-switch-US-touch-and-remote-control-switches/32950455100.html?spm=a2g0s.8937460.0.0.5fd52e0ex3dPme
Thanks for help or let me know step to debug.

Error running the script

I was running the tuyamockcloud and was able to move over a device but then after a reboot I get this from the TuyOTA script.

Setting up IP Address 192.168.4.2 for Final Stages
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
RTNETLINK answers: Cannot assign requested address
Done
Setting up wifi scan
Setting up listener for FinalStage
Shutting down...
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Finished
Exiting....
Shutting down...

Elegiant Single Plug

I think I just bricked two of these.
https://www.amazon.com/gp/product/B07B9XCY5M/ref=ppx_yo_dt_b_asin_title_o08__o00_s00?ie=UTF8&psc=1

Fresh Pi, terminal copy below.
login as: pi
[email protected]'s password:
Linux raspberrypi 4.14.79-v7+ #1159 SMP Sun Nov 4 17:50:20 GMT 2018 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue Nov 13 08:24:54 2018
pi@raspberrypi:~ $ sudo apt-get update
Hit:1 http://raspbian.raspberrypi.org/raspbian stretch InRelease
Hit:2 http://archive.raspberrypi.org/debian stretch InRelease
Reading package lists... Done
pi@raspberrypi:~ $ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
pi@raspberrypi:~ $ sudo apt install hostapd
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libnl-route-3-200
The following NEW packages will be installed:
hostapd libnl-route-3-200
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 576 kB of archives.
After this operation, 1,565 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirror.us.leaseweb.net/raspbian/raspbian stretch/main armhf libnl-route-3-200 armhf 3.2.27-2 [113 kB]
Get:2 http://mirror.us.leaseweb.net/raspbian/raspbian stretch/main armhf hostapd armhf 2:2.4-1+deb9u2 [463 kB]
Fetched 576 kB in 1s (384 kB/s)
Selecting previously unselected package libnl-route-3-200:armhf.
(Reading database ... 133377 files and directories currently installed.)
Preparing to unpack .../libnl-route-3-200_3.2.27-2_armhf.deb ...
Unpacking libnl-route-3-200:armhf (3.2.27-2) ...
Selecting previously unselected package hostapd.
Preparing to unpack .../hostapd_2%3a2.4-1+deb9u2_armhf.deb ...
Unpacking hostapd (2:2.4-1+deb9u2) ...
Setting up libnl-route-3-200:armhf (3.2.27-2) ...
Processing triggers for libc-bin (2.24-11+deb9u3) ...
Processing triggers for systemd (232-25+deb9u8) ...
Processing triggers for man-db (2.7.6.1-2) ...
Setting up hostapd (2:2.4-1+deb9u2) ...
Processing triggers for systemd (232-25+deb9u8) ...
pi@raspberrypi:~ $ sudo sed -i '3idenyinterfaces wlan0' /etc/dhcpcd.conf
pi@raspberrypi:~ $ head -3 /etc/dhcpcd.conf

A sample configuration for dhcpcd.

See dhcpcd.conf(5) for details.

denyinterfaces wlan0
pi@raspberrypi:~ $ ps -fu root | grep wpa_supplicant
root 371 1 0 15:56 ? 00:00:00 wpa_supplicant -B -c/etc/wpa_supplicant/wpa_supplicant.conf -iwlan0 -Dnl80211,wext
pi@raspberrypi:~ $ sudo systemctl restart dhcpcd
pi@raspberrypi:~ $ ps -fu root | grep wpa_supplicant
pi@raspberrypi:~ $ git clone https://github.com/SynAckFin/TuyOTA
Cloning into 'TuyOTA'...
remote: Enumerating objects: 20, done.
remote: Counting objects: 100% (20/20), done.
remote: Compressing objects: 100% (17/17), done.
remote: Total 20 (delta 6), reused 11 (delta 3), pack-reused 0
Unpacking objects: 100% (20/20), done.
pi@raspberrypi:~ $ cd TuyOTA
pi@raspberrypi:/TuyOTA $ ls
LICENSE README.md static tuyota.pl
pi@raspberrypi:
/TuyOTA $ sudo ./tuyota.pl -ip 192.168.99.80 -s IoT -p Nal
Stage One firmware not found, downloading it
--2019-01-18 16:04:33-- https://github.com/SynAckFin/TuyOTA/raw/master/static/image_user2-0x81000.bin
Resolving github.com (github.com)... 192.30.253.113, 192.30.253.112
Connecting to github.com (github.com)|192.30.253.113|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://raw.githubusercontent.com/SynAckFin/TuyOTA/master/static/image_user2-0x81000.bin [following]
--2019-01-18 16:04:33-- https://raw.githubusercontent.com/SynAckFin/TuyOTA/master/static/image_user2-0x81000.bin
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.48.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.48.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 239220 (234K) [application/octet-stream]
Saving to: ‘image_user2-0x81000.bin’

image_user2-0x81000.bin 100%[========================================================>] 233.61K --.-KB/s in 0.1s

2019-01-18 16:04:33 (2.05 MB/s) - ‘image_user2-0x81000.bin’ saved [239220/239220]

Stage Two firmware not found, downloading it
--2019-01-18 16:04:34-- https://github.com/SynAckFin/TuyOTA/raw/master/static/sonoff.bin
Resolving github.com (github.com)... 192.30.253.112, 192.30.253.113
Connecting to github.com (github.com)|192.30.253.112|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://raw.githubusercontent.com/SynAckFin/TuyOTA/master/static/sonoff.bin [following]
--2019-01-18 16:04:34-- https://raw.githubusercontent.com/SynAckFin/TuyOTA/master/static/sonoff.bin
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.48.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.48.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 482512 (471K) [application/octet-stream]
Saving to: ‘sonoff.bin’

sonoff.bin 100%[========================================================>] 471.20K --.-KB/s in 0.1s

2019-01-18 16:04:34 (3.41 MB/s) - ‘sonoff.bin’ saved [482512/482512]

Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
RTNETLINK answers: Cannot assign requested address
Done
Using WiFi device wlan0 for Access Point
Creating Access Point config file hostapd.conf
Starting Access Point with SSID ZAGDU-789
Giving Access Point IP address 10.44.57.1, pid is 1271
Redirecting device 192.168.99.80 to use Access Point ZAGDU-789
**** Redirect appears successful
DHCP Discover b4:e6:2d:17:6d:21 10.44.57.71
DHCP Request b4:e6:2d:17:6d:21 10.44.57.71
**** New device detected. ID: 04200489b4e62d176d21 IP:10.44.57.71
**** New device looks to be part way through upgrading
**** Forcing it to retry the upgrade
Redirecting device 10.44.57.71 to use Access Point ZAGDU-789
**** Redirect appears successful
Received DNS query for mq.gw.tuyaus.com.
Sending 10.44.57.1 as response
Received DNS query for mq.gw.tuyaus.com.
Sending 10.44.57.1 as response
Received DNS query for mq.gw.tuyaus.com.
Sending 10.44.57.1 as response
Received DNS query for mq.gw.tuyaus.com.
Sending 10.44.57.1 as response
DHCP Discover b4:e6:2d:17:6d:21 10.44.57.71
DHCP Request b4:e6:2d:17:6d:21 10.44.57.71
Received DNS query for mq.gw.tuyaus.com.
Sending 10.44.57.1 as response
Accepting MQTT connection, forwarding to mq.gw.tuyaus.com.
Received DNS query for a.tuyaus.com.
Sending 10.44.57.1 as response
Receiving www request
Fetching Request Content
URL: /gw.json?a=atop.online.debug.log
Unable to reach a.tuyaus.com: Connection refused at ./tuyota.pl line 720, <$fh> line 15.
Exiting....
Shutting down...
pi@raspberrypi:/TuyOTA $ sudo ./tuyota.pl -ip 192.168.99.80 -s IoT -p NalPass
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Using WiFi device wlan0 for Access Point
Starting Access Point with SSID ZAGDU-789
Giving Access Point IP address 10.44.57.1, pid is 1292
Redirecting device 192.168.99.80 to use Access Point ZAGDU-789
Unable to open socket to 192.168.99.80: Connection timed out
The device might be at the next stage, ignoring for now
DHCP Discover b4:e6:2d:17:6d:21 10.44.57.97
DHCP Discover b4:e6:2d:17:6d:21 10.44.57.97
DHCP Discover b4:e6:2d:17:6d:21 10.44.57.97
DHCP Discover b4:e6:2d:17:6d:21 10.44.57.97
DHCP Discover b4:e6:2d:17:6d:21 10.44.57.97
DHCP Discover b4:e6:2d:17:6d:21 10.44.57.97
DHCP Discover b4:e6:2d:17:6d:21 10.44.57.97
DHCP Discover b4:e6:2d:17:6d:21 10.44.57.97
DHCP Discover b4:e6:2d:17:6d:21 10.44.57.97
DHCP Request c8:f6:50:ba:1b:e0
c8:f6:50:ba:1b:e0: Unknown host
Bad arg length for Socket::pack_sockaddr_in, length is 0, should be 4 at /usr/lib/arm-linux-gnueabihf/perl/5.24/Socket.pm line 157, <$fh> line 1.
Exiting....
Shutting down...
pi@raspberrypi:
/TuyOTA $ sudo ./tuyota.pl -ip 192.168.99.80 -s IoT -p NalPass
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Using WiFi device wlan0 for Access Point
Starting Access Point with SSID ZAGDU-789
Giving Access Point IP address 10.44.57.1, pid is 1324
Redirecting device 192.168.99.80 to use Access Point ZAGDU-789
Unable to open socket to 192.168.99.80: Connection timed out
The device might be at the next stage, ignoring for now
DHCP Discover b4:e6:2d:17:6d:21 10.44.57.66
DHCP Discover b4:e6:2d:17:6d:21 10.44.57.66
DHCP Discover b4:e6:2d:17:6d:21 10.44.57.66
DHCP Discover b4:e6:2d:17:6d:21 10.44.57.66
DHCP Discover b4:e6:2d:17:6d:21 10.44.57.66
DHCP Discover b4:e6:2d:17:6d:21 10.44.57.66
DHCP Discover b4:e6:2d:17:6d:21 10.44.57.66
DHCP Discover b4:e6:2d:17:6d:21 10.44.57.66
DHCP Discover b4:e6:2d:17:6d:21 10.44.57.66
DHCP Discover b4:e6:2d:17:6d:21 10.44.57.66
DHCP Discover b4:e6:2d:17:6d:21 10.44.57.66
DHCP Discover b4:e6:2d:17:6d:21 10.44.57.66
DHCP Discover b4:e6:2d:17:6d:21 10.44.57.66
DHCP Discover b4:e6:2d:17:6d:21 10.44.57.66
DHCP Discover b4:e6:2d:17:6d:21 10.44.57.66
DHCP Discover b4:e6:2d:17:6d:21 10.44.57.66
DHCP Discover b4:e6:2d:17:6d:21 10.44.57.66
DHCP Discover b4:e6:2d:17:6d:21 10.44.57.66
DHCP Discover b4:e6:2d:17:6d:21 10.44.57.66
DHCP Discover b4:e6:2d:17:6d:21 10.44.57.66
DHCP Discover b4:e6:2d:17:6d:21 10.44.57.66
DHCP Discover b4:e6:2d:17:6d:21 10.44.57.66
DHCP Discover b4:e6:2d:17:6d:21 10.44.57.66
DHCP Request b4:e6:2d:17:6d:21 10.44.57.66
**** New device detected. ID: 04200489b4e62d176d21 IP:10.44.57.66
**** New device looks to be part way through upgrading
**** Forcing it to retry the upgrade
Redirecting device 10.44.57.66 to use Access Point ZAGDU-789
Unable to open socket to 10.44.57.66: Connection refused
The device might be at the next stage, ignoring for now
Received DNS query for mq.gw.tuyaus.com.
Sending 10.44.57.1 as response
Received DNS query for a.tuyaus.com.
Sending 10.44.57.1 as response
Accepting MQTT connection, forwarding to mq.gw.tuyaus.com.
Receiving www request
URL: /gw.json?a=tuya.device.upgrade.silent.get
Sent upgrade response
Receiving www request
Fetching Request Content
URL: /gw.json?a=s.gw.upgrade.updatestatus
Response: HTTP/1.1 200 OK
Received DNS query for fakewebsite.
Sending 10.44.57.1 as response
Receiving www request
Sending firmware image_user2-0x81000.bin
Receiving www request
Sending firmware image_user2-0x81000.bin
Sending bytes 51-239270 from offset 0
Shutting down...
Setting up IP Address 192.168.4.2 for Final Stages
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Setting up wifi scan
Setting up listener for FinalStage
Shutting down...
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Finished
Exiting....
Shutting down...
pi@raspberrypi:/TuyOTA $ sudo ./tuyota.pl -ip 192.168.99.80
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
RTNETLINK answers: Cannot assign requested address
Done
Using WiFi device wlan0 for Access Point
Starting Access Point with SSID ZAGDU-789
Giving Access Point IP address 10.44.57.1, pid is 1414
Redirecting device 192.168.99.80 to use Access Point ZAGDU-789
Unable to open socket to 192.168.99.80: Connection timed out
The device might be at the next stage, ignoring for now
Shutting down...
Setting up IP Address 192.168.4.2 for Final Stages
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Setting up wifi scan
Setting up listener for FinalStage
Shutting down...
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Finished
Exiting....
Shutting down...
pi@raspberrypi:
/TuyOTA $ sudo ./tuyota.pl -s IoT -p NalPass
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
RTNETLINK answers: Cannot assign requested address
Done
Using WiFi device wlan0 for Access Point
Starting Access Point with SSID ZAGDU-789
Giving Access Point IP address 10.44.57.1, pid is 1484
Shutting down...
Setting up IP Address 192.168.4.2 for Final Stages
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Setting up wifi scan
Setting up listener for FinalStage
Shutting down...
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Finished
Exiting....
Shutting down...
pi@raspberrypi:~/TuyOTA $
login as: pi
[email protected]'s password:
Linux raspberrypi 4.14.79-v7+ #1159 SMP Sun Nov 4 17:50:20 GMT 2018 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Fri Jan 18 15:56:30 2019 from 192.168.88.150
pi@raspberrypi:~ $ ls
Desktop Documents Downloads MagPi Music Pictures Public Templates TuyOTA Videos
pi@raspberrypi:~ $ cd TuyOTA/
pi@raspberrypi:/TuyOTA $ ;s
-bash: syntax error near unexpected token `;'
pi@raspberrypi:
/TuyOTA $ ls
hostapd.conf image_user2-0x81000.bin LICENSE README.md sonoff.bin static tuyota.pl
pi@raspberrypi:/TuyOTA $ sudo nano hostapd.conf
pi@raspberrypi:
/TuyOTA $ sudo ./tuyota.pl -s IoT -p NalPass
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
RTNETLINK answers: Cannot assign requested address
Done
Using WiFi device wlan0 for Access Point
Starting Access Point with SSID ZAGDU-789
Giving Access Point IP address 10.44.57.1, pid is 824
Shutting down...
Setting up IP Address 192.168.4.2 for Final Stages
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Setting up wifi scan
Setting up listener for FinalStage
Shutting down...
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Finished
Exiting....
Shutting down...
pi@raspberrypi:/TuyOTA $ sudo ./tuyota.pl
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
RTNETLINK answers: Cannot assign requested address
Done
Using WiFi device wlan0 for Access Point
Starting Access Point with SSID ZAGDU-789
Giving Access Point IP address 10.44.57.1, pid is 865
Shutting down...
Setting up IP Address 192.168.4.2 for Final Stages
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Setting up wifi scan
Setting up listener for FinalStage
Shutting down...
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Finished
Exiting....
Shutting down...
pi@raspberrypi:
/TuyOTA $ sudo ./tuyota.pl -ip 192.168.99.80 -s IoT -p NalPass
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
RTNETLINK answers: Cannot assign requested address
Done
Using WiFi device wlan0 for Access Point
Starting Access Point with SSID ZAGDU-789
Giving Access Point IP address 10.44.57.1, pid is 919
Redirecting device 192.168.99.80 to use Access Point ZAGDU-789
Unable to open socket to 192.168.99.80: Connection timed out
The device might be at the next stage, ignoring for now
Shutting down...
Setting up IP Address 192.168.4.2 for Final Stages
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Setting up wifi scan
Setting up listener for FinalStage
Shutting down...
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Finished
Exiting....
Shutting down...
pi@raspberrypi:/TuyOTA $ sudo nano hostapd.conf
pi@raspberrypi:
/TuyOTA $ sudo ./tuyota.pl -s IoT -p NalPass
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
RTNETLINK answers: Cannot assign requested address
Done
Using WiFi device wlan0 for Access Point
Starting Access Point with SSID ZAGDU-789
Giving Access Point IP address 10.44.57.1, pid is 982
Shutting down...
Setting up IP Address 192.168.4.2 for Final Stages
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Setting up wifi scan
Setting up listener for FinalStage
Shutting down...
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Finished
Exiting....
Shutting down...
pi@raspberrypi:/TuyOTA $ sudo ./tuyota.pl -ip 192.168.99.82
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
RTNETLINK answers: Cannot assign requested address
Done
Using WiFi device wlan0 for Access Point
Starting Access Point with SSID ZAGDU-789
Giving Access Point IP address 10.44.57.1, pid is 1067
Redirecting device 192.168.99.82 to use Access Point ZAGDU-789
**** Redirect appears successful
DHCP Discover ec:fa:bc:86:89:d4 10.44.57.208
DHCP Request ec:fa:bc:86:89:d4 10.44.57.208
**** New device detected. ID: 02200194ecfabc8689d4 IP:10.44.57.208
**** New device looks to be part way through upgrading
**** Forcing it to retry the upgrade
Redirecting device 10.44.57.208 to use Access Point ZAGDU-789
**** Redirect appears successful
Received DNS query for mq.gw.tuyaus.com.
Sending 10.44.57.1 as response
Received DNS query for mq.gw.tuyaus.com.
Sending 10.44.57.1 as response
Received DNS query for mq.gw.tuyaus.com.
Sending 10.44.57.1 as response
Received DNS query for mq.gw.tuyaus.com.
Sending 10.44.57.1 as response
DHCP Discover ec:fa:bc:86:89:d4 10.44.57.208
DHCP Request ec:fa:bc:86:89:d4 10.44.57.208
Received DNS query for mq.gw.tuyaus.com.
Sending 10.44.57.1 as response
Accepting MQTT connection, forwarding to mq.gw.tuyaus.com.
Received DNS query for a.tuyaus.com.
Sending 10.44.57.1 as response
Receiving www request
Fetching Request Content
URL: /gw.json?a=atop.online.debug.log
Response: HTTP/1.1 200 OK
Receiving www request
URL: /gw.json?a=tuya.device.dynamic.config.get
Response: HTTP/1.1 200 OK
Receiving www request
Fetching Request Content
URL: /gw.json?a=tuya.device.upgrade.silent.get
Sent upgrade response
Receiving www request
Fetching Request Content
URL: /gw.json?a=s.gw.upgrade.updatestatus
Response: HTTP/1.1 200 OK
Received DNS query for fakewebsite.
Sending 10.44.57.1 as response
Receiving www request
Sending firmware image_user2-0x81000.bin
Receiving www request
Sending firmware image_user2-0x81000.bin
Sending bytes 51-239270 from offset 0
DHCP Request 00:18:dd:04:aa:0b
00:18:dd:04:aa:0b: Unknown host
Bad arg length for Socket::pack_sockaddr_in, length is 0, should be 4 at /usr/lib/arm-linux-gnueabihf/perl/5.24/Socket.pm line 157, <$fh> line 27.
Exiting....
Shutting down...
pi@raspberrypi:
/TuyOTA $ sudo ./tuyota.pl
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Using WiFi device wlan0 for Access Point
Starting Access Point with SSID ZAGDU-789
Giving Access Point IP address 10.44.57.1, pid is 1089
Shutting down...
Setting up IP Address 192.168.4.2 for Final Stages
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Setting up wifi scan
Setting up listener for FinalStage
Shutting down...
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Finished
Exiting....
Shutting down...
pi@raspberrypi:~/TuyOTA $

After flashing the device does not respond

A have flashed the following device SESOO WIFI-SK3

pi@rasp:~/TuyOTA`

$ sudo ./tuyota.pl -ip 192.168.1.76 -s Network -p password
Stage One firmware not found, downloading it
--2019-02-17 00:24:29-- https://github.com/SynAckFin/TuyOTA/raw/master/static/image_user2-0x81000.bin
Resolving github.com (github.com)... 140.82.118.4, 140.82.118.3
Connecting to github.com (github.com)|140.82.118.4|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://raw.githubusercontent.com/SynAckFin/TuyOTA/master/static/image_user2-0x81000.bin [following]
--2019-02-17 00:24:29-- https://raw.githubusercontent.com/SynAckFin/TuyOTA/master/static/image_user2-0x81000.bin
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.244.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.244.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 239220 (234K) [application/octet-stream]
Saving to: ‘image_user2-0x81000.bin’

image_user2-0x81000.bin 100%[=====================================================================================>] 233.61K --.-KB/s in 0.1s

2019-02-17 00:24:30 (2.09 MB/s) - ‘image_user2-0x81000.bin’ saved [239220/239220]

Stage Two firmware not found, downloading it
--2019-02-17 00:24:30-- https://github.com/SynAckFin/TuyOTA/raw/master/static/sonoff.bin
Resolving github.com (github.com)... 140.82.118.3, 140.82.118.4
Connecting to github.com (github.com)|140.82.118.3|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://raw.githubusercontent.com/SynAckFin/TuyOTA/master/static/sonoff.bin [following]
--2019-02-17 00:24:30-- https://raw.githubusercontent.com/SynAckFin/TuyOTA/master/static/sonoff.bin
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.0.133, 151.101.64.133, 151.101.128.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.0.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 482512 (471K) [application/octet-stream]
Saving to: ‘sonoff.bin’

sonoff.bin 100%[=====================================================================================>] 471.20K 2.97MB/s in 0.2s

2019-02-17 00:24:31 (2.97 MB/s) - ‘sonoff.bin’ saved [482512/482512]

Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
RTNETLINK answers: Cannot assign requested address
Done
Using WiFi device wlan0 for Access Point
Creating Access Point config file hostapd.conf
Starting Access Point with SSID ZAGDU-789
Giving Access Point IP address 10.44.57.1, pid is 7330
Redirecting device 192.168.1.76 to use Access Point ZAGDU-789
**** New device detected. ID: XXXXXXXXXXXXXXXXXXX IP:192.168.1.76
Asking device to move networks and upgrade...
Redirecting device 192.168.1.76 to use Access Point ZAGDU-789
**** Redirect appears successful
DHCP Discover 80:7d:3a:5c:23:19 10.44.57.67
DHCP Request 80:7d:3a:5c:23:19 10.44.57.67
**** Device XXXXXXXXXXXXXXXXXX has changed IP from 192.168.1.76 to 10.44.57.67
Received DNS query for mq.gw.tuyaeu.com.
Sending 10.44.57.1 as response
Accepting MQTT connection, forwarding to mq.gw.tuyaeu.com.
Received DNS query for a.tuyaeu.com.
Sending 10.44.57.1 as response
Receiving www request
Fetching Request Content
URL: /gw.json?a=atop.online.debug.log
Response: HTTP/1.1 200 OK
{"result":true,"t":1550352292,"e":false,"success":true}
Receiving www request
URL: /gw.json?a=tuya.device.dynamic.config.get
Response: HTTP/1.1 200 OK
{"result":{"validTime":1800,"time":1550352292,"config":{}},"t":1550352292,"e":false,"success":true}
Receiving www request
Fetching Request Content
URL: /gw.json?a=tuya.device.upgrade.silent.get
Sent upgrade response
Receiving www request
Fetching Request Content
URL: /gw.json?a=s.gw.upgrade.updatestatus
Response: HTTP/1.1 200 OK
{"t":1550352312,"e":false,"success":true}
Received DNS query for fakewebsite.
Sending 10.44.57.1 as response
Receiving www request
Sending firmware image_user2-0x81000.bin
Receiving www request
Sending firmware image_user2-0x81000.bin
Sending bytes 239271-478490 from offset 0
DHCP Discover 80:7d:3a:5c:23:19 10.44.57.67
DHCP Request 80:7d:3a:5c:23:19 10.44.57.67
Shutting down...
Setting up IP Address 192.168.4.2 for Final Stages
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Setting up wifi scan
Setting up listener for FinalStage
***** FinalStage Detected ******
***** Connected to FinalStage ******
***** Receiving FinalStage Request ****
REQ: Client closed connection while receiving request:
***** Receiving FinalStage Request ****
Sending firmware sonoff.bin
***** Tasmota Firmware sent to device ******
***** Found Sonoff AP sonoff-0793 ******
***** Connected to sonoff-0793 ******
Sending config to sonoff-0793
***** Config sent *****
***** Found Sonoff AP sonoff-0793 ******
***** Connected to sonoff-0793 ******
Failed to connect to device sonoff-0793: No route to host
Shutting down...
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Finished
Exiting....
Shutting down...`

But unfortunatly, after flashing the device does not respond at all. Are their any chances to reanimate it?

Access Point has shutdown

Hi here,

I am trying to run your script for my plug on an Ubuntu 18 computer. Is it compatible, or does it have to be Raspian?

The issue seems to be a problem controlling wlan0, as I'm getting the "Access point has shutdown" message immediately after it attempts to start its SSID. I used sudo and also tried running directly as root.

root@ubuntu:/home/usre/Desktop/TuyOTA-master# ./tuyota.pl -s 'xxx' -p 'xxx'
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Using WiFi device wlan0 for Access Point
Starting Access Point with SSID ZAGDU-789
Giving Access Point IP address 10.44.57.1, pid is 6270
***** Access Point has Shutdown *****
DHCP Discover 00:10:18:bb:13:f1 10.44.57.226
Shutting down...
Setting up IP Address 192.168.4.2 for Final Stages
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Setting up wifi scan
Setting up listener for FinalStage
wlan0     Interface doesn't support scanning : Device or resource busy

Shutting down...
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Finished
Exiting....
Shutting down...

Problem that i not understand

Hello,
I have a problem and i dont know what can i do to solve it :-(

I have a powerstrip configure in tuya. i close the tuya app and lauch the script and this is the result:

pi@raspberrypi:~/TuyOTA $ sudo ./tuyota.pl -ip 192.168.31.45 -s MyHomeNet -p MySecret
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
RTNETLINK answers: Cannot assign requested address
Done
Using WiFi device wlan0 for Access Point
Starting Access Point with SSID ZAGDU-789
Giving Access Point IP address 10.44.57.1, pid is 1530
Redirecting device 192.168.31.45 to use Access Point ZAGDU-789
Unable to open socket to 192.168.31.45: Connection timed out
The device might be at the next stage, ignoring for now
**** New device detected. ID: 067xxxxxxxxxxxxxxxxxxxx IP:192.168.1.89
DHCP Discover 00:23:56:5c:03:82 10.44.57.200
DHCP Request 00:23:56:5c:03:82 10.44.57.200
Shutting down...
Setting up IP Address 192.168.4.2 for Final Stages
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Setting up wifi scan
Setting up listener for FinalStage
Shutting down...
Getting interface into stable state
RTNETLINK answers: Cannot assign requested address
Done
Finished
Exiting....
Shutting down...
pi@raspberrypi:~/TuyOTA $

any advice are welcome!
thanks for your great job!!!

Bad arg length error when other devices request DHCP during stage 1

When the script is running through stage 1 (DHCP Discovery), if other devices send DHCP requests at the same time, the script sometimes fails with the following error:

"
DHCP Discover cc:50:e3:d5:90:fd 10.44.57.19
DHCP Discover cc:50:e3:d5:90:fd 10.44.57.19
DHCP Request cc:50:e3:d5:90:fd 10.44.57.19
DHCP Discover a0:20:a6:0d:e1:bd
Bad arg length for Socket::pack_sockaddr_in, length is 0, should be 4 at /usr/lib/arm-linux-gnueabihf/perl/5.24/Socket.pm line 157, <$fh> line 28.
Exiting....
Shutting down...
"

In this case, device with the MAC cc:50:e3:d5:90:fd is the target device (ZOOZEE SA101 plug), while a0:20:a6:0d:e1:bd is another ESP sensor (waking up from deepsleep). Stage 1 did complete, and I was able to continue with stage 2 and complete the flash satisfactorily!

Can't open acces point

Hi SyncAckFin
At the begining of process you ask for kill wpa_supplicant. This cut wifi access !?
and after I have to clone the repository.
How I can do that ? do i must connect pi with ethernet cable ?
In the script, do i have to enter the wifi ip of the pi in my wifi network ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.