-
Notifications
You must be signed in to change notification settings - Fork 52
Common Problems
- When the plugin starts, it invites all Tuya accessories to respond; this is how the plugin discovers devices on your network. Some devices don't reply to a discovery request and you would see a message in your logs about it. To mitigate this, configure a static IP for the device in your router and add a parameter named
ip
with the IP address of the device to your config file.{ ... "id": "032000123456789abcde", "key": "0123456789abcdef", "ip": "10.10.10.10", ... }
- Some devices respond on an encrypted channel which will be added to the plugin soon.
- Some devices do respond but a mistyped
key
could be to blame. If you seeDiscovered a device that has not been configured yet
in the logs, its a hint at this misconfiguration. - If the Tuya, Smart Life, or similar app is running on your phone, it prevents the devices from talking to the plugin. Make sure the app is killed on your phone and not just minimized or hidden.
This is an indicator of an unknown API. Create an issue if none is there and I will try to figure it out or find someone who has.
Sometimes even the logs don't make sense and the best way is to decode what Tuya's app is doing and mimick the same behavior in the plugin. To do this, we will use the Remote Virtual Interface (VRI) mechanism to record packet traces of your iOS device using a Mac.
While these instructions might look intimidating, I promise that they are pretty straightforward; I have tried to describe every tiny step.
-
Install Wireshark on your Mac.
-
Make sure your iOS device (iPhone, iPad) doesn't have a proxy set on it. Set the proxy configuration to
off
, if it is not already. -
Connect your iOS device to the Mac using the cable.
-
Open iTunes and select your device. On the page that shows the serial number of your device, click on the "Serial number"; this will change the field to show you the UDID.
-
Use the
Edit
menu of iTunes to copy the UDID and store it somewhere; we will be using it in a minute. -
On your iOS device, go to your WiFi settings by hiting the blue
i
in the circle. -
Tap on
Configure DNS
and change it toManual
. Then, delete all the DNS Servers listed there (you don't need to take a backup if DNS wasAutomatic
). -
Tap on
Add Server
and add a fake (yet valid) IP that fits your network. By giving your iOS device a bad DNS server, we will force the Tuya app to communicate with the devices via the LAN, as opposed to its default, via the cloud. -
Kill the Tuya app on your iOS device if it is running.
-
On your Mac, while the phone is connected, key in
rvictl -s YOUR-UDID
, substituting in your UDID we obtained earlier. Hit enter. -
Next, key in
sudo tcpdump -i rvi0 -w ~/trace.pcap
in the terminal. Give it a second or two before you move on to the next step. -
On your iOS device, open Tuya's app and wait for at least 30 seconds. This will give Tuya's app enough time to attempt to make a connection to the cloud, fail, and then try communicating locally.
-
After you waited, communicate with the device, turn something on or off. One or two interactions would be enough.
-
Go back to the terminal and hit
Ctrl+C
to stoptcpdump
. -
On the terminal, key in
rvictl -x YOUR-UDID
, substituting in your UDID, to remove the VRI. -
On your iOS device, open the WiFi settings, tap on
Configure DNS
, and change it toAutomatic
. -
Launch Wireshark on your Mac. Drag and drop the
trace.pcap
file from your home folder into Wireshark. You will be shown an error stating "The capture file appears to have been cut short in the middle of a packet". HitOK
; it is expected. -
Locate the text box on top that says
Apply a display filter ...
and key in(ip.dst == DEVICE-IP or ip.src == DEVICE-IP) and tcp
, substituting in your device's IP. This will filter out everything that is not related to your Tuya device. Hit enter to apply the filter. -
After the filter is applied, right click on the first row and choose
Follow
andTCP Stream
; a new window will pop up. -
On the new
Follow TCP Stream
window, locateShow and save data as
at the bottom and change it toYAML
. -
Click
Save as
and save it to a file. -
In Wireshark, change the ending of the filter from
and tcp
toand udp
, right click the first row, and chooseFollow
andUDP Stream
; a new window will pop up. -
On the new
Follow UDP Stream
window, changeShow and save data as
toYAML
and clickSave as
to save it to a different file. -
Email me these two files along with your device
key
, atamoo
_miki
@yahoo
.com
.Do not post your key in the public. The dump files don't contain anything important but, at the hands of someone motivated enough, they can be used to "guess" your
key
.