Hi
Thanks for the info, I am currently trying to get my LEDVANCE lightbulbs added to Local Tuya
I tried running the script(print-local-keys.py)
I am getting an InvalidAuthentication exception, I am 100% sure the username and password is the same as the LEDVANCE app ones, am I missing something?
I even created a new account to make sure there is no confusion with the LEDVANCE tuya credentials and the smart life ones I also have.
Am I correct if I understand that the Tuya details in the const.py file remain unchanged?
Thank you in advance for any help!
UPDATE:
It looks like the latest version of the LEDVANCE app uses different credentials than the old version
I installed an older version and had to register again there with the same email account.
Now when I run the script I get āNoneTypeā object is not iterable, because the response is empty(I couldnāt add any of my devices on the old app)
This looks like bad news for using theses devices with LocalTuya in the future.
I think maybe @Flag can chime in here, and spread some knowledge, I havenāt had any issues.
I have updated the sync_tuya_keys.py with my user/pass, I set the TUYA_COUNTRY_CODE in const.py and updated my user / pass in print-local-keys.py
I think the NoneType object error you get, is because you do not have any devices registered on your account.
It could be possible that Ledvance enforces a newer API version on newer accounts.
Iām getting this error and canāt find any way to change it. Changed region and country code in the code but nothing. Does any other method still work?
Hey @DrGadorcha, I ran into the same error. However, I solved it just by updating in pyscript_modules/tuya/const.py file, the TUYA_ENDPOINT variable, the value https://a1.tuyaeu.com/api.json , if you are living in some Europe region that value is just fine, but If you are living in the States or South America, you should change the previous value to https://a1.tuyaus.com/api.json Notice it that you need only to update a1.tuyaus.com subdomain, and thatās all.
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.
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:
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.