SynAckFin / TuyOTA

Flashing Tuya devices with Tasmota firmware.
GNU General Public License v3.0
90 stars 13 forks source link

Couldn't flash device #12

Open hungpr0 opened 5 years ago

hungpr0 commented 5 years ago

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.

SynAckFin commented 5 years ago

Can you run the script again and in a second terminal ping the device while the script is running? You should see the pings stop after the following appears in the output.

Redirecting device 192.168.2.82 to use Access Point ZAGDU-789
**** Redirect appears successful

That would mean the device has been successfully redirected to the ZAGDU-789 access point and that the problem might be with the access point. If that is the case then run the following without the script running:

hostapd hostapd.conf

Then try connecting to ZAGDU-789 with your phone. This will fail, but the output from the hostapd command will tell me something. You should see something like this:

wlan0: interface state UNINITIALIZED->ENABLED
wlan0: AP-ENABLED 
wlan0: STA xx:xx:xx:xx:xx:xx IEEE 802.11: authenticated
wlan0: STA xx:xx:xx:xx:xx:xx IEEE 802.11: associated (aid 1)
wlan0: AP-STA-CONNECTED xx:xx:xx:xx:xx:xx
wlan0: STA xx:xx:xx:xx:xx:xx RADIUS: starting accounting session 07EB2952226E564D
wlan0: STA xx:xx:xx:xx:xx:xx WPA: pairwise key handshake completed (RSN)

You don't need to have DHCP or DNS servers running on the machine the script runs on because it has its own cut down DHCP server built in.

hungpr0 commented 5 years ago

Thanks SynAckFin

I have just tried root@orangepiplus: /TuyOTA# cat hostapd.conf interface=wlan0 wpa=2 ssid=ZAGDU-789 wpa_passphrase=un49fqxc hw_mode=g channel=1 root@orangepiplus:~/TuyOTA# hostapd hostapd.conf Configuration file: hostapd.conf

Using interface wlan0 with hwaddr 28:f3:66:b6:10:ce and ssid "ZAGDU-789" wlan0: interface state UNINITIALIZED->ENABLED wlan0: AP-ENABLED wlan0: STA xx:xx:xx:xx:xx:xx IEEE 802.11: disassociated

Both of my phone can't connect to the ZP ZAGDU-789. It said incorrect password although I make sure that it is un49fqxc. Tried to change to password but it had the same result. I will recheck this.

SynAckFin commented 5 years ago

If you comment out the wpa=2 and wpa_passphrase=un49fqxc lines with a # then the access point wont require a password

hungpr0 commented 5 years ago

Thanks. I tried to comment out those 2 lines but my phones still ask for password!. I tried to rename the SSID to make sure it using the current config file. interface=wlan0

wpa=2

ssid=ZAGDU-7890

wpa_passphrase=un49fqxc

hw_mode=g channel=3

hungpr0 commented 5 years ago

root@orangepiplus:~/TuyOTA# hostapd -d ./hostapd.conf random: Trying to read entropy from /dev/random Configuration file: ./hostapd.conf nl80211: Supported cipher 00-0f-ac:1 nl80211: Supported cipher 00-0f-ac:5 nl80211: Supported cipher 00-0f-ac:2 nl80211: Supported cipher 00-0f-ac:4 nl80211: Using driver-based off-channel TX nl80211: Supported vendor command: vendor_id=0xe04c subcmd=1 nl80211: Supported vendor command: vendor_id=0x1a11 subcmd=4106 nl80211: Supported vendor command: vendor_id=0x1a11 subcmd=4107 nl80211: Supported vendor event: vendor_id=0xe04c subcmd=0 nl80211: Supported vendor event: vendor_id=0xe04c subcmd=1 nl80211: interface wlan0 in phy phy0 nl80211: Set mode ifindex 4 iftype 3 (AP) nl80211: Setup AP(wlan0) - device_ap_sme=1 use_monitor=0 nl80211: Subscribe to mgmt frames with AP handle 0x1b3e370 (device SME) nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1b3e370 match=04 nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1b3e370 match=0501 nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1b3e370 match=0504 nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1b3e370 match=06 nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1b3e370 match=08 nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1b3e370 match=09 nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1b3e370 match=0a nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1b3e370 match=11 nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0x1b3e370 match=7f nl80211: Enable Probe Request reporting nl_preq=0x1b39548 nl80211: Register frame type=0x40 (WLAN_FC_STYPE_PROBE_REQ) nl_handle=0x1b39548 match= rfkill: initial event: idx=0 type=1 op=0 soft=0 hard=0 nl80211: Add own interface ifindex 4 (ifidx_reason -1) nl80211: if_indices[16]: 4(-1) phy: phy0 BSS count 1, BSSID mask 00:00:00:00:00:00 (0 bits) nl80211: Regulatory information - country=00 nl80211: 2402-2472 @ 40 MHz 20 mBm nl80211: 2457-2482 @ 20 MHz 20 mBm (no IR) nl80211: 2474-2494 @ 20 MHz 20 mBm (no OFDM) (no IR) nl80211: 5170-5250 @ 80 MHz 20 mBm (no IR) nl80211: 5250-5330 @ 80 MHz 20 mBm (DFS) (no IR) nl80211: 5490-5730 @ 160 MHz 20 mBm (DFS) (no IR) nl80211: 5735-5835 @ 80 MHz 20 mBm (no IR) nl80211: 57240-63720 @ 2160 MHz 0 mBm nl80211: Added 802.11b mode based on 802.11g information Completing interface initialization Mode: IEEE 802.11g Channel: 3 Frequency: 2422 MHz DFS 0 channels required radar detection nl80211: Set freq 2422 (ht_enabled=0, vht_enabled=0, bandwidth=20 MHz, cf1=2422 MHz, cf2=0 MHz)

SynAckFin commented 5 years ago

Thanks. I tried to comment out those 2 lines but my phones still ask for password!. I tried to rename the SSID to make sure it using the current config file. interface=wlan0

wpa=2

ssid=ZAGDU-7890

wpa_passphrase=un49fqxc

hw_mode=g channel=3

I'm surprised at the phone asking for a password. Type in any password it should still connect to the access point and then fail to get an IP.

hungpr0 commented 5 years ago

Thanks. I tried to comment out those 2 lines but my phones still ask for password!. I tried to rename the SSID to make sure it using the current config file. interface=wlan0

wpa=2

ssid=ZAGDU-7890

wpa_passphrase=un49fqxc

hw_mode=g channel=3

I'm surprised at the phone asking for a password. Type in any password it should still connect to the access point and then fail to get an IP.

Same problem with default AP ARMBIAN armbian-config command line. Password is incorrect. Not sure if it is hardware issue or not...