PlusPlus-ua / ha_tuya_ble

Home Assistant support for Tuya BLE devices
MIT License
183 stars 124 forks source link

Drawer lock support #62

Open bjoe10 opened 1 year ago

bjoe10 commented 1 year ago

Hi! I bought this lock:

https://de.aliexpress.com/item/1005005021264715.html?spm=a2g0o.order_list.order_list_main.72.21ef5c5fR1pLLE&gatewayAdapt=glo2deu

I can include it in the BLE integration but it has no entities

image

is there a way to integrate this or is there simply no support for the product?

leonardoleb commented 1 year ago

Hi,

You need to provide infos about your device to add on devices list.

Let me quote PlusPlus-ua instructions,

Next step is to define mapping from Tuya datapoints to HA entities, information which is needed:

  1. category, product_id, product_name. These values could be found in /config/.storage/core.config_entries file or in output of https://github.com/redphx/tuya-local-key-extractor
  2. Names and descriptions of datapoints. It could be obtained on "Device Debugging" page of your "Tuya Cloud Project". Please provide it in format like this: work_mode | Enum | {"range": ["white","colour","scene","music"]}
  3. IDs of all datapoints. Here is an instruction how to obtain it https://www.zigbee2mqtt.io/advanced/support-new-devices/03_find_tuya_data_points.html . Retrive please IDs of all datapoints, even if it is not listed in previous item of the list.
  4. Part of log produced by your device, like this:

2023-05-11 20:09:28.568 DEBUG (MainThread) [custom_components.tuya_ble.tuya_ble.tuya_ble] DC:23:4D:AC:71:AE: Received datapoint update, id: 2, type: DT_BOOL: value: True 2023-05-11 20:09:28.568 DEBUG (MainThread) [custom_components.tuya_ble.tuya_ble.tuya_ble] DC:23:4D:AC:71:AE: Received datapoint update, id: 8, type: DT_ENUM: value: 0 2023-05-11 20:09:28.568 DEBUG (MainThread) [custom_components.tuya_ble.tuya_ble.tuya_ble] DC:23:4D:AC:71:AE: Received datapoint update, id: 9, type: DT_VALUE: value: 75 2023-05-11 20:09:28.568 DEBUG (MainThread) [custom_components.tuya_ble.tuya_ble.tuya_ble] DC:23:4D:AC:71:AE: Received datapoint update, id: 10, type: DT_VALUE: value: 0 2023-05-11 20:09:28.568 DEBUG (MainThread) [custom_components.tuya_ble.tuya_ble.tuya_ble] DC:23:4D:AC:71:AE: Received datapoint update, id: 11, type: DT_ENUM: value: 1 2023-05-11 20:09:28.568 DEBUG (MainThread) [custom_components.tuya_ble.tuya_ble.tuya_ble] DC:23:4D:AC:71:AE: Received datapoint update, id: 15, type: DT_VALUE: value: 0 2023-05-11 20:09:28.568 DEBUG (MainThread) [custom_components.tuya_ble.tuya_ble.tuya_ble] DC:23:4D:AC:71:AE: Received datapoint update, id: 12, type: DT_VALUE: value: 70 2023-05-11 20:09:28.568 DEBUG (MainThread) [custom_components.tuya_ble.tuya_ble.tuya_ble] DC:23:4D:AC:71:AE: Received datapoint update, id: 101, type: DT_BOOL: value: False 2023-05-11 20:09:28.568 DEBUG (MainThread) [custom_components.tuya_ble.tuya_ble.tuya_ble] DC:23:4D:AC:71:AE: Received datapoint update, id: 17, type: DT_BOOL: value: True

bjoe10 commented 1 year ago

1.

    "entry_id": "9d62f09f416a9a5c28368b1fce0b533f",
    "version": 1,
    "domain": "tuya_ble",
    "title": "Drawer lock 907900",
    "data": {
      "address": "DC:23:4F:90:79:00"
    },
    "options": {
      "address": "DC:23:4F:90:79:00",
      "uuid": "f73c01cf71de72d0",
      "local_key": "j5f*WGJ{Zw7{K]@0",
      "device_id": "bf4120pgir88wjcv",
      "category": "jtmspro",
      "product_id": "ahz7wpy9",
      "device_name": "Drawer lock",
      "product_model": "HX201_BLE_LOCKER",
      "product_name": "Drawer lock",
      "endpoint": "https://openapi.tuyaeu.com",
      "auth_type": 0,
      "access_id": "xxxxxxx",
      "access_secret": "xxxxxxx",
      "username": "xxxxxx",
      "password": "xxxxxx",
      "country_code": "49",
      "tuya_app_type": "tuyaSmart"
    },
    "pref_disable_new_entities": false,
    "pref_disable_polling": false,
    "source": "bluetooth",
    "unique_id": "DC:23:4F:90:79:00",
    "disabled_by": null
bjoe10 commented 1 year ago

2. image

bjoe10 commented 1 year ago

image image

bjoe10 commented 1 year ago

3.

{"1":"Add Unlock Method","2":"Delete Unlock Method","3":"Modify Unlock Method","8":"Remaining Battery","19":"Bluetooth Unlock","40":"Lock Status","47":"Lock Status","54":"Sync Access Method","61":"No-Code Unlock (with Key)","62":"Remote Phone Unlock","70":"Configure Verification Code","71":"Bluetooth Unlock (with Verification Codes)","72":"Unlock/Lock Records (with Verification Codes)","73":"Set Remote Unlock (with Verification Codes)"}

alexxx113 commented 1 year ago

download and try to replace "s6amdvmm" with "ahz7wpy9" in all files https://github.com/alexxx113/ha_tuya_ble/tree/main

or wherever there will be "s6amdvmm" insert your DT

bjoe10 commented 1 year ago

can i serch this directly in Home Assistant with Studio Code Server plugin? i cant find "s6amdvmm" in any files

alexxx113 commented 1 year ago

I don't use the "Home Assistant with Studio Code Server plugin" I download to PC and edit in notepad. after editing, I upload it to the server in "config/custom_components". and I reboot the "Home Assistant". or use addon "File editor" or "WinSCP"

bjoe10 commented 1 year ago

I got it to work now and I now also have entities but unfortunately they are all grayed out

alexxx113 commented 1 year ago

Printscreen???

Connect lock app android or ios, not gateway!

Remove lock geteway!

Or delete device app and gateway

Disconect power gateway!

And new connect in app

Turn off bluetooth in device

Add in home assistant.

Reconect battery

bjoe10 commented 11 months ago

i have no brige, i tried the rest.

image

the rest is gray or Unavailable

alexxx113 commented 11 months ago

Your DP repeats s6mdvmm Connection problem Your bluetooth adapter Or repeat the instructions.

delete device app

And new connect in app

Turn off bluetooth in device

Add in home assistant.

Reconect battery

Maybe it won't work the first time