Skip to content

Common Problems

Miki edited this page Sep 9, 2019 · 4 revisions

Failed to discover ...

  • 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 see Discovered 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.

Odd message from name with command 8

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.

Want to help debug and have a Mac?

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.

  1. Install Wireshark on your Mac.

  2. 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.

  3. Connect your iOS device to the Mac using the cable.

  4. 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.

  5. Use the Edit menu of iTunes to copy the UDID and store it somewhere; we will be using it in a minute.

  6. On your iOS device, go to your WiFi settings by hiting the blue i in the circle.

  7. Tap on Configure DNS and change it to Manual. Then, delete all the DNS Servers listed there (you don't need to take a backup if DNS was Automatic).

  8. 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.

  9. Kill the Tuya app on your iOS device if it is running.

  10. On your Mac, while the phone is connected, key in rvictl -s YOUR-UDID, substituting in your UDID we obtained earlier. Hit enter.

  11. 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.

  12. 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.

  13. After you waited, communicate with the device, turn something on or off. One or two interactions would be enough.

  14. Go back to the terminal and hit Ctrl+C to stop tcpdump.

  15. On the terminal, key in rvictl -x YOUR-UDID, substituting in your UDID, to remove the VRI.

  16. On your iOS device, open the WiFi settings, tap on Configure DNS, and change it to Automatic.

  17. 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". Hit OK; it is expected.

  18. 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.

  19. After the filter is applied, right click on the first row and choose Follow and TCP Stream; a new window will pop up.

  20. On the new Follow TCP Stream window, locate Show and save data as at the bottom and change it to YAML.

  21. Click Save as and save it to a file.

  22. In Wireshark, change the ending of the filter from and tcp to and udp, right click the first row, and choose Follow and UDP Stream; a new window will pop up.

  23. On the new Follow UDP Stream window, change Show and save data as to YAML and click Save as to save it to a different file.

  24. Email me these two files along with your device key, at amoo_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.