Sylvania Smart+ WiFi

You need to register on Tuya’s site as documented.

Hmmm. Not sure what I’m missing. I followed the steps in the setup.md. I have an account, I have a cloud project. I created an app and I have a schema value. I just don’t see where the api key is supposed to be.

Not sure if you’re following different instructions than I did, but see the “Authorization Key” header
image

Is api-key the same thing as Access ID/Client ID? My screen looks exactly the same as yours with just different values.

how exactly did you manage to get bulbs to link with tuya-cli?

@toastcfh I just followed the directions and used my MacBook with tuya-cli as indicated below:

tuya-cli link --api-key <api-key from Tuya IoT Project> --api-secret <api-secret from Tuya IoT Project> --schema <schema from Tuya IoT Project> --ssid <2.4GHz SSID to Connect> --password <SSID Password> --region us

The device running tuya-cli has to be on the same network / SSID as the device you are trying to link.

From the directions, I am having difficulties with:

  1. On the same page, click “API Group” on the left side. Change the status to Open for the following three API Groups by clicking “Apply” for each line, entering any reason, and clicking “OK”: “Authorization Management”, “Device Management”, “Device Control”, “User Management”, “Network Management”, “Data Service” and “Device Statistics”. It can take 10-15 minutes for these changes to take effect.

Here is what I see for step 3/4:

I will be starting fresh as these may just be due to a previous attempt to link
Any help is appreciated :slight_smile:

Could only post one image here is the Service API section:

I am having difficulties setting all this up.

my limitations appear to stem from my inability to add the sylvania app to my tuya IoT. This would be fine if i could use the smartlife or tuya app to add my bulbs. but my bulbs will not pair with those apps. IDK if sylvania locked it out, but what i need is the get the local keys from my bulbs. I can see the device IDs but without being able to add the devices in Tuya IoT i an unable to use tuya CLI to retrieve those local keys.

Any help would be appreciated.

I realize that this isn’t going to be an option for everyone because not everyone has a rooted Android Device laying around that they can instrument to grab the keys but just wanted to document another method I recently used to get the Local Keys to control the bulb as the tuya-cli method doesn’t seem to reliably work anymore.

I had an old Nexus 7 2012 Tablet that I loaded with crDroid, rooted and then installed the Sylvania Smart WiFi App. I used the 1.0.0 version of the com.ledvance.smart.wifi. Followed by pairing the bulb with my Sylvania Smart Account so that it was showing in the app.

In order to extract the Local Key I needed to download the latest version of frida-server from Releases · frida/frida · GitHub where I used the frida-server-16.0.11-android-arm.xz version. Extract the file and rename it to frida-server. Make sure you also install the frida-tools on your local machine, I’m using a MacBook Pro and installed the tools with

pip install frida-tools

Connect the Android device to your computer and check to make sure that the device shows in adb:

adb devices
List of devices attached
015d2a50401c0609	device

Once you can see the device then you can push frida-server to it using adb, make it executable and then run it:

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

Once frida-server is running on the Android device open the Sylvania App and make sure you’re logged in and that your Smart Bulbs are paired and showing. If they aren’t paired to the app yet, do that now. Since it’s cloud based you can pair it from any device. Once the device you want the localKey is showing in the app, might need to pull down to refresh then start frida-trace on your local computer keeping the Sylvania Smart App open on the Android Device.

frida-trace -U --decorate -j '*!*getLocalKey' -F

Once the client is running you should see that it Instruments the running application and in my case it traced 9 functions as seen by the following output:

Started tracing 9 functions. Press Ctrl+C to stop.

Now just interact with your bulb in the Sylvania Smart App and frida-trace will spit out the localKey and it will look something like the following:

           /* TID 0xb3a */
  5383 ms  DeviceBean.getLocalKey()
  5383 ms  <= "<localKey>"
  5810 ms  TuyaSmartServerManager.getLocalKey("smart/mb/in/<Virtual ID>")
  5813 ms     | DeviceBean.getLocalKey()
  5813 ms     | <= "<localKey>"
  5814 ms  <= "<localKey>"

That’s it, you can then go into Local Tuya on Home Assistant and add the device manually with the associated Virtual ID and localKey that you now have extracted.

I still mapped the same parameters that I used before when asked by the Local Tuya Integration:

id: 20
color_mode: 21
brightness: 22
color_temp: 23
color: 24
brightness_lower: 10
brightness_upper: 1000
color_temp_min_kelvin: 2700
color_temp_max_kelvin: 6500
scene: 25

Hope this helps people in disconnecting themselves from the Cloud!

4 Likes

Fantastic writeup, going to try this at home assuming one of my older phones still work. Is there a minimum Android version that you are aware of for this to work?

I am not sure if there is an Android Version limitation. I just ran Oreo, 8.1, on my Nexus.

After a couple of evenings I haven’t been able to get it to work. I’m completely certain this is either because of my inexperience or because of the device. For reference I am using a Galaxy S6, when I started it was rooted android 6.0.1 Samsung rom, which is sufficient for the Sylvania app, but after much trial, error, and research I decided this wouldn’t work. I updated to an AOSP based android 9.0 rom and was able to get things running. Or at least I think because I was able to get frida-ps -U to show. However, I am stuck on the frida-trace part and I’m not sure what the issue is at this point. No matter if I use -F or use the apps PID it cannot find the application. Whenever I have some time I might try setting up an Android emulator since I don’t have any rooted devices that are newer than that.

@I_am_rushin I am not sure. It took me a bit to figure out frida and what to search for. The -U tells frida-trace to attach via USB, -d isn’t that important but it adds the module name to the generated onEnter log statement, -j is include Java Method and -F tells it to attach to frontmost application.

I found another article for LEDVance that uses an Emulator setup. Ledvance WiFi bulbs - #13 by Flag. Maybe that will work better.

Hi, I wrote a python script for my Ledvance bulbs and it seems that this also works for Sylvania. I extracted the keys/secrets from the apk and you would have to uncomment those before using the print-local-keys script.

I have no Sylvania devices but I registered and can login via the script at least. It would be great if someone could try this and give me some feedback.

3 Likes

I have several Sylvania Smart+ WiFi bulbs that I would like to modify to be supported by external generic APIs.

These bulbs have an undocumented Saturation adjustment

I notice these bulbs have undocumented support for color saturation – but the official Sylvania Smart+ WiFi app doesn’t support a saturation adjustment.

I’d love to do pastel colors on these bulbs at various brightnesses, such as dim light pinks, light oranges, pale teal, etc.

I originally got a few of these RGB bulbs because they do an excellent 800-lumen CRI 90+ white (unlike many other generic RGB bulbs). They’re practically Hue-quality at 1/3rd price.

If you can trick these bulbs into a 3rd party app, you can gain more color choices by using these bulbs’ undocumented color saturation adjustment support.

I wonder if that was disabled by Sylvania in the official app due to power budget considerations (e.g. amount of power that simultaneously lighting R,G,B will consume). That is easily solved by software-capping the amount of power pr R,G,B, where R+G+B can’t exceed say, 2x or 2.5x a single R or G or B. I can use my Kill-a-Watt to make sure I don’t use things like RGB(255,255,255) that might consume more power than WHITE(255), so I’d do some tests to see what kind of color mixing I can get safely without exceeding the bulb’s power budget. This power safety can easily be Python-scripted in, if necessary.

This is absolutely fantastic! After trying tuya-cli months ago and more recently frida, your script is what finally worked for me. For the record I am using Sylvania, and I am a noob when it comes to anything involving coding, so if I can do this than anyone can. I tried it on 4 bulbs and was successful on 3 of them. I think this maybe due to a newer firmware as I stopped updating some of my bulbs a while back. I have 8 total so I will report back with more results later.

I followed your instructions and the video by the nice Danish gentleman. The only things I had to tweak was setting the country code to 1 and changing the Tuya_Endpoint to a1.tuyaus.com as I am in the USA.

Thank you again for letting me take control of my own devices.

P.S. I have one question though and excuse my ignorance and lack of Danish lol. What is the benefit or purpose of adding resync-local key to Home Assistant?

Glad I could help! The resync script is probably only usefull to me, because I have these bulbs on a wonky switch that triggers the power cylce reset sometimes and this script resyncs and sets all my local keys with one click.
(Before the script I did this 3-4 times for multiple bulbs with the emulator method and got sick of it)

Just wanted to add that I was able to add the problematic lightbulb. Not sure what the issue was, but I removed it from the Sylvania app, reset the bulb, setup in the Sylvania app, and ran the script again.

You are the man! I’ve had 8 of these bulbs for years and got them working with the tuyacli script originally. Over time they lost their configs but the same process would no longer work to get them back in to HA so they sat in box. They are all back in in HA now and it only took 20 minutes to get them all working.