Closed sandervankasteel closed 4 years ago
Would love to see support as well. Currently, I’ve had luck with their smart bulbs but the LED strips are not working unfortunately.
Most devices work when you register them in the SmartLife or Tuya app. The LSC app is basically a rebranded version.
A hours after my issue post, I found an "old" (last updated Jan 2018) reverse engineering attempt of the Tuya API (https://github.com/Ericmas001/Tuya-Api-Tools/wiki/Requests), after some poking, prodding, coffee, headbanging, facepalming, more reverse engineering and some initial POC work I decided to drop my effort of adding support of this API to anything.
My reasoning behind this is mostly two parts. The Tuya API is way too over engineered, unnecessarily complex and secondly, there are so many changes between the initial reverse enigeering attempt from Ericmas001 and the current version of the API that it would take more time then I would like, to get any code towards a level where it's "usable" and that doesn't factor in any changes Tuya does on their API which can completely undermine any effort from my part.
The thing I am mostly afraid of, is their (completely unnecessary) obfuscation of the values which their API requires and changes in said obfuscation.
For example, just checkout what you need to access their MQTT server(s), it's just a mess unfortunately :(
What also doesn't help is that I flashed Tasmota on my LSC branded device using Tuya-convert yesterday.
Yep, you found their OEM API. It's very different compared to API they created specially for HA and unsuitable for our case. Just check how to get credentials to authorize https://github.com/codetheweb/tuyapi/blob/master/docs/SETUP.md :man_facepalming: .
Hi,
I have a few questions about adding support for LSC Smart Connect. LSC Smart Connect is a Dutch brand which uses the Tuya eco-system. However, I tried to get it to work with this Python library, but couldn't. Then I tried to tried to figure out why it didn't work out, by using a MITM proxy with an Android emulator and I found the following things;
The hostname which is being used is
https://a1.tuyaeu.com
instead ofhttps://px1.tuyaeu.com
.The login procedure is completely different. First it does an API call to
https://a1.tuyaeu.com/api.json
with some extra URL parameters such as anappVersion
appRnVersion
,lang
and some other environment variables such as Android version, phone number. The body that is being POSTed only contains the following JSON blob;Then the server will followup with the following JSON response
After this call, the final authentication call is being done with the following JSON blog being POSted;
{ "result": { "accountType": 1, "dataVersion": 1, "domain": { "aispeechHttpsUrl": "https://aispeech.tuyaeu.com", "deviceHttpUrl": "http://a.tuyaeu.com", "deviceHttpsPskUrl": "https://a3.tuyaeu.com", "deviceHttpsUrl": "https://a2.tuyaeu.com", "deviceMediaMqttUrl": "s.tuyaeu.com", "deviceMediaMqttsUrl": "ms.tuyaeu.com", "deviceMqttsPskUrl": "m2.tuyaeu.com", "deviceMqttsUrl": "m2.tuyaeu.com", "gwApiUrl": "http://a.gw.tuyaeu.com/gw.json", "gwMqttUrl": "mq.gw.tuyaeu.com", "httpPort": 80, "httpsPort": 443, "httpsPskPort": 443, "mobileApiUrl": "https://a1.tuyaeu.com", "mobileMediaMqttUrl": "s.tuyaeu.com", "mobileMqttUrl": "mq.mb.tuyaeu.com", "mobileMqttsUrl": "m1.tuyaeu.com", "mqttPort": 1883, "mqttsPort": 8883, "mqttsPskPort": 8886, "pxApiUrl": "http://px.tuyaeu.com", "regionCode": "EU" }, "ecode": "some_code", "email": "my_email@domain.tld", "headPic": "", "improveCompanyInfo": false, "mobile": "31-phonenumber", "nickname": "my_nickname", "partnerIdentity": "p1294949", "phoneCode": "31", "receiver": "31-phonenumber", "regFrom": 0, "sex": 0, "sid": "some_id", "snsNickname": "", "tempUnit": 1, "timezone": "", "timezoneId": "Europe/Amsterdam", "uid": "my_user_id", "userType": 1, "username": "my_email@domain.tld" }, "status": "ok", "success": true, "t": 1571577603205 }