Skip to content

Setup Instructions

Miki edited this page Sep 14, 2019 · 9 revisions

You will need your iPhone and console access to the server you are using or plan to use for Homebridge. All the following steps are to be performed on the console of your server, unless stated. While it might appear to be just too much, it hardly takes a minute to get done provided you have a functioning Homebridge setup.

Make sure you perform the cleanup steps after you are done.

  1. If you haven't already, install and configure Homebridge.
  2. Install this plugin using npm i -g homebridge-tuya-lan.
  3. Add all your devices to the Tuya Smart app to avoid having to repeat these steps.
    • Using any app other than Tuya Smart might not result in the desired outcome. You might be able to install the Tuya Smart app, extract id and key combinations, and simply abandon or uninstall it, without the key going bad.
  4. Make sure the Tuya Smart app is not running or minimized.
  5. Follow these steps to get the id and key combinations for the devices. These instructions were created for iOS 13; using older versions of iOS, you might see some slight differences.
    1. Execute tuya-lan-find. Within a few seconds, you would be shown (a) a QR code and (b) details of the proxy server.
      • If you have a new type of device, you can run tuya-lan-find --schema to get the full definition of your device.
    2. Scan the QR code with your iPhone. If you don't know how to do that, just say "Hey Siri, scan a QR code!" and point the camera at the barcode.
    3. Your phone will ask you your permission to open Safari; let it.
    4. Safari will alert you that the website is trying to download a configuration profile; allow that too.
    5. A confirmation message will be shown, letting you know that the profile was downloaded. Hit Close.
    6. Launch the Settings app on your phone. Just below your name, you would find Profile Downloaded; tap it.
      • If you are using an older iOS, you won't see that. Go to General, scroll down, and tap on Profiles & Device Management. Tap on NodeMITMProxyCA and follow the steps below.
    7. You would find yourself on the Install Profile screen for NodeMITMProxyCA. Hit Install on the top-right of the screen. If your phone has a passcode, you would be asked to enter it. A confirmation dialog will pop up; hit Install again. Finally hit Done to close it all.
      • We will get rid of this "profile" later.
    8. On your iPhone, go to Settings, open General, and tap on About. Towards the bottom, locate and open Certificate Trust Settings.
    9. Enable full trust for NodeMITMProxyCA by flicking its switch. You will be prompted with a warning; just hit Continue.
    10. On your iPhone, go to Settings and open Wi-Fi. Hit the info button, which is a blue i in a circle, for the WiFi connection you are using. This will open the configuration for your connection.
    11. On your WiFi connection screen, scroll to the bottom and hit Configure Proxy. This will open the proxy configuration screen.
    12. On the proxy configuration screen, tap on Manual to reveal additional settings. Use the details shown below the QR code to fill in the server and port.
      • Leave the Authentication switch off.
    13. On your phone, open the Tuya Smart app; if it was already open, kill it and open it again. In a few seconds, a several lines will appear under the QR code on the console.
      • Grab the id and key for your devices.
    14. After storing the id and key combinations elsewhere, follow the clean up instructions below to get rid of all the things we won't need anymore, and to be able to use your phone again.
  6. Update the config.json file of your Homebridge setup, by modifying the sample configurations and using the id and key combinations.

Cleanup Instruction

After taking note of your id and key combinations, follow this steps to revert the changes you made above. Do not miss these!

  1. On your iPhone, go to Settings and open Wi-Fi. Hit the info button, which is a blue i in a circle, for the WiFi connection you are using. Open Configure Proxy and select Off.
  2. On your iPhone, go to Settings > General > About > Certificate Trust Settings and switch off full trust for NodeMITMProxyCA.
  3. On your iPhone, go to Settings > General > Profiles & Device Management > NodeMITMProxyCA and tap Remove Profile. If one is set, you will be asked to enter your passcode. You would also be asked to confirm that you want to remove the profile; hit Remove.
Clone this wiki locally