Just added my new under cabinet light successfully using local tuya. Unfortunately, the only thing I can do is turn it on/off, there’s neither an option to change brightness nor the color temperature. Did I do something wrong or is it simply not supported yet?
Via the ledvance app I can change brightness and color temperature easily.
It is not all stuff that can be controlled unfortunately, I’ve had some success with experimenting with the different fields in the tuya integration.
Hey,
do I need to create a cron-task to update the keys automatically?
Hello! I’m stuck at inserting my password into the python script. The script looks different from the one shown on the YouTube video, probably because it’s a newer version. I tried two places, lines 21 and 22, and the line 28. Neither worked (unless there was some other problem). The first one gave the error message “ModuleNotFoundError: No module named ‘Crypto’” (I have pycryptodome installed), the second one gave “SyntaxError: invalid imaginary literal”. Here’s the current version of the script:
#!/usr/bin/env python3
import getpass
from typing import Tuple
from pyscript_modules.tuya.api import TuyaAPI
from pyscript_modules.tuya.exceptions import InvalidAuthentication
def get_login() -> Tuple[str, str]:
def ask_until_ok(fn) -> str:
while True:
try:
return fn()
except KeyboardInterrupt as e:
print("Aborted.")
raise
except:
pass
print()
return (
ask_until_ok(lambda: input("Please put your Tuya/Ledvance username: ")),
ask_until_ok(lambda: getpass.getpass("Please put your Tuya/Ledvance password: "))
)
def main():
username, password = get_login()
api = TuyaAPI(username, password)
try:
api.login()
except InvalidAuthentication:
print("Invalid authentication.")
exit(1)
except Exception as e:
print(f"Unexpected error: {e}")
print('---------------------------')
for group in api.groups():
for dev in api.devices(group['groupId']):
print(f'device name:\t{dev.name}')
print(f'device id:\t{dev.id}')
print(f'local key:\t{dev.localKey}')
print('---------------------------')
input("Press Enter to continue...")
if __name__ == "__main__":
main()
I got the above problem solved, and also a bunch of others, so now I have my Ledvance Sun@Home led spots installed and working in Home Assistant . The effort must have taken a few months away from the length of my life, though. I’m still recovering mentally… I hope Home Assistant at some stage becomes available as a normal program, so that there’s no more need to learn to use containers. After trying so many different things, I actually don’t know exactly how I ultimately got the container to work. Of course it would be nice to get Ledvance lights to work with Home Assistant without all the other tricks that it currently takes. Anyway, it’s great that some people have seen the trouble to make it work for the rest of us. Thanks fribse for the helpful video!
I found an instruction on Reddit to fill in certain brightness and colour temperature values when adding lights as entities to Home Assistant. The suggested value for brightness is 22 and for colour temperature 23. That helped me, and now both settings work on my installation. The thread is here:
The actual values come from this page:
Hi, I’m quite new to HA.
One important thing is that I want to add my Ledvance devices (RGB strips and switching sockets) to HA.
When I perform the steps above and disconnect the devices from the original cloud, I assume that they are not useable in the original ledvnace app anymore, right?
Background is that I’m uncertain on the handling of these devices via HA. Which means I’m uncertain on the WAF (woman acceptance factor). And if the WAF is too low I cannot use HA to control the devices.
Hi ThomasHo
Well, LEDVANCE is a cointoss, they refuse to open up integration, so you could try this.
If you get it to work, it’s solid, if it doesn’t work it could be because of firmware updates of the bulbs.
I have three LEDVANCE running here, no issues what so ever.
Heya,
I’m currently trying to get this working.
The print_local_keys script gives me these values:
device name, device id, local key
Whereas the local tuya integrations is asking for:
Client ID, Secret, User ID
Does anybody know the correct mapping ? Which value goes where ?
Nevermind, in case anyone’s interested: I ended up using this PR of the local tuya component which works quite good. I hope the PR will eventually make it into the official integration.
GUI Setup NOW works great with - Ledvance Cloud Integration! (multiple Devices)
**NO NEED of Python to grab and local-keys!! **
I’ve Tested with Bulb and Led!
I’v Used This REPO: GitHub - avataar/localtuya at oem-cloud-ledvance
Did the auto-discovery work for you or did you had to add the lamp manually?
I’m trying to connect to the Tuya Iot with Ledvance but I can’t find the 2D code reader in the app.
Should it be done with Smart Life app? In the Smart Life app i’m not able to connect the Ledvance wifi plug. So I’m missing the whole User ID also.
I’m very new to the whole HA so let me know if i’m missing something.
How do you solve the missing Crypto? pip install Crypto
seems not help
Did you get a solution?
This method isn’t working with the Ledvance Smart+ app, since you cannot scan the QR code in the developer account to link it and get the local keys.
EDIT:
I got it to work. My error was the installation.
Copy/paste Github link into custom repositories of HACS doesn’t work.
Somehow HACS installs the other version (not the forked one).
So, download the folder of the fork and add it manually (using VSCode or similar) to the custom_repositories folder. Then restart HA.
Hi, how did you do it without local-keys?
Could you please explain it step-by-step?
EDIT:
Got it resolved.
See my edit in the other comment.
Update for March 2024:
I bought yesterday LEDVANCE SMART+ WiFi Tube T8 and spent several hours trying to connect it to Home Assistant. Steps 1-5 were trivial.
The challenge met me at the step 6. local-tuya was not able to discover the lights. And if I tried to add it manually, I got: " Connection to device succeeded but no datapoints found, please try again."
The reason is that local-tuya does not support the protocol 3.5 which is the only protocol which my latest and greatest LEDVANCE tube understands.
Solution: use tuya-local instead of local-tuya.
tuya-local: https://github.com/make-all/tuya-local
To debug issues with LEDVANCE appliances you can use: https://github.com/jasonacox/tinytuya This is a python library which implements all the tuya APIs and has example scripts. It simplified a lot debugging of the problem for me.
Correct device type for LEDVANCE T8 tubes in tuya-local seems to be rgbcw_lightbulb
Thanks for pointing to tuya-local.
I was able to get my ledvance ceiling fan to work.
I had to create my own device profile to enable the fan but overall the process was quite smooth - except for the fact that I still have the old light switch enabled and one of my kids cut the power while I was trying to set it up. Next on my list is a suitable 2 way switch now …
Thank you for this great guide.
I have also been looking for months to get my T8 tube working without using SmartThings, and this finally works.
Thank you so much.