question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

A new way of getting deviceId and localKey

See original GitHub issue

Hello, I’ve found out, that an official Smart Life app shows you deviceId. I’ve tested that deviceId with tuya OpenAPI and it works (at least for my smart sockets). This means, that you can get localKey from an OpenAPI /v1.0/devices/{{device_id}}.

I think, that this may be useful to simplify tuyapi setup workflow.

The new setup will consist of three steps:

  • after creating app on iot.tuya.com and getting key/secret, you need to link your devices, but instead of doing that with @tuyapi/cli, you should “Link device by Tuya Smart App Account”: image
  • then you can grab id from an app. From the main screen tap on device you interested in, then tap “edit icon” to get to the screen where you can manage/share/rename device. On that screen there is “Device information” menu option, where you can look up for the deviceId: image
  • finally request device info from tuya OpenAPI, where you can get localKey value: image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:56 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
Thunderbird2086commented, Jan 5, 2021

It’s from postman, a standalone application.

image

where is this screenshot from?

2reactions
kinstraycommented, Oct 19, 2020

Rejigged the earlier comment with some extra stuff I had to do. Thanks to @Moudoux for the info!

I found this method the easiest

Follow this guide first: https://developer.tuya.com/en/docs/iot/open-api/quick-start/quick-start1?id=K95ztz9u9t89n

Make sure you import your devices using ‘Link devices by App account’. Also under ‘API Group’, enable the API’s giving any random reason. I’m not sure which, I just enabled them all. Remember there are 3 pages!

You’ll need your Client ID, Client Secret and Device ID for the plug you need the Local ID for. Those are all in the Tuya portal.

<Mostly> Written by @Moudoux on 23 May, thanks to them for this bit! :

  1. Install Postman
  2. Download and import the environment and collection in postman
  3. Set up the variables according to your Tuya developer profile client_id, device_id (from the app as described in this post) and url (region based, i.e. https://openapi.tuyaeu.com for EU) - Make sure you’ve enabled the API’s (mentioned above) and wait 5 to 10 mins or so for them to take effect!
  4. Run the access_token task in collections in postman
  5. Run the {{url}}/v1.0/devices/{{device_id}} request to get your local_key

Found this much easier than messing around with SSL certificates on Android devices and Proxy apps!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Get your Tuya Device Local Key - YouTube
Short, current video, on how to get Tuya local key, so you can use Home Assistant Tuya Local. Also a little bit of...
Read more >
Get All Local Tuya Keys (ALL KEYS, SIMPLE, NO SOLDERING)
In this video we will be looking at a way to extract all of your Local Keys for all of your Tuya Devices....
Read more >
Easy way to obtain localKey/devID for Eufy vacuums - Reddit
Use this app on Android device or emulators and localKey/devID will be available in vacuum settings…
Read more >
Using Tuya IoT Platform to obtain not only Local Keys, but also ...
I've stumbled across a way to get the DP IDs from Tuya IoT Platform. ... Tuya IoT account and add the devices and...
Read more >
[APP][Pro] Eufy Home - Homey Community Forum
Go to new devices - Fill in deviceId - LocalKey - Internal IP of ... contribute to future development by making a paypal...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found