Local Tuya: cannot find how to set up Tuyapi CLI

Hello, I am trying to set up the localtuya integration from HACS, and did all the steps from creating a developers account on iot.tuya.com but am stuck on the installing of the CLI tool, where and how do I do this? I should run a command “npm i @tuyapi/cli -g” but I have no clue where or how. Please help us out.

ref: https://github.com/codetheweb/tuyapi/blob/8c2fe71cfc3aa22024b67472bbfd95467a5a28b1/docs/SETUP.md
I just need help for setting up a local instance for Tuya (we recently installed a Smart Garage Door opener from AliExpress) so we could make it local for safety and speed. I have no clue how to set this up.

1 Like

Firstable you should have your Tuya devices registered and available in any App Tuya compatible cellphone (for example, I use SmartLife App in cellphone). Later, once you have created account on iot.tuya.com you get there an Access ID/Client ID/API Key and an Access Secret/Client Secret/API Secret and all your devices ID that you registered previously, if you follow the tutorial in https://github.com/codetheweb/tuyapi/blob/8c2fe71cfc3aa22024b67472bbfd95467a5a28b1/docs/SETUP.md
Once you have done it you need to get local keys of devices via TUYAPI (they change everytime you re-sync them). In my case I couldnt use HA for getting them with tuyapi, as I am using Hassio in a docker raspberry pi so I used an Ubuntu and did:
sudo npm i @tuyapi/cli -g
tuya-cli wizard
Wizard will ask you about The API key from tuya.com: and The API secret from tuya.com that you get in first steps. Moreover, you will have to give it a device ID that you registered too: Provide a ‘virtual ID’ of a device currently registered in the app.
Once done, wizard will you give you local keys for every local tuya devices like that:
{ name: ‘A/A’, id: ‘41314751840d8eb99f09’, key: ‘XXXXXXXXXX’ },

Once you get them you write them down as you will need it to add devices when you use integration of Local-Tuya in HA.

Best regards


Thank you for your reply! I should have mentioned I am running Hassos on a VM inside my Unraid Server, so would you suggest using a temporary Ubuntu VM just for figuring out my local keys?

Hello again
Yes, I advice you to use a temporary Ubuntu/Linux VM to get local keys because you cant use npm inside Hassio (docker instance of Home assistant) for installing tuyapi.
Good luck!