Control LSC Smart Connect Outlet via Homekit

In a Dutch store called “Action” you can buy cheap home automation devices. They have plugs, motion sensors, door sensors, lamps and sirens. The devices are based on the Tuya Smart platform and are branded as LSC Smart Connect, with their own whitelabeled app. They work perfectly, but because of this hard- and software setup, they rely on the Chinese cloud solution provided by Tuya which I don’t like from a privacy perspective. The device are controlled via the cloud and expose unnecessary data beyond the ability for their core function.

That’s why I am more of a fan of Homekit, as only a single device is in control of the home automation with a better privacy approach in mind.

The devices of LSC do not support Homekit, but luckily there is a Homebridge plugin available that allows you to control the hardware via Homekit in possible private way: homebridge-tuya-lan

One important thing is that you install version 1.5.0-rc.12 of the plugin, else the logic won’t work because you need to know the specific ID and key of the device. But the key is something that is only assigned after you’ve registered the device in the cloud. So for this you need to set it up once via the standard procedure, but you’ll have to listen on the line while doing so.


Retrieve identifiers for LSC Smart Connect devices

So to get the ID and Key you need to execute the following steps:

  • Install and run Charles Proxy on your laptop to be able to intercept traffic
  • Look up the local IP address of your laptop, we need to set this up on our phone
  • When the phone is on the same network, enable proxy settings using the IP you just looked up and port 8888
  • Browse to chls.pro/ssl on your phone to install the special certificate provided by Charles
  • Browse to https://a1.tuyaeu.com on your laptop, it won’t show anything
  • Look up the log entry of this URL in Charles and enable SSL decryption for this domain
  • Install the LSC Smart Connect app on your phone
  • Use a fake email service like tempmail to register for the app
  • Now you should have the setup for intercepting the data up and running

You can now start adopting the device you bought the standard way in the app. While adopting the device check the log entries in Charles and look for something similar like this URI.

https://a1.tuyaeu.com/api.json?bizDM=device_config_add&lang=nl&time=158541079

The response on that URL is a JSON structure where the ID and key of the device can be found. The ID can be found is id and uuid, the key can be retrieved via the localKey item.

{{ "result": { "errorDevices": [], "successDevices": [{ "pv": "2.2", "cadVer": "", "icon": "smart/icon/ay1541056239985fDGjj/81fd7e7461b264fe03ac55812bb3de6f.png", "verSw": "1.1.5", "isOnline": false, "lon": "", "isActive": true, "uuid": "00000123456789abcdef", "accessType": 0, "uid": "eu1578860684447z3VXI", "bv": "5.45", "homeKit": false, "ability": 0, "iconUrl": "https://images.tuyaeu.com/smart/icon/ay1541056239985fDGjj/81fd7e7461b264fe03ac55812bb3de6f.png", "id": "00000123456789abcdef", "lat": "", "runtimeEnv": "prod", "productId": "cuhokdii7ojyw8k2", "activeTime": 1585410796, "ip": "127.0.0.1", "gwType": "s", "port": 48718, "name": "Smart Plug-EU", "time": 1585410796, "localKey": "0123456789abcdef" }] }, "t": 1585410797616, "success": true, "status": "ok"}

You’re now ready to setup the config.json of homebridge.

{
 "platform": "TuyaLan",
 "devices": [
 {
  "name": "Livingroom lamp",
  "type": "Outlet",
  "manufacturer": "LSC",
  "model": "Smart Power Plug",
  "id": "00000123456789abcdef",
  "key": "0123456789abcdef"
 }
}

And your … almost … done

After this setup you’re good to go and can control the outlet via Homekit.

But, you’re not there yet! Every device is just a standard wifi enabled device which will have the ability to ‘phone home’. I just block that by assigning the device a static IP in a range which I don’t allow outbound traffic on.

Via this way I’m able to control various LSC Smart Connect devices in a cheap and private way!

Tagged as: ,
No comments yet.

Leave a Reply