rospogrigio / localtuya

local handling for Tuya devices
GNU General Public License v3.0
2.87k stars 554 forks source link

Possibility to integrate with LEDVANCE? #556

Open fribse opened 3 years ago

fribse commented 3 years ago

The problem

LEDVance is tuya based, but they have limited the ledvance devices from being linked to Tuya SmartLife. You can only link it to LEDvance's own app. I beleive it's because of some weird GDPR random fear, which really isn't relevant, but nevertheless. So without being able to get it in SmartLife I don't know how to get the local key? Further, it doesn't discover it automatically, not sure why...

Environment

Steps to reproduce

1.

Configuration configuration.yaml or config_flow

DP dump

Provide Home Assistant taceback/logs

Additional information

Panadu2 commented 2 years ago

Look here: I added 15 Ledvance Plugs with Wifi in my HA.

https://community.home-assistant.io/t/howto-ledvance-smart-plug-wifi-in-home-assistant-solution/350280/3

IeuanK commented 2 years ago

Look here: I added 15 Ledvance Plugs with Wifi in my HA.

https://community.home-assistant.io/t/howto-ledvance-smart-plug-wifi-in-home-assistant-solution/350280/3

That only shows how to get the device ID, not the local keys?

fribse commented 2 years ago

@Panadu2 It's not a solution, it's a workaround that requires a big setup, and not for the faint hearted. It's nice that you got it working, but can't be considered a solution for the broad public. It's still a 'non integratable light' in respect to HA.

IeuanK commented 2 years ago

I ended up going with Frida server to get the device keys: https://gist.github.com/IeuanK/26c16639166e5f7e55f890673c120185

Once I did the above, I had to close out of the LEDVANCE app for localtuya to be able to connect. Once it gets connected it doesn't matter, but it seems that a handshake happens on first connection or on verifying the connection that gets messed up if both try at the same time.

This was one of very few solutions that worked for me, even on MacOS.

fribse commented 2 years ago

@leuanK

I ended up going with Frida server to get the device keys: https://gist.github.com/IeuanK/26c16639166e5f7e55f890673c120185

Does it have to be on an android device, or can I use a normal linux? Do you know of a way to use a Proxmox server for running an android client that can be used to getting the local key?

IeuanK commented 2 years ago

@leuanK

I ended up going with Frida server to get the device keys: https://gist.github.com/IeuanK/26c16639166e5f7e55f890673c120185

Does it have to be on an android device, or can I use a normal linux? Do you know of a way to use a Proxmox server for running an android client that can be used to getting the local key?

You need the LEDVANCE app running on an Android app or inside an Android emulator (with an image that does not have the Play Services). You could try https://www.android-x86.org/ using the VirtualBox guide (but then using Proxmox instead of VirtualBox) for that, but the performance will likely not be great.

FlagX commented 2 years ago

Hey! I did a proof of concept and got the local keys via python script: https://github.com/FlagX/ha-ledvance-tuya-resync-localkey