Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request support for NICE DIGI Smart Lock #1714

Closed
dieu opened this issue Mar 6, 2024 · 7 comments
Closed

Request support for NICE DIGI Smart Lock #1714

dieu opened this issue Mar 6, 2024 · 7 comments

Comments

@dieu
Copy link

dieu commented Mar 6, 2024

Log Message

{"8": 100, "32": false, "33": false, "68": "function2", "78": false}
2024-03-05 23:59:57.779 WARNING (MainThread) [homeassistant.util.async_] Detected blocking call to sleep inside the event loop by custom integration 'tuya_local' at custom_components/tuya_local/device.py, line 74: parent=tinytuya.Device(dev_id, address, local_key),, please create a bug report at https://github.com/make-all/tuya-local/issues
2024-03-05 23:59:57.880 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for Test to 3.3
2024-03-05 23:59:58.269 WARNING (SyncWorker_0) [custom_components.tuya_local.device] Test protocol error 901: Network Error: Unable to Connect
2024-03-06 00:00:10.610 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for Test to 3.3
2024-03-06 00:00:10.992 WARNING (SyncWorker_20) [custom_components.tuya_local.device] Test protocol error 901: Network Error: Unable to Connect
2024-03-06 00:00:13.963 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for Test to 3.3
2024-03-06 00:00:14.271 WARNING (SyncWorker_21) [custom_components.tuya_local.device] Test protocol error 901: Network Error: Unable to Connect
2024-03-06 00:00:17.708 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for Test to 3.3
2024-03-06 00:00:18.135 WARNING (SyncWorker_19) [custom_components.tuya_local.device] Test protocol error 901: Network Error: Unable to Connect
2024-03-06 00:00:19.354 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for Test to 3.3
2024-03-06 00:00:19.622 WARNING (SyncWorker_18) [custom_components.tuya_local.device] Test protocol error 901: Network Error: Unable to Connect
2024-03-06 00:01:23.940 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for Test to 3.3
2024-03-06 00:01:24.210 WARNING (SyncWorker_23) [custom_components.tuya_local.device] Test protocol error 901: Network Error: Unable to Connect
2024-03-06 00:01:27.383 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for Test to 3.5
2024-03-06 00:01:37.401 WARNING (SyncWorker_16) [custom_components.tuya_local.device] Test protocol error 914: Check device key or version
2024-03-06 00:02:38.202 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for Test to 3.4
2024-03-06 00:02:43.355 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for Test to 3.4
2024-03-06 00:02:48.579 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for Test to 3.4
2024-03-06 00:02:53.794 ERROR (MainThread) [custom_components.tuya_local.device] Failed to refresh device state for Test.
2024-03-06 00:02:53.794 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for Test to 3.4
2024-03-06 00:03:10.402 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for Test to 3.2
2024-03-06 00:03:12.730 WARNING (SyncWorker_2) [custom_components.tuya_local.device] Test protocol error 901: Network Error: Unable to Connect
2024-03-06 00:03:16.228 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for Test to 3.1
2024-03-06 00:03:16.523 WARNING (SyncWorker_24) [custom_components.tuya_local.device] Test protocol error 901: Network Error: Unable to Connect
2024-03-06 00:03:19.314 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for Test to 3.3
2024-03-06 00:03:19.608 WARNING (SyncWorker_4) [custom_components.tuya_local.device] Test protocol error 901: Network Error: Unable to Connect
2024-03-06 00:03:21.977 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for Test to 3.3
2024-03-06 00:03:22.202 WARNING (SyncWorker_6) [custom_components.tuya_local.device] Test protocol error 901: Network Error: Unable to Connect

Information about DPS mappings

{
  "result": {
    "model": "{\"modelId\":\"e0vfo8\",\"services\":[{\"actions\":[],\"code\":\"\",\"description\":\"\",\"events\":[],\"name\":\"默认服务\",\"properties\":[
{\"abilityId\":1,\"accessMode\":\"rw\",\"code\":\"unlock_method_create\",\"description\":\"【添加开锁方式】设备在线后,添加开锁方式。支持添加指纹】、密码、卡片和人脸的解锁方式;支持管理员标记。\",\"extensions\":{\"iconName\":\"icon-a_up\",\"attribute\":\"1888\"},\"name\":\"添加开门方式\",\"typeSpec\":{\"maxlen\":128,\"type\":\"raw\"}},
{\"abilityId\":2,\"accessMode\":\"rw\",\"code\":\"unlock_method_delete\",\"description\":\"【删除开锁方式】设备在线后,删除开锁方式。支持删除指纹、密码、卡片和人脸的解锁方式。该dp与添加dp成对出现\",\"extensions\":{\"iconName\":\"icon-dp_rabbish\",\"attribute\":\"1888\"},\"name\":\"删除开门方式\",\"typeSpec\":{\"maxlen\":128,\"type\":\"raw\"}},
{\"abilityId\":3,\"accessMode\":\"rw\",\"code\":\"unlock_method_modify\",\"description\":\"【修改开锁方式】设备在线后,支持修改开锁方式的名称,以及密码的内容修改。\",\"extensions\":{\"iconName\":\"icon-edit\",\"attribute\":\"1888\"},\"name\":\"修改开锁方式\",\"typeSpec\":{\"maxlen\":128,\"type\":\"raw\"}},
{\"abilityId\":8,\"accessMode\":\"ro\",\"code\":\"residual_electricity\",\"description\":\"【设备状态】用于电量以百分比显示。范围-1~100,当设备上报数值-1时,不显示电量。(与DP9二选一)\",\"extensions\":{\"iconName\":\"icon-dp_battery\",\"attribute\":\"1280\"},\"name\":\"剩余电量\",\"typeSpec\":{\"max\":100,\"min\":0,\"scale\":0,\"step\":1,\"type\":\"value\",\"typeDefaultValue\":0}},
{\"abilityId\":12,\"accessMode\":\"ro\",\"code\":\"unlock_fingerprint\",\"description\":\"【上报开锁记录】用于设备上报指纹开锁的记录。仅当本智能锁产品,硬件上带指纹识别功能时启用本dp\",\"extensions\":{\"iconName\":\"icon-dp_lock\",\"attribute\":\"1280\",\"trigger\":\"direct\"},\"name\":\"指纹解锁\",\"typeSpec\":{\"max\":999,\"min\":0,\"scale\":0,\"step\":1,\"type\":\"value\",\"typeDefaultValue\":0}},
{\"abilityId\":19,\"accessMode\":\"ro\",\"code\":\"unlock_ble\",\"description\":\"【上报开锁记录】用于设备上报手机app蓝牙开锁产生的开门记录,一般情况下所有蓝牙锁都支持该功能\",\"extensions\":{\"iconName\":\"icon-dp_lock\",\"attribute\":\"1280\",\"trigger\":\"direct\"},\"name\":\"蓝牙开锁\",\"typeSpec\":{\"max\":999,\"min\":0,\"scale\":0,\"step\":1,\"type\":\"value\",\"typeDefaultValue\":0}},
{\"abilityId\":20,\"accessMode\":\"rw\",\"code\":\"lock_record\",\"description\":\"【上报关锁记录】用于设备上报门锁关锁的记录。如通过手机app控制关锁,或本地手动关锁都可以使用本dp进行上报\",\"extensions\":{\"iconName\":\"icon-dp_lock\",\"attribute\":\"320\"},\"name\":\"关锁记录\",\"typeSpec\":{\"maxlen\":128,\"type\":\"raw\"}},
{\"abilityId\":21,\"accessMode\":\"ro\",\"code\":\"alarm_lock\",\"description\":\"【告警记录】本地发生告警时,用于上报设备的告警记录。对应值说明:0=指纹试错报警、1=密码试错报警、2=卡试错报警、3=人脸试错报警、4=假锁(锁舌卡住)、5=高温报警、6=超时未关门、7=电子锁舌未弹出、8=防撬报警 、9=钥匙插入、10=低电报警、11=电量耗尽报警、12=震动报警、13=布防报警,如设备只用到告警dp中的几项,多余的内容也不需要删除。如删除则mcu在上报时的序号需要调整。建议开发者不要改动告警中的枚举值。如遇特殊情况,请在pm的指导下,进行增、删,以及配置多语言等操作\",\"extensions\":{\"iconName\":\"icon-dp_warming\",\"attribute\":\"1280\",\"trigger\":\"direct\"},\"name\":\"门锁告警\",\"typeSpec\":{\"range\":[\"wrong_finger\",\"wrong_password\",\"wrong_card\",\"low_battery\",\"power_off\",\"tongue_bad\",\"unclosed_time\"],\"type\":\"enum\",\"typeDefaultValue\":\"wrong_finger\"}},
{\"abilityId\":32,\"accessMode\":\"rw\",\"code\":\"reverse_lock\",\"description\":\"【设备状态】若设备具有室内反锁检测时,用于上报室内反锁的开关状态。仅当本智能锁产品,硬件上功能检测反锁状态并能将数据上报的情况下选择本dp。本dp仅用于在门锁主页界面对反锁状态的显示,不能进行反锁设置操作\",\"extensions\":{\"iconName\":\"icon-zhuangtai\",\"attribute\":\"1344\",\"trigger\":\"direct\"},\"name\":\"室内反锁\",\"typeSpec\":{\"type\":\"bool\",\"typeDefaultValue\":false}},
{\"abilityId\":33,\"accessMode\":\"rw\",\"code\":\"automatic_lock\",\"description\":\"【自动落锁】用于设置自动落锁功能的开关。通过本dp可以设置“启用自动落锁”与“不自动落锁”即设备不会自动落锁,此时也可作为常开模式。仅在门锁硬件支持该设置时,启用本dp\\n\\n与dp36,“自动落锁延时”搭配使用,可以实现“解锁xx秒后自动落锁”对解锁后自动落锁的等待时长进行设置\",\"extensions\":{\"iconName\":\"icon-power\",\"attribute\":\"1280\",\"trigger\":\"direct\"},\"name\":\"自动关锁\",\"typeSpec\":{\"type\":\"bool\",\"typeDefaultValue\":false}},
{\"abilityId\":36,\"accessMode\":\"rw\",\"code\":\"auto_lock_time\",\"description\":\"【自动落锁】用于设置设备解锁后到执行自动落锁的延迟时间。设置范围1s~30min。\",\"extensions\":{\"iconName\":\"icon-dp_time3\",\"attribute\":\"1280\",\"trigger\":\"direct\"},\"name\":\"自动关锁延迟\",\"typeSpec\":{\"max\":60,\"min\":5,\"scale\":0,\"step\":1,\"type\":\"value\",\"typeDefaultValue\":5,\"unit\":\"\"}},
{\"abilityId\":46,\"accessMode\":\"rw\",\"code\":\"manual_lock\",\"description\":\"【落锁操作】用于触发设备执行落锁操作,可用于自动落锁和手动落锁的操作。\\n上报落锁(关锁)记录需使用dp=20 关锁记录。需要2个dp组合使用,完整实现关锁操作和关锁记录上报。在这两个dp之外,还需要使用dp47=落锁状态,进行落锁状态的上报,使得app上显示的锁的解锁/落锁状态与硬件本地保持一致\\t\",\"extensions\":{\"iconName\":\"icon-dp_lock\",\"attribute\":\"1280\",\"trigger\":\"direct\"},\"name\":\"手动关锁\",\"typeSpec\":{\"type\":\"bool\",\"typeDefaultValue\":false}},
{\"abilityId\":47,\"accessMode\":\"ro\",\"code\":\"lock_motor_state\",\"description\":\"【设备状态】用于上报设备离合开关的状态,即锁的开关状态。\",\"extensions\":{\"iconName\":\"icon-dp_lock\",\"attribute\":\"1280\",\"trigger\":\"direct\"},\"name\":\"锁开合状态\",\"typeSpec\":{\"type\":\"bool\",\"typeDefaultValue\":false}},
{\"abilityId\":54,\"accessMode\":\"rw\",\"code\":\"synch_method\",\"description\":\"【同步开锁方式】用于手机同步设备本地所有的开锁方式。\",\"extensions\":{\"iconName\":\"icon-dp_upload\",\"attribute\":\"1888\"},\"name\":\"同步开锁方式\",\"typeSpec\":{\"maxlen\":128,\"type\":\"raw\"}},
{\"abilityId\":61,\"accessMode\":\"rw\",\"code\":\"remote_no_dp_key\",\"description\":\"【远程开锁】用于触发设备远程开锁操作。\",\"extensions\":{\"iconName\":\"icon-dp_lock\",\"attribute\":\"1312\"},\"name\":\"免密远程开锁(带密钥)\",\"typeSpec\":{\"maxlen\":128,\"type\":\"raw\"}},
{\"abilityId\":62,\"accessMode\":\"ro\",\"code\":\"unlock_phone_remote\",\"description\":\"【上报开锁记录】用于设备上报手机远程开锁的记录。\",\"extensions\":{\"iconName\":\"icon-shouji\",\"attribute\":\"1280\",\"trigger\":\"direct\"},\"name\":\"远程手机开锁\",\"typeSpec\":{\"max\":999,\"min\":0,\"scale\":0,\"step\":1,\"type\":\"value\",\"typeDefaultValue\":0}},
{\"abilityId\":68,\"accessMode\":\"rw\",\"code\":\"special_function\",\"description\":\"【特殊功能】可根据自身需求用于设置其他特殊功能的开关。对应文案可在IoT平台进行修改。\",\"extensions\":{\"iconName\":\"icon-dp_mode\",\"attribute\":\"1280\",\"trigger\":\"direct\"},\"name\":\"马达方向\",\"typeSpec\":{\"range\":[\"function1\",\"function2\"],\"type\":\"enum\",\"typeDefaultValue\":\"function1\"}},
{\"abilityId\":70,\"accessMode\":\"rw\",\"code\":\"check_code_set\",\"description\":\"【蓝牙开锁】用于配置设备执行蓝牙解锁时需要的校验信息。\",\"extensions\":{\"iconName\":\"icon-dp_mode\",\"attribute\":\"1280\"},\"name\":\"配置蓝牙开锁校验码\",\"typeSpec\":{\"maxlen\":128,\"type\":\"raw\"}},
{\"abilityId\":71,\"accessMode\":\"rw\",\"code\":\"ble_unlock_check\",\"description\":\"【蓝牙开锁】用于触发设备执行蓝牙解锁。触发源可以是手机、配件或靠近解锁。\",\"extensions\":{\"iconName\":\"icon-dp_lock\",\"attribute\":\"1280\"},\"name\":\"蓝牙开锁(带校验码)\",\"typeSpec\":{\"maxlen\":128,\"type\":\"raw\"}},
{\"abilityId\":73,\"accessMode\":\"rw\",\"code\":\"remote_pd_setkey_check\",\"description\":\"【远程开锁】用于配置远程开锁时需要的密钥。若设备需要进行远程开锁,该DP必选。\",\"extensions\":{\"iconName\":\"icon-dp_lock\",\"attribute\":\"1792\"},\"name\":\"设置远程开锁(带校验码)\",\"typeSpec\":{\"maxlen\":128,\"type\":\"raw\"}},
{\"abilityId\":78,\"accessMode\":\"rw\",\"code\":\"special_control\",\"description\":\"【特殊控制】可根据自身需求用于触发其他特殊控制能力。对应文案可在IoT平台进行修改。\",\"extensions\":{\"iconName\":\"icon-dp_power2\",\"attribute\":\"1280\",\"trigger\":\"direct\"},\"name\":\"常开模式\",\"typeSpec\":{\"type\":\"bool\",\"typeDefaultValue\":false}}]}]}"
  },
  "success": true,
  "t": 1709712796536,
  "tid": "626c268edb9111eeaf18ce1e08994cdc"
}

Product ID

[
    {
        "name": "Smart Lock",
        "id": "ebdeeeq85f1m7c1c",
        "key": "_~h_`1POa>88t$V<",
        "mac": "DC:23:4F:C9:EA:7E",
        "uuid": "ecb1b7cddb3ae6e0",
        "category": "jtmspro",
        "product_name": "Smart Lock",
        "product_id": "ofwvna43",
        "biz_type": 0,
        "model": "\u6613\u601d\u7ef4T2",
        "sub": true,
        "icon": "https://images.tuyaus.com/smart/icon/ay15724370520156puq6/a3d6a04d38237ddf13208a11feb2efbc.png",
        "node_id": "ecb1b7cddb3ae6e0",
        "mapping": {
            "1": {
                "code": "unlock_method_create",
                "type": "Raw",
                "values": {}
            },
            "2": {
                "code": "unlock_method_delete",
                "type": "Raw",
                "values": {}
            },
            "3": {
                "code": "unlock_method_modify",
                "type": "Raw",
                "values": {}
            },
            "8": {
                "code": "residual_electricity",
                "type": "Integer",
                "values": {
                    "min": 0,
                    "max": 100,
                    "scale": 0,
                    "step": 1
                }
            },
            "12": {
                "code": "unlock_fingerprint",
                "type": "Integer",
                "values": {
                    "min": 0,
                    "max": 999,
                    "scale": 0,
                    "step": 1
                }
            },
            "19": {
                "code": "unlock_ble",
                "type": "Integer",
                "values": {
                    "min": 0,
                    "max": 999,
                    "scale": 0,
                    "step": 1
                }
            },
            "20": {
                "code": "lock_record",
                "type": "Raw",
                "values": {}
            },
            "21": {
                "code": "alarm_lock",
                "type": "Enum",
                "values": {
                    "range": [
                        "wrong_finger",
                        "wrong_password",
                        "wrong_card",
                        "low_battery",
                        "power_off",
                        "tongue_bad",
                        "unclosed_time"
                    ]
                }
            },
            "32": {
                "code": "reverse_lock",
                "type": "Boolean",
                "values": {}
            },
            "33": {
                "code": "automatic_lock",
                "type": "Boolean",
                "values": {}
            },
            "36": {
                "code": "auto_lock_time",
                "type": "Integer",
                "values": {
                    "unit": "",
                    "min": 5,
                    "max": 60,
                    "scale": 0,
                    "step": 1
                }
            },
            "46": {
                "code": "manual_lock",
                "type": "Boolean",
                "values": {}
            },
            "47": {
                "code": "lock_motor_state",
                "type": "Boolean",
                "values": {}
            },
            "54": {
                "code": "synch_method",
                "type": "Raw",
                "values": {}
            },
            "61": {
                "code": "remote_no_dp_key",
                "type": "Raw",
                "values": {}
            },
            "62": {
                "code": "unlock_phone_remote",
                "type": "Integer",
                "values": {
                    "min": 0,
                    "max": 999,
                    "scale": 0,
                    "step": 1
                }
            },
            "68": {
                "code": "special_function",
                "type": "Enum",
                "values": {
                    "range": [
                        "function1",
                        "function2"
                    ]
                }
            },
            "70": {
                "code": "check_code_set",
                "type": "Raw",
                "values": {}
            },
            "71": {
                "code": "ble_unlock_check",
                "type": "Raw",
                "values": {}
            },
            "73": {
                "code": "remote_pd_setkey_check",
                "type": "Raw",
                "values": {}
            },
            "78": {
                "code": "special_control",
                "type": "Boolean",
                "values": {}
            }
        },
        "parent": "",
        "ip": "",
        "version": ""
    },
    {
        "name": "Gateway",
        "id": "eb1b33322dedac9cedszwk",
        "key": "_~h_`1POa>88t$V<",
        "mac": "fc:67:1f:2c:93:f0",
        "uuid": "a94fc55d27ac339e",
        "sn": "10008469800628",
        "category": "wg2",
        "product_name": "Gateway",
        "product_id": "vv5weaudutzsqvai",
        "biz_type": 0,
        "model": "G08Pro(Zigbee+Bluetooth\u7f51\u5173)",
        "sub": true,
        "icon": "https://images.tuyaus.com/smart/icon/ay1525749833414yotNt/26ede3412687c225b9ca020f3340482f.png",
        "mapping": {
            "4": {
                "code": "switch_alarm_sound",
                "type": "Boolean",
                "values": {}
            },
            "32": {
                "code": "master_state",
                "type": "Enum",
                "values": {
                    "range": [
                        "normal",
                        "alarm"
                    ]
                }
            },
            "34": {
                "code": "factory_reset",
                "type": "Boolean",
                "values": {}
            },
            "45": {
                "code": "alarm_active",
                "type": "String",
                "values": "{\"maxlen\":255}"
            }
        },
        "parent": "",
        "ip": "10.0.0.167",
        "version": "3.4"
    }
]

Information about how the device functions

Smart Lock BTE + Getway BTE+ZBE

@dieu dieu added the new device Unsupported device label Mar 6, 2024
@make-all
Copy link
Owner

make-all commented Mar 6, 2024

901: Network Error: Unable to Connect

If you cannot solve the fundamental connection problem with your device, there is no point to make a config for it. If it is a battery powered WiFi device, then this is unlikely to be supportable locally, as battery powered devices spend most of their time asleep to save power, and are only available on WiFi during the short periods that they wake to check-in with the cloud.

@dieu
Copy link
Author

dieu commented Mar 6, 2024

@make-all Jason thanks for the help; I was able to connect, and it matched to the BLE Orion Lock but it doesn't work well. The device is a BLE Smart Lock connected to BLE/ZBE/Wifi Getaway.

2024-03-06 00:23:55.610 WARNING (MainThread) [custom_components.tuya_local.config_flow] Device matches ble_orion_lock with quality of 40%. DPS: {"updated_at": 1709713427.7262652, "8": 100, "32": false, "33": false, "68": "function2", "78": false}
2024-03-06 00:23:55.611 WARNING (MainThread) [custom_components.tuya_local.config_flow] Report this to https://github.com/make-all/tuya-local/issues/
2024-03-06 00:24:06.391 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Loaded device config ble_orion_lock.yaml
2024-03-06 00:24:08.576 INFO (MainThread) [homeassistant.setup] Setting up tuya_local
2024-03-06 00:24:08.576 INFO (MainThread) [homeassistant.setup] Setup of domain tuya_local took 0.0 seconds
2024-03-06 00:24:08.578 DEBUG (MainThread) [custom_components.tuya_local] Setting up entry for device: ecb1b7cddb3ae6e0
2024-03-06 00:24:08.579 INFO (MainThread) [custom_components.tuya_local.device] Creating device: ecb1b7cddb3ae6e0
2024-03-06 00:24:08.585 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Loaded device config ble_orion_lock.yaml
2024-03-06 00:24:08.602 INFO (MainThread) [homeassistant.components.lock] Setting up tuya_local.lock
2024-03-06 00:24:08.608 INFO (MainThread) [homeassistant.components.sensor] Setting up tuya_local.sensor
2024-03-06 00:24:08.615 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Loaded device config ble_orion_lock.yaml
2024-03-06 00:24:08.616 DEBUG (MainThread) [custom_components.tuya_local.helpers.config] Adding lock for lock
2024-03-06 00:24:08.622 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Loaded device config ble_orion_lock.yaml
2024-03-06 00:24:08.622 DEBUG (MainThread) [custom_components.tuya_local.helpers.config] Adding sensor for sensor_battery
2024-03-06 00:24:08.624 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new lock.tuya_local entity: lock.orion_ble_lock
2024-03-06 00:24:08.625 DEBUG (MainThread) [custom_components.tuya_local.device] Starting monitor loop for Orion BLE lock
2024-03-06 00:24:08.627 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] No mapping for dpid 8 (sensor), unable to determine valid values
2024-03-06 00:24:08.627 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.tuya_local entity: sensor.orion_ble_lock_battery
2024-03-06 00:24:08.630 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] No mapping for dpid 8 (sensor), unable to determine valid values
2024-03-06 00:24:08.645 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for Orion BLE lock to 3.4
2024-03-06 00:24:08.662 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] No mapping for dpid 8 (sensor), unable to determine valid values
2024-03-06 00:24:08.740 DEBUG (MainThread) [custom_components.tuya_local.device] Orion BLE lock received {"8": 100, "32": false, "33": false, "68": "function2", "78": false, "full_poll": true}
2024-03-06 00:24:08.742 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] No mapping for dpid 8 (sensor), unable to determine valid values
2024-03-06 00:24:08.743 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] No mapping for dpid 8 (sensor), unable to determine valid values
2024-03-06 00:24:08.845 DEBUG (MainThread) [custom_components.tuya_local.device] Orion BLE lock persistant connection set to True
2024-03-06 00:24:24.836 DEBUG (MainThread) [custom_components.tuya_local.device] Orion BLE lock new pending updates: {"33": {"value": true, "updated_at": 1709713464.8356936, "sent": false}}
2024-03-06 00:24:24.843 DEBUG (MainThread) [custom_components.tuya_local.device] Orion BLE lock sending dps update: {"33": true}
2024-03-06 00:24:25.802 DEBUG (MainThread) [custom_components.tuya_local.device] Orion BLE lock received {"8": 100, "32": false, "33": false, "68": "function2", "78": false, "full_poll": true}
2024-03-06 00:24:25.805 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] No mapping for dpid 8 (sensor), unable to determine valid values
2024-03-06 00:24:25.805 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] No mapping for dpid 8 (sensor), unable to determine valid values
2024-03-06 00:24:26.213 DEBUG (MainThread) [custom_components.tuya_local.device] Orion BLE lock received {"33": true, "full_poll": false}
2024-03-06 00:24:26.214 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] No mapping for dpid 8 (sensor), unable to determine valid values
2024-03-06 00:24:26.215 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] No mapping for dpid 8 (sensor), unable to determine valid values
2024-03-06 00:24:27.596 DEBUG (MainThread) [custom_components.tuya_local.device] Orion BLE lock new pending updates: {"33": {"value": false, "updated_at": 1709713467.5963268, "sent": false}}
2024-03-06 00:24:27.600 DEBUG (MainThread) [custom_components.tuya_local.device] Orion BLE lock sending dps update: {"33": false}
2024-03-06 00:24:27.769 DEBUG (MainThread) [custom_components.tuya_local.device] Orion BLE lock received {"8": 100, "32": false, "33": true, "68": "function2", "78": false, "full_poll": true}
2024-03-06 00:24:27.771 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] No mapping for dpid 8 (sensor), unable to determine valid values
2024-03-06 00:24:27.772 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] No mapping for dpid 8 (sensor), unable to determine valid values
2024-03-06 00:24:27.968 DEBUG (MainThread) [custom_components.tuya_local.device] Orion BLE lock received {"33": false, "full_poll": false}
2024-03-06 00:24:27.969 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] No mapping for dpid 8 (sensor), unable to determine valid values
2024-03-06 00:24:27.970 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] No mapping for dpid 8 (sensor), unable to determine valid values
2024-03-06 00:24:29.528 DEBUG (MainThread) [custom_components.tuya_local.device] Orion BLE lock received {"33": false, "full_poll": false}
2024-03-06 00:24:29.529 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] No mapping for dpid 8 (sensor), unable to determine valid values
2024-03-06 00:24:29.530 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] No mapping for dpid 8 (sensor), unable to determine valid values
2024-03-06 00:24:30.112 DEBUG (MainThread) [custom_components.tuya_local.device] Orion BLE lock received {"68": "function2", "full_poll": false}
2024-03-06 00:24:30.114 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] No mapping for dpid 8 (sensor), unable to determine valid values
2024-03-06 00:24:30.114 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] No mapping for dpid 8 (sensor), unable to determine valid values
2024-03-06 00:24:30.316 DEBUG (MainThread) [custom_components.tuya_local.device] Orion BLE lock received {"78": false, "full_poll": false}
2024-03-06 00:24:30.317 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] No mapping for dpid 8 (sensor), unable to determine valid values
2024-03-06 00:24:30.317 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] No mapping for dpid 8 (sensor), unable to determine valid values
2024-03-06 00:24:30.433 DEBUG (MainThread) [custom_components.tuya_local.device] Orion BLE lock received {"32": false, "full_poll": false}
2024-03-06 00:24:30.435 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] No mapping for dpid 8 (sensor), unable to determine valid values
2024-03-06 00:24:30.435 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] No mapping for dpid 8 (sensor), unable to determine valid values
2024-03-06 00:24:49.662 DEBUG (MainThread) [custom_components.tuya_local.device] Orion BLE lock new pending updates: {"33": {"value": true, "updated_at": 1709713489.6625464, "sent": false}}
2024-03-06 00:24:49.664 DEBUG (MainThread) [custom_components.tuya_local.device] Orion BLE lock sending dps update: {"33": true}
2024-03-06 00:24:49.875 DEBUG (MainThread) [custom_components.tuya_local.device] Orion BLE lock received {"8": 100, "32": false, "33": false, "68": "function2", "78": false, "full_poll": true}
2024-03-06 00:24:49.876 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] No mapping for dpid 8 (sensor), unable to determine valid values
2024-03-06 00:24:49.876 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] No mapping for dpid 8 (sensor), unable to determine valid values
2024-03-06 00:24:50.069 DEBUG (MainThread) [custom_components.tuya_local.device] Orion BLE lock received {"33": true, "full_poll": false}
2024-03-06 00:24:50.071 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] No mapping for dpid 8 (sensor), unable to determine valid values
2024-03-06 00:24:50.071 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] No mapping for dpid 8 (sensor), unable to determine valid values
2024-03-06 00:24:52.156 DEBUG (MainThread) [custom_components.tuya_local.device] Orion BLE lock new pending updates: {"33": {"value": false, "updated_at": 1709713492.1562045, "sent": false}}

@make-all make-all added the full_info All info needed was provided label Mar 6, 2024
@dieu
Copy link
Author

dieu commented Mar 22, 2024

Hello @make-all, can I do anything to help support the lock?

make-all added a commit that referenced this issue Mar 30, 2024
@make-all make-all added awaiting confirmation Wating for confirmation the issue is solved unreleased Will be in next release and removed full_info All info needed was provided labels Mar 30, 2024
@make-all make-all removed new device Unsupported device awaiting confirmation Wating for confirmation the issue is solved unreleased Will be in next release labels Apr 28, 2024
@dieu
Copy link
Author

dieu commented Apr 28, 2024

@make-all, thanks a lot for your work, testing it now and got an error:

2024-04-27 18:41:58.287 WARNING (MainThread) [custom_components.tuya_local.config_flow] Device matches nice_digi_lock with quality of 100%. DPS: {"updated_at": 1714268511.6983633, "8": 70, "12": 52, "21": "wrong_finger", "32": false, "33": true, "47": true, "68": "function2", "78": false}
2024-04-27 18:41:58.288 WARNING (MainThread) [custom_components.tuya_local.config_flow] Report this to https://github.com/make-all/tuya-local/issues/
2024-04-27 18:42:04.068 INFO (MainThread) [custom_components.tuya_local.device] Creating device: ecb1b7cddb3ae6e0
2024-04-27 18:42:04.112 INFO (MainThread) [homeassistant.components.sensor] Setting up tuya_local.sensor
2024-04-27 18:42:04.126 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.tuya_local entity: sensor.door_lock_battery
2024-04-27 18:42:04.131 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up tuya_local.binary_sensor
2024-04-27 18:42:04.150 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.tuya_local entity: binary_sensor.door_lock_snib
2024-04-27 18:42:04.152 INFO (MainThread) [homeassistant.components.event] Setting up tuya_local.event
2024-04-27 18:42:04.172 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new event.tuya_local entity: event.door_lock_alert
2024-04-27 18:42:04.174 INFO (MainThread) [homeassistant.components.switch] Setting up tuya_local.switch
2024-04-27 18:42:04.190 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.tuya_local entity: switch.door_lock_auto_lock
2024-04-27 18:42:04.192 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.tuya_local entity: switch.door_lock_special_control
2024-04-27 18:42:04.193 INFO (MainThread) [homeassistant.components.number] Setting up tuya_local.number
2024-04-27 18:42:04.217 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new number.tuya_local entity: number.door_lock_auto_lock_delay
2024-04-27 18:42:04.219 INFO (MainThread) [homeassistant.components.lock] Setting up tuya_local.lock
2024-04-27 18:42:04.235 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new lock.tuya_local entity: lock.door_lock
2024-04-27 18:42:04.237 INFO (MainThread) [homeassistant.components.select] Setting up tuya_local.select
2024-04-27 18:42:04.254 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new select.tuya_local entity: select.door_lock_special_function
2024-04-27 18:42:04.259 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for Door lock to 3.4
2024-04-27 18:42:04.523 ERROR (MainThread) [custom_components.tuya_local.device] Door lock receive loop terminated by exception Invalid event type wrong_finger for event.door_lock_alert
Traceback (most recent call last):
File "/config/custom_components/tuya_local/device.py", line 212, in receive_loop
entity.on_receive(poll, full_poll)
File "/config/custom_components/tuya_local/event.py", line 80, in on_receive
self._trigger_event(
File "/usr/src/homeassistant/homeassistant/components/event/__init__.py", line 158, in _trigger_event
raise ValueError(f"Invalid event type {event_type} for {self.entity_id}")
ValueError: Invalid event type wrong_finger for event.door_lock_alert

@make-all make-all added awaiting confirmation Wating for confirmation the issue is solved unreleased Will be in next release device improvement Improvement to an existing device config labels May 15, 2024
@make-all make-all reopened this May 15, 2024
make-all added a commit that referenced this issue May 15, 2024
HA wants a list of events, and to match any incoming event type
against that list, so we cannot allow arbitrary event reporting.

Issue #1714

- same issue found in Single phase clamp meter, and Tonepie T1Pro
  cat litter box.
@make-all make-all removed awaiting confirmation Wating for confirmation the issue is solved unreleased Will be in next release device improvement Improvement to an existing device config labels May 25, 2024
timlaing pushed a commit to timlaing/tuya-local that referenced this issue Aug 8, 2024
timlaing pushed a commit to timlaing/tuya-local that referenced this issue Aug 8, 2024
HA wants a list of events, and to match any incoming event type
against that list, so we cannot allow arbitrary event reporting.

Issue make-all#1714

- same issue found in Single phase clamp meter, and Tonepie T1Pro
  cat litter box.
@igcoser
Copy link

igcoser commented Sep 16, 2024

Hello I am trying to integrate the Nici Digi Lock in Tuya Local but I only manage to lock . To create a temporary pass or unlock_temporary makes nothing. I tried everything during weeks. Could you help me please.

YAML:

products:
  - id: kholoaew
    name: Nice Digi
primary_entity:
  entity: lock
  dps:
    - id: 46
      type: boolean
      name: lock  # Este es el dps utilizado para bloquear/desbloquear
      optional: false
      mapping:
        - dps_val: true
          value: unlocked  # Cambia True para representar desbloqueado
        - dps_val: false
          value: locked  # Cambia False para representar bloqueado
    - id: 55
      type: integer
      name: unlock_temporary  # Este es el dps 55 para la apertura temporal
      optional: false
    - id: 47
      type: boolean
      name: lock_motor_state  # Este es el dps para el estado del motor
      optional: true
secondary_entities:
  - entity: switch
    name: Auto lock
    icon: "mdi:lock-reset"
    category: config
    dps:
      - id: 33
        type: boolean
        name: switch
        optional: true
        mapping:
          - dps_val: true
            value: false
          - dps_val: false
            value: true
  - entity: sensor
    class: battery
    category: diagnostic
    dps:
      - id: 8
        type: integer
        name: battery_level
        unit: "%"
        class: measurement
  - entity: number
    name: Auto lock delay
    category: config
    icon: "mdi:lock-clock"
    dps:
      - id: 36
        type: integer
        name: auto_lock_delay
        unit: s
        range:
          min: 5
          max: 60
       ```
    LOCK.PY :
    
    ```"""
Setup for different kinds of Tuya lock devices
"""

import logging
from homeassistant.components.lock import LockEntity, LockEntityFeature

from .device import TuyaLocalDevice
from .helpers.config import async_tuya_setup_platform
from .helpers.device_config import TuyaEntityConfig
from .helpers.mixin import TuyaLocalEntity

_LOGGER = logging.getLogger(__name__)

async def async_setup_entry(hass, config_entry, async_add_entities):
    config = {**config_entry.data, **config_entry.options}
    await async_tuya_setup_platform(
        hass,
        async_add_entities,
        config,
        "lock",
        TuyaLocalLock,
    )


class TuyaLocalLock(TuyaLocalEntity, LockEntity):
    """Representation of a Tuya Wi-Fi connected lock."""

    def __init__(self, device: TuyaLocalDevice, config: TuyaEntityConfig):
        """
        Initialise the lock.
        Args:
          device (TuyaLocalDevice): The device API instance.
          config (TuyaEntityConfig): The configuration for this entity.
        """
        super().__init__()
        dps_map = self._init_begin(device, config)
        self._lock_dp = dps_map.pop("lock", None)  # Asignamos dps 46 para bloqueo
        self._unlock_temporary_dp = dps_map.pop("unlock_temporary", None)  # Asignamos dps 55 para abrir/desbloquear
        self._init_end(dps_map)
        _LOGGER.debug("TuyaLocalLock initialized with lock_dp: %s and unlock_temporary_dp (dps 55): %s", self._lock_dp, self._unlock_temporary_dp)

    @property
    def is_locked(self):
        """Return a boolean representing whether the lock is locked."""
        lock = None
        if self._lock_dp:
            lock = self._lock_dp.get_value(self._device)
        _LOGGER.debug("is_locked called, returning: %s", lock)
        return lock

    async def async_lock(self, **kwargs):
        """Lock the lock."""
        if self._lock_dp:
            _LOGGER.debug("Locking the lock with dps 46")
            await self._lock_dp.async_set_value(self._device, True)
        else:
            _LOGGER.error("Locking not implemented")
            raise NotImplementedError()

    async def async_unlock(self, **kwargs):
        """Unlock the lock using dps 55."""
        if self._unlock_temporary_dp:  # Usamos el dps 55 para desbloquear con el valor 150
            try:
                _LOGGER.debug("Unlocking the lock with dps 55")
                await self._unlock_temporary_dp.async_set_value(self._device, 150)  # Envía el valor 150 para desbloquear
                _LOGGER.debug("Successfully unlocked with dps 55")
            except Exception as e:
                _LOGGER.error("Error sending value to unlock_temporary_dp (dps 55): %s", e)
        else:
            _LOGGER.error("No unlock_temporary_dp (dps 55) available to unlock the lock")
            raise NotImplementedError()

    async def async_open(self, **kwargs):
        """Open the lock using dps 55."""
        await self.async_unlock()  # Como la apertura y desbloqueo usan el mismo DPS 55, reutilizamos el método
        ```
        
        dps from tuya API:

{
"result": {
"properties": [
{
"code": "unlock_method_create",
"custom_name": "",
"dp_id": 1,
"time": 1726107192621,
"type": "raw",
"value": "OTk5OTk5"
},
{
"code": "unlock_method_delete",
"custom_name": "",
"dp_id": 2,
"time": 1724529382912,
"type": "raw"
},
{
"code": "unlock_method_modify",
"custom_name": "",
"dp_id": 3,
"time": 1724529382912,
"type": "raw"
},
{
"code": "residual_electricity",
"custom_name": "",
"dp_id": 8,
"time": 1726190051746,
"type": "value",
"value": 100
},
{
"code": "unlock_fingerprint",
"custom_name": "",
"dp_id": 12,
"time": 1724529674000,
"type": "value",
"value": 100
},
{
"code": "unlock_password",
"custom_name": "",
"dp_id": 13,
"time": 1724529699000,
"type": "value",
"value": 0
},
{
"code": "unlock_dynamic",
"custom_name": "",
"dp_id": 14,
"time": 1724529382912,
"type": "value",
"value": 0
},
{
"code": "unlock_card",
"custom_name": "",
"dp_id": 15,
"time": 1724537550000,
"type": "value",
"value": 50
},
{
"code": "unlock_ble",
"custom_name": "",
"dp_id": 19,
"time": 1725001488000,
"type": "value",
"value": 1
},
{
"code": "alarm_lock",
"custom_name": "",
"dp_id": 21,
"time": 1724529382912,
"type": "enum",
"value": "wrong_finger"
},
{
"code": "language",
"custom_name": "",
"dp_id": 28,
"time": 1726486405880,
"type": "enum",
"value": "english"
},
{
"code": "beep_volume",
"custom_name": "",
"dp_id": 31,
"time": 1726190051809,
"type": "enum",
"value": "high"
},
{
"code": "automatic_lock",
"custom_name": "",
"dp_id": 33,
"time": 1726486406084,
"type": "bool",
"value": false
},
{
"code": "auto_lock_time",
"custom_name": "",
"dp_id": 36,
"time": 1724994334515,
"type": "value",
"value": 8
},
{
"code": "manual_lock",
"custom_name": "",
"dp_id": 46,
"time": 1726486257099,
"type": "bool",
"value": true
},
{
"code": "lock_motor_state",
"custom_name": "",
"dp_id": 47,
"time": 1726486257836,
"type": "bool",
"value": false
},
{
"code": "temporary_password_creat",
"custom_name": "",
"dp_id": 51,
"time": 1726478614880,
"type": "raw",
"value": "nQA="
},
{
"code": "temporary_password_delete",
"custom_name": "",
"dp_id": 52,
"time": 1724529382912,
"type": "raw"
},
{
"code": "temporary_password_modify",
"custom_name": "",
"dp_id": 53,
"time": 1724529382912,
"type": "raw"
},
{
"code": "synch_method",
"custom_name": "",
"dp_id": 54,
"time": 1724529618865,
"type": "raw",
"value": "AQE="
},
{
"code": "unlock_temporary",
"custom_name": "",
"dp_id": 55,
"time": 1724529516000,
"type": "value",
"value": 150
},
{
"code": "remote_no_dp_key",
"custom_name": "",
"dp_id": 61,
"time": 1726484112228,
"type": "raw",
"value": "AAAB"
},
{
"code": "unlock_phone_remote",
"custom_name": "",
"dp_id": 62,
"time": 1726484109000,
"type": "value",
"value": 256
},
{
"code": "unlock_voice_remote",
"custom_name": "",
"dp_id": 63,
"time": 1724529382912,
"type": "value",
"value": 0
},
{
"code": "password_offline_time",
"custom_name": "",
"dp_id": 64,
"time": 1726484045155,
"type": "string",
"value": "1724529382"
},
{
"code": "unlock_offline_clear_single",
"custom_name": "",
"dp_id": 65,
"time": 1724529382912,
"type": "raw"
},
{
"code": "unlock_offline_clear",
"custom_name": "",
"dp_id": 66,
"time": 1724529382912,
"type": "raw"
},
{
"code": "unlock_offline_pd",
"custom_name": "",
"dp_id": 67,
"time": 1724529382912,
"type": "raw"
},
{
"code": "check_code_set",
"custom_name": "",
"dp_id": 70,
"time": 1724529388603,
"type": "raw",
"value": "AAH//wAAAAAAAAAAAP//AA=="
},
{
"code": "ble_unlock_check",
"custom_name": "",
"dp_id": 71,
"time": 1725001489168,
"type": "raw",
"value": "AAH//zU0MDEyODM0AWbRbxAAAA=="
},
{
"code": "remote_pd_setkey_check",
"custom_name": "",
"dp_id": 73,
"time": 1726032177830,
"type": "raw",
"value": "AAH//zU0MDEyODM0AQABAA=="
}
]
}

       

@make-all
Copy link
Owner

I'm not aware of how to do this using local APIs. Tuya has a separate Lock specific cloud API for remote unlocking and other lock management.

@igcoser
Copy link

igcoser commented Sep 16, 2024

Using Tuya Local I mean. And how to create a temporary code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

3 participants