Ledvance WiFi bulbs

Step 1 Download & Install the latest version of Android Studio from here: https://developer.android.com/studio

(in my case 2020.3.1)

Step 2 On the first startup of Android Studio you have to complete the setup wizard:

r/homeassistant - Guide on extract a local key from a Ledvance Bulb (for Local Tuya)

r/homeassistant - Guide on extract a local key from a Ledvance Bulb (for Local Tuya)

Keep everything on default settings

r/homeassistant - Guide on extract a local key from a Ledvance Bulb (for Local Tuya)

Step 3 Open an empty folder (e.g. on your desktop)

r/homeassistant - Guide on extract a local key from a Ledvance Bulb (for Local Tuya)

r/homeassistant - Guide on extract a local key from a Ledvance Bulb (for Local Tuya)

Step 4 Open the AVD Manager and create a virtual device

r/homeassistant - Guide on extract a local key from a Ledvance Bulb (for Local Tuya)

Step 5 Select a device without Play Store (important!!) E.g. Pixel 2 XL

r/homeassistant - Guide on extract a local key from a Ledvance Bulb (for Local Tuya)

Step 6 Click on Download for the Pie system image (API Level 28, Android 9.0)

r/homeassistant - Guide on extract a local key from a Ledvance Bulb (for Local Tuya)

Step 7 Select the downloaded image and click next

Step 8 Now you can start the emulator (play button)

r/homeassistant - Guide on extract a local key from a Ledvance Bulb (for Local Tuya)

r/homeassistant - Guide on extract a local key from a Ledvance Bulb (for Local Tuya)

Step 9 Download python 3.9.x

From here https://www.python.org/downloads/release/python-396/

If you are using Windows 10 64bit I would recommend the installer:

https://www.python.org/ftp/python/3.9.6/python-3.9.6-amd64.exe

Step 10 Run the installer and make sure you select “Add Python 3.9 to PATH”

r/homeassistant - Guide on extract a local key from a Ledvance Bulb (for Local Tuya)

Step 11. Open powershell and install frida tools via pip:

pip install frida-tools

Step 12. Download frida-server from https://github.com/frida/frida/releases

(I used frida-server-15.0.17-android-x86.xz)

Step 13. Extract to a directory via 7zip, WinRAR,… and rename the file to frida-server

Step 14 Setup adb (you can follow this guide https://medium.com/androiddevelopers/help-adb-is-not-found-93e9ed8a67ee)

On Windows I just added C:\Users\[your username]\AppData\Local\Android\Sdk\platform-tools to my PATH variable.

Step 15 Run the adb commands from the directory, where you have extraced frida-server to:

adb root
adb push frida-server /data/local/tmp/
adb shell "chmod 755 /data/local/tmp/frida-server"
adb shell "/data/local/tmp/frida-server &"

(press CTRL+C, this will not stop the server)

Step 16 Download the ldvwifi apk that FrancYescO mentioned: https://m.allfreeapk.com/ledvance-smart-wifi,17068539/download.html.
EDIT: Link is broken now. You may want to look at hints here: https://community.home-assistant.io/t/howto-ledvance-smart-plug-wifi-in-home-assistant-solution/350280?u=flag

Step 17 Run from the same directory where you have downloaded com-ldvsmartwifi-smart-1.apk:

adb install com-ldvsmartwifi-smart-1.apk

Step 18 At this point you have an emulated rooted device with frida-server and the old LEDVANCE SMART+ WiFi Apk installed. Now you can do the last steps that are mentioned by FrancYescO (no macos is needed):

login to the app on the android device, than on macos launch this command with the app in foreground frida-trace -U --decorate -j '*!*encodeString*/isu' -F, refresh the list of device and you will get on the terminal a json-like blob, copy in a text editor and ctrl+f for localKey (oviusly if you have more than one device you will get multiple keys, also if you configured any group in the app)

Hint for windows users: If the last command outputs Started tracing 0 functions. Press Ctrl+C to stop., you should try it in powershell or in cmd.exe without quotes (frida-trace -U --decorate -j *!*encodeString*/isu -F). If it is sucessfull it should trace 2 functions.

10 Likes