Code Monkey home page Code Monkey logo

localtuyakeyextractor's Introduction

Local Tuya Key Extractor

Tool for pulling Local Keys from Tuya IoT Cloud for use with Local Tuya

Pre-Requisites

  • You need to have a Tuya IoT Cloud Developer account
    • have created a Cloud Project.
    • The Cloud project needs to also be linked to your Tuya Smart/Smart Life App so the devices are visible.
    • You will need the API Keys for that project in order for this tool to work

Known Limitations

You need to manually add your devices to the input.csv file.
Attempts to automatically extract the device list have failed so far.

Getting Started

Clone this project: git clone https://github.com/HiveMindAutomation/LocalTuyaKeyExtractor.git
Change to the project directory: cd LocalTuyaKeyExtractor

Optional - Create a Python Virtual Environment (recommended)

  • Create the Virtual Environment python3 -m venv venv
  • Activate the Virtual Environment: source ./venv/bin/activate

Install Dependencies

pip3 install -r requirements.txt

Optional - deactivate the venv: deactivate

Setup your Authentication details

open auth_template.py in the editor of your choice

  • Change "ACCESS_ID" to the Access ID/Client ID copied from your Tuya IoT Cloud project
  • Change "ACCESS_KEY" to the Access Secret/Client Secret copied from your Tuya IoT Cloud project

Save the modified file as auth.py

Add your Devices to input.csv

open input.csv in Excel/Numbers/Editor of your choice.

  • Copy the Device ID's of the Devices you want to lookup into the CSV
    • You can either get this from the "Devices" page in your Tuya IoT Cloud project OR
    • open the device in the Tuya Smart app, click the "edit" option, and go to "Device Information"
      • Copy the "Virtual ID" from the Tuya Smart App. on macOS/iOS, Handoff will mean you can copy from your phone and paste into the CSV File.
  • Repeat for ALL Device ID's you want to lookup, this doesn't have to be all of your Tuya Devices, but I don't see much point in doing it by halves.
  • Save the CSV, do not change the name, it MUST be input.csv

run the script

Activate the virtual environment (if you're using a venv): source ./venv/bin/activate

Run TuyaKeys.py: python3 ./TuyaKeys.py

Optional - deactivate the Venv: deactivate

Output

Following a successful run of the script, you should have a file added to the folder called local_tuya.csv containing the following details for each device in your input.csv file:

Parameter Description
device_id This is the Device ID we input to the CSV file. You need this to add LocalTuya
device_name The "Friendly Name" of the Device in your Tuya IoT Cloud setup and your Tuya Smart App
local_key This is what we came here for. The Local API Key for the device. Required to setup Local Tuya
mac_address MAC Address of the device. Helpful when you're trying to find the Local IP Address
product_name Tuya Product Name
product_category Tuya Product Category

localtuyakeyextractor's People

Contributors

hivemindautomation avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.