0.2.0 • Published 3 years ago
tuya-get-device-info v0.2.0
Tuya Get Device Info
tuya-get-device-info is a simple command-line tool to obtain Tuya device information, including the local_key.
Prerequisites
- Node.js (v14 or newer)
tuya-get-device-inforepository- Tuya API access key and secret key
- Device ID of the Tuya device you want to get information for
Usage
- Set the following environment variables with the corresponding values:
TUYA_API_ACCESS_KEY: Your Tuya API access keyTUYA_API_SECRET_KEY: Your Tuya API secret key
You can set these environment variables using the export command on macOS/Linux or the set command on Windows. For example, on macOS/Linux:
export TUYA_API_ACCESS_KEY=your_access_key
export TUYA_API_SECRET_KEY=your_secret_key`- Run the
tuya-get-device-infocommand with the device ID as an argument:
npx --yes tuya-get-device-info get-local-key <DEVICE_ID>Replace <DEVICE_ID> with your actual device ID.
This command will output the device information in JSON format. To extract the local_key from the output, for example, you can use a tool like jq:
npx --yes tuya-get-device-info get-local-key <DEVICE_ID> | jq -r '.result.local_key'This command will print the local_key without quotes.
Development
- Clone the
tuya-get-device-inforepository:
git clone https://github.com/yourusername/tuya-get-device-info.git- Navigate to the
tuya-get-device-infodirectory:
cd tuya-get-device-info- Install the required dependencies:
npm install