HowTo - Ledvance SMART+ Plug Wifi in Home Assistant (Solution)

Hello,
got a very good offer and now i have 15 Ledvance SMART+ Plugs with Wifi. After long search i know how the plugs were so cheap. I tried so much ways to get these plugs in HA but every try failed.

But now i have found the right solution with some hints from me, you can feel the same success :slight_smile:

Follow these Steps and dont look to the tutorials above this topic! Look at my hints to these steps!!!

Hints:
The Link to the old ledvance app is broken.
Try this Link or search for
LEDVANCE SMART+ WiFi 1.0.0 APK

Please look at the url - there must be the ā€œoriginal-downloading.htmlā€. All others are malware or so.
The downloaded app named com-ldvsmartwifi-smart-4.apk
https://www.luckymodapk.com/ledvance-smart-wifi-mod/com.ldvsmartwifi.smart/original-downloading.html

a. Use the powershell in wodows, not the command line (commend line makes some problems)
b. in Step 6 you have to setup the Android Image. Here are some more steps, which are not in this description. Download the image an click in every window ā€œNextā€ or ā€œFinishā€ until you see the picture in Step 8.
c. Step 12. Download the linked Frida Server 15.0.17 and no other version. With some other i had problems.
d. Step 15. After setup adb. please run

adb root

in the powershell .
after that run:

adb shell

and you will get theese message :generic_x86_arm:/ # . If there is a # in the end. You are in root modus and you will not get a failure message in step 15 after last commend.

e. Before you go to step 18. Find all device with your Ledvance App on your smartphone. So you must trace only one time. Then install and start the App (link below) on your emulated Android. Log in and you will see all your devices.
f. Step 18. If you start tracing with the frida server - you have to refresh the list with device in the app more than one times. Refresh with Pull down the list with mouse. After first refresh you get some data, but no keys in the powershell window. After the second refresh, i got all devices with device id and localkeys in a long string.

Copy the complete content from powershell into texteditor or a programm were you can search.

Open Ledvance App on your smartphone and click on a plug ā†’ goto settings ā†’ information about device and you will see the device id. search in your list for your device id . after second or third you will see a position in the string named localkey. This is your Key. Copy that and search for the next device id.

In Local Tuya. Use Switch and following id.

Id - 1 (value: True)
Friendly Name: YourPlugName
Current: 18
Current Consumption: 19
Voltage: 20

After Saving there is a window with a binary sensor - click Next/Finish and then set the room an cklick Finish.

Update for showing consumption of the plugs:
I created a new ledvance.yaml and imported this in the configuration.yaml .
Here are 2 Plugs with sensors for current consumption, current and voltage.
You can copy and paste this for more plugs.

# Ledvance Ledvance SmartPlug 01
- host: 192.168.xxx.xxx
  device_id: DEVICEID_PLUG_01
  local_key: LOCALKEY_PLUG_01
  friendly_name: Ledvance SmartPlug 01
  protocol_version: "3.3"
  entities:
    - platform: binary_sensor
      friendly_name: SmartPlug Status 01
      id: 1
      device_class: power
      state_on: "true"
      state_off: "false"
    - platform: switch
      friendly_name: smartplug_switch_01
      id: 1
    - platform: sensor
      friendly_name: SmartPlug Current 01
      id: 18
      unit_of_measurement: "mA"
    - platform: sensor
      friendly_name: SmartPlug Current Consumption 01
      id: 19
      scaling: 0.1
      unit_of_measurement: "W"
    - platform: sensor
      friendly_name: SmartPlug Voltage 01
      id: 20
      scaling: 0.1
      unit_of_measurement: "V"

# Ledvance Ledvance SmartPlug 02
- host: 192.168.xxx.xxx
  device_id: DEVICEID_PLUG_02
  local_key: LOCALKEY_PLUG_02
  friendly_name: Ledvance SmartPlug 02
  protocol_version: "3.3"
  entities:
    - platform: binary_sensor
      friendly_name: SmartPlug Status 02
      id: 1
      device_class: power
      state_on: "true"
      state_off: "false"
    - platform: switch
      friendly_name: smartplug_switch_02
      id: 1
    - platform: sensor
      friendly_name: SmartPlug Current 02
      id: 18
      unit_of_measurement: "mA"
    - platform: sensor
      friendly_name: SmartPlug Current Consumption 02
      id: 19
      scaling: 0.1
      unit_of_measurement: "W"
    - platform: sensor
      friendly_name: SmartPlug Voltage 02
      id: 20
      scaling: 0.1
      unit_of_measurement: "V"

Bye.
Keules

10 Likes

Can you use iot.tuya.com, create a new project and attach your account there and get device IDs?

In iot.tuya.com you get the error, that the device is not supported.

The Devie ID is seen in the Ledvance App. Click on a device then the Button for Edit (top-right) and then cklick on ā€œinformation about deviceā€ or so. In German its another name. There you can find the device Id.

So it requires a machine running an android emulator, right?

yes. its in Android Studio. Follow the Steps and then you will have success. i tried so long to get my plugs in HA, but this was the only way.
My Problem this time is to see my energy consumption.

Iā€™ve got the emulator, app, and frida up and running but I cant get my devices added in the emulator. I must be doing something super simple wrong, but canā€™t figure it out. Should I be putting my wifi info in on app in the emulator?

EDIT: I spaced that I was using the sylvania bulbs and ended up using Sylvania app to get it to work.

1 Like

Hi Keules and thank you for the instruction, it helped a lot.
I got myself some plugs for very small money.
Did you maybe manage to get the consumption information?
that would be great :slight_smile:

Thanks Keules! I got the power plug already last year and was afraid I was never going to use it, but now I managed to link it :slight_smile:

Hello,

yes i found a script for the energy consumption. In local tuya configuration there are no sensors for voltage etc.

Can somebody show me a good tutorial, how i can save the consumption in a database and create a summary of the plug and a summary of all plugs/energy consumtions? I can see only the actual consumption. Thank you.

i made a new ledvance.yaml and imported this file in my configuration.yaml .
Here my script for two plugs.

# Ledvance Ledvance SmartPlug 01
- host: 192.168.xxx.xxx
  device_id: DEVICEID_PLUG_01
  local_key: LOCALKEY_PLUG_01
  friendly_name: Ledvance SmartPlug 01
  protocol_version: "3.3"
  entities:
    - platform: binary_sensor
      friendly_name: SmartPlug Status 01
      id: 1
      device_class: power
      state_on: "true"
      state_off: "false"
    - platform: switch
      friendly_name: smartplug_switch_01
      id: 1
    - platform: sensor
      friendly_name: SmartPlug Current 01
      id: 18
      unit_of_measurement: "mA"
    - platform: sensor
      friendly_name: SmartPlug Current Consumption 01
      id: 19
      scaling: 0.1
      unit_of_measurement: "W"
    - platform: sensor
      friendly_name: SmartPlug Voltage 01
      id: 20
      scaling: 0.1
      unit_of_measurement: "V"

# Ledvance Ledvance SmartPlug 02
- host: 192.168.xxx.xxx
  device_id: DEVICEID_PLUG_02
  local_key: LOCALKEY_PLUG_02
  friendly_name: Ledvance SmartPlug 02
  protocol_version: "3.3"
  entities:
    - platform: binary_sensor
      friendly_name: SmartPlug Status 02
      id: 1
      device_class: power
      state_on: "true"
      state_off: "false"
    - platform: switch
      friendly_name: smartplug_switch_02
      id: 1
    - platform: sensor
      friendly_name: SmartPlug Current 02
      id: 18
      unit_of_measurement: "mA"
    - platform: sensor
      friendly_name: SmartPlug Current Consumption 02
      id: 19
      scaling: 0.1
      unit_of_measurement: "W"
    - platform: sensor
      friendly_name: SmartPlug Voltage 02
      id: 20
      scaling: 0.1
      unit_of_measurement: "V"

You can Copy & Paste more Plugs. I spend so much time before i found the right configuration for the yaml.

Hello guys, I tried these instructions but at the point of tracing the emulated app stops working and i get the error: ā€œFailed to attach: process with pid 9632 either refused to load frida-agent, or terminated during injectionā€
Did I maybe download the wrong akp? The ā€œnewerā€ Links was still working and I got the file ā€œcom-ldvsmartwifi-smart-4.apkā€
Any ideas?

EDIT: I just checked in the emultor that the app seems to be verison 1.2.0 and not 1.0.0 as claimed in the beginning. I found online the version 1.1.0 but that did not work eihter.
So maybe someone can provide the actual 1.0.0 version of the apk?

please read my hints in my solution, there is the link to the 1.0.0 Version. try the Steps and read my solution for several steps, then you will have success.

Just wanna add how I resolved it:
type: adb shell
type: ps -e | grep frida-server
output: root 12483 1 57724 4112 poll_schedule_timeout e8889b39 S frida-server
type: kill -9 12483
type: exit
go back to step 15
in step 18 when the frida server wont stat, i typed ā€œexitā€ and then again

frida-trace -U --decorate -j *!*encodeString*/isu -F

then it worked saying ā€œInstrumentingā€¦ā€

1 Like

after the command: 'adb shell ā€œ/data/local/tmp/frida-server &ā€ ā€™ i get the error: ā€˜/data/local/tmp/frida-server: not executable: 32-bit ELF fileā€™ any solution ?
Iā€™m on the Mac. everything else is working
fixed: used frida-server-15.1.14-android-arm64

Always get Started tracing 0 functions :frowning:

Ah, @mastergizmo presented a solution here

Dear @Keules,

Thank you for the excellent tutorial!

These are my very first steps with HA. But Iā€™ve managed to get the IDs and connect the plugs to HA. Only as a simple switch though, without energy consumption monitoring. Iā€™ve made a few guesses how to integrate ledvance.yaml to configuration.yaml, but all unsuccessful. I do something wrong, as it breaks the configuration.yaml.
Could anyone please share a hint how to import ledvance.yaml? Thank you in advance.

EDIT: If I manage to enable energy monitoring, then the switch breaks. HA wouldnā€™t allow to use ID 1 for both: binary_sensor and switch.

Hello @Keules and gang.

This really is an excellent tutorial but there are so many variables including knowledge that this should be turned into some sort of utility and integration. Ledvance is soooo much more inexpensive and locally available that it would just make sense for someone SMART+ to do this.

I am having problems getting the ADB to stay up on my machine for whatever reason which is what I think is generally my problem. Should I reinstall the development platform?

Appreciate any help or assistance.

Frank

Hi all,

at first, thank you for the great tutorial.
Iā€™m new to HA and was happy to find a way to add my Ledvance Wifi Plugs.
BUT i got stuck on the part were i have to trace.

PS D:\> frida-trace -U --decorate -j *!*encodeString*/isu -F
No frontmost application on Android Emulator 5554

I always get this message. One strange thing, on step 15 everytime i try the last command i get this message

generic_x86_arm:/ # /data/local/tmp/frida-server &
[1] 9856
generic_x86_arm:/ # /system/bin/sh: /data/local/tmp/frida-server: can't execute: Is a directory

Maybe this is my issue?

To be sure i have checked the app version of ledvance and it is 1.2.0
I used the URL here from this post. Name is the same but it will install 1.2.0 instead of 1.0.0

Another possible source for the issue?

I also tried to use another frida server version like told by jjuuzzii. Also no chance.

Has some one else any ideas?

Regards
Umbra

Hi @UmbraLamia,

I have the same problem exactly. I am also interested in a solution.

@Flag Appreciate any advice.

Any chance to create a custom integration?

Frank

Hi @Flag, @UmbraLamia, @Keules;

I finally got mine working. Iā€™ve attached a what I did.

frida-server-15.0.17-android-x86.xz
com-ldvsmartwifi-smart-4.apk

Python13.10.2
Win10 64
Android Studio Bumblebee | 2021.1.1
Build #AI-211.7628.21.2111.8092744, built on January 19, 2022

These commands really need to execute. If they donā€™t, try rebooting your computer:

C:\Users\fspat\Downloads\Frida>adb root
restarting adbd as root

C:\Users\fspat\Downloads\Frida>adb push frida-server /data/local/tmp/
frida-server: 1 file pushed, 0 skipped. 113.2 MB/s (46351796 bytes in 0.390s)

C:\Users\fspat\Downloads\Frida>adb shell ā€œchmod 755 /data/local/tmp/frida-serverā€

C:\Users\fspat\Downloads\Frida>adb shell ā€œ/data/local/tmp/frida-server &ā€
(waited 10 seconds or so)
^C
C:\Users\fspat\Downloads>adb install com-ldvsmartwifi-smart-4.apk
Performing Streamed Install
Success

C:\Users\fspat\Downloads>frida-trace -U --decorate -j *!encodeString/isu -F
Instrumentingā€¦
MMKV.encodeString: Auto-generated handler at ā€œC:\Users\fspat\Downloads\handlers\com.tuya.smart.mmkv.MMKV\encodeString.jsā€
ByteString.encodeString: Auto-generated handler at ā€œC:\Users\fspat\Downloads\handlers\okio.ByteString\encodeString.jsā€
Started tracing 2 functions. Press Ctrl+C to stop.

This is when the ā€œblobā€ or ā€œbloobā€ or long string gets returned. Copy and paste into a text editor and look for the localkey(s).

Good luck and thanks for all the previous work. Without which, I would have never gotten this completed! :slight_smile:

Frank