tuya / tuya-home-assistant

Home Assistant integration for controlling Powered by Tuya (PBT) devices using Tuya Open API, maintained by the Home Assistant Community and Tuya Developer Team.
MIT License
879 stars 207 forks source link

Add WAFU Smart Electronic Lock (Deadbolt) #38

Open steve-tapgen opened 3 years ago

steve-tapgen commented 3 years ago

Any chance you guys can add integration for the Wafu deadbolt?

{ "result": { "active_time": 1625072247, "biz_type": 18, "category": "ms", "create_time": 1624989601, "icon": "smart/icon/bay1605170594678IbeH/fad5891225b6191bb2563d6deac53c87.jpg", "id": "66074035e868e76ce739", "ip": "1.1.1.1", "lat": "xxx", "local_key": "xxx", "lon": "xxx", "name": "Deadbolt", "online": true, "owner_id": "xxx", "product_id": "gj9eyv7lvtinjvui", "product_name": "HANDLOCK CERRADURA ELECTRICA INVISIBLE", "status": [], "sub": false, "time_zone": "-05:00", "uid": "az162507203720968Onq", "update_time": 1625074389, "uuid": "66074035e868e76ce739" }, "success": true, "t": 1625161200110 }

I see category "ms" is not yet supported, I'm a developer perhaps I can integrate it myself? If so any documentation or example integrations so I can start?

Thank you, Steve

tsutsuku commented 3 years ago

@steve-tapgen You can read this doc https://github.com/tuya/tuya-home-assistant/wiki/How-to-develop-a-new-driver.

tsutsuku commented 3 years ago

Here is the lock's instruction set https://developer.tuya.com/en/docs/iot/f?id=K9i5ql58frxa2

You are welcome to create a PR about the lock.

steve-tapgen commented 3 years ago

Thanks for the insight, it seems this lock is quite different than the standard docs.

device status gives: { "code": 2003, "msg": "function not support", "success": false, "t": 1625409085804 }

if I query for functions: { "code": 2009, "msg": "not support this device", "success": false, "t": 1625409203094 }

In the HA logs it says for specifications same thing: 2021-07-03 21:33:02 DEBUG (SyncWorker_0) [tuya iot] Request: method = GET, url = https://openapi.tuyaus.com/v1.0/devices/66074035e868e76ce739/specifications, params = None, body = None, headers = {'client_id': 'xxx', 'sign': 'aaa', 'sign_method': 'HMAC-SHA256', 'access_token': 'aaa', 't': '1625362382146', 'lang': 'en'} 2021-07-03 21:33:02 DEBUG (SyncWorker_0) [tuya iot] Response: { "code": 2009, "msg": "not support this device", "success": false, "t": 1625362382234 }

I've tried running various commands from the documents, along with smart lock documents.

The only success I've had is using TuyAPI where it lists the dpIds: { devId: '66074035e868e76ce739', dps: { '15': 2, '101': true } }

The dpsid 15 is a counter how many times the lock has been opened.

I can set the dpsId 101 to false and true to open and close the lock: device.set({dps: 101, set: locked})

However I can't seem to find what functions these dps is to call using the cloud api.
Is there any way to directly set the dpsid's instead of sending commands in the code?
Is there a way to trace what commands the Smart Life application is sending to the API?

Thank you, Steve

tsutsuku commented 3 years ago

@steve-tapgen The device specifications need to standardize, we will fix it soon. After that, you can develop on it.

freitas666 commented 3 years ago

@tsutsuku i will use this topic to not create another...

Actually i have a smartlock... and get the information on log.

So i saw the ""category": "ms","

My ask is...if exist possibility to create a archive to put this smartlock there? the model is: X2

tsutsuku commented 3 years ago

@freitas666 You mean to develop a lock driver or something else?

freitas666 commented 3 years ago

Yes a lock driver... Its possible? Could you help me?

Enviado do meu iPhone

Em 6 de jul. de 2021, à(s) 03:43, tsutsuku @.***> escreveu:



@freitas666https://github.com/freitas666 You mean to develop a lock driver or something else?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/tuya/tuya-home-assistant/issues/38#issuecomment-874502581, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAQ7DLWL6C5H2BLA2IKAQH3TWKQXRANCNFSM47VFQWXA.

freitas666 commented 3 years ago

Some idea?

tsutsuku commented 3 years ago

@freitas666 We will consider it.

cq74 commented 3 years ago

Support for these WAFU locks would be really great.