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
858 stars 206 forks source link

Orion PIR Motion Sensor not showing up in HA or Logs... #682

Open dcwilli opened 2 years ago

dcwilli commented 2 years ago

Describe the bug The Orion PIR Sensor is showing up only as a tamper alarm in the HA log and HA. It is a motion sensor and should show up as one.

I looks like also the IOT instructional set only have tamper alarm in it.... image

It's also stuck on "Detected" even though the sensor is closed. image

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Home Assistant Version

2021-11-09 19:57:01 DEBUG (Thread-7) [tuya iot] _on_log: Sending PINGREQ 2021-11-09 19:57:01 DEBUG (Thread-7) [tuya iot] _on_log: Received PINGRESP 2021-11-09 19:58:02 DEBUG (Thread-7) [tuya iot] _on_log: Sending PINGREQ 2021-11-09 19:58:02 DEBUG (Thread-7) [tuya iot] _on_log: Received PINGRESP 2021-11-09 19:58:21 DEBUG (Thread-7) [tuya iot] _on_log: Received PUBLISH (d0, q0, r0, m0), 'cloud/token/in/db176e44819e2dd1c012cca724b4f5d9', ... (416 bytes) 2021-11-09 19:58:21 DEBUG (Thread-7) [tuya iot] payload-> b'{"data":"ewr1bWuUtKDSldLIjk67o2GBqz6M75AqXXGjLpBLRiElsZEqKfmEZAMd1tQANk+lLvh/h4mrpWe42sqfg2hJO5UoMYY0j3v6QvTzsoxGUNJtFx6LaYgQUvjkEAYdPgTgv8tzSNf4YyomgpYkBpxpYExV49QEvkircyFBU5Iwr+YNXu+PFbbscDpo1vgIYgx3IRHciYGO9cxLT8VCq0mrl7cS5O5zscLKYDw7QkLUgcd1NVW7ejkjWxFmenSHYlyqEfBVuzCLVwmYcD1CpFumOIMHWG8/qzVPc8VEFODJb2bvQfDLbYu/ln4JlhsQabcc","protocol":20,"pv":"2.0","sign":"c1c68410eda834b46ac5d3d91098b3df","t":1636451901577}' 2021-11-09 19:58:21 DEBUG (Thread-7) [tuya iot] on_message: {'data': {'bizCode': 'delete', 'bizData': {'devId': '2711304024a16036c4ff', 'uid': 'eu15452257318457LSkh', 'ownerId': '2761739'}, 'devId': '2711304024a16036c4ff', 'productKey': 'bupsijolpys178ut', 'ts': 1636451901577, 'uuid': '2711304024a16036c4ff'}, 'protocol': 20, 'pv': '2.0', 'sign': 'c1c68410eda834b46ac5d3d91098b3df', 't': 1636451901577} 2021-11-09 19:58:21 DEBUG (Thread-7) [tuya iot] mq receive-> {'data': {'bizCode': 'delete', 'bizData': {'devId': '2711304024a16036c4ff', 'uid': 'eu15452257318457LSkh', 'ownerId': '2761739'}, 'devId': '2711304024a16036c4ff', 'productKey': 'bupsijolpys178ut', 'ts': 1636451901577, 'uuid': '2711304024a16036c4ff'}, 'protocol': 20, 'pv': '2.0', 'sign': 'c1c68410eda834b46ac5d3d91098b3df', 't': 1636451901577} 2021-11-09 19:58:21 DEBUG (Thread-7) [tuya iot] mq _on_device_other-> 2711304024a16036c4ff -- delete 2021-11-09 19:58:21 DEBUG (Thread-7) [custom_components.tuya_v2] tuya remove device:2711304024a16036c4ff 2021-11-09 19:59:02 DEBUG (Thread-7) [tuya iot] _on_log: Sending PINGREQ 2021-11-09 19:59:03 DEBUG (Thread-7) [tuya iot] _on_log: Received PINGRESP 2021-11-09 20:00:03 DEBUG (Thread-7) [tuya iot] _on_log: Sending PINGREQ 2021-11-09 20:00:03 DEBUG (Thread-7) [tuya iot] _on_log: Received PINGRESP 2021-11-09 20:00:40 DEBUG (Thread-7) [tuya iot] _on_log: Received PUBLISH (d0, q0, r0, m0), 'cloud/token/in/db176e44819e2dd1c012cca724b4f5d9', ... (480 bytes) 2021-11-09 20:00:40 DEBUG (Thread-7) [tuya iot] payload-> b'{"data":"XNZfQmkZRuEcErcL3sMl0shrcd/rVS+sAwEK4Yio2Vr7mvjglwzl+tGlMGqtPBF2kbNIkwU3qC460DY2L2KzquSWEYsjNEPvPeqp06B14btjwxbT/p7h4EVm3c/VBe4KVm920R9GizMb//KVLq4GlQltLRJieR7hjaWVASJgYmQNXu+PFbbscDpo1vgIYgx3XgZ5jCZZAaLBaMusBm6USWNjwGLbclCOmuqfNWhWOf+4V8EoeZ49/Nlnk/JSaOzHrZ19pSwfXnlzIEKpYlQ1SGQvm1zo9jutWf89ANzIznnhe/g6aS82WGzZvoJmbRWpOyLRg+68uSjvksxEHbCK96rG9N/d7MVsPwk5g4h66s8a8LrBDTuwwc6oHbHWzS91","protocol":20,"pv":"2.0","sign":"4b285ca7cb9e0f7810994d4fa6447c70","t":1636452039910}' 2021-11-09 20:00:40 DEBUG (Thread-7) [tuya iot] on_message: {'data': {'bizCode': 'bindUser', 'bizData': {'devId': '2711304024a16036c4ff', 'uid': 'eu15452257318457LSkh', 'ownerId': '2761739', 'uuid': '2711304024a16036c4ff', 'token': '6WzwEO30'}, 'devId': '2711304024a16036c4ff', 'productKey': 'bupsijolpys178ut', 'ts': 1636452039910, 'uuid': '2711304024a16036c4ff'}, 'protocol': 20, 'pv': '2.0', 'sign': '4b285ca7cb9e0f7810994d4fa6447c70', 't': 1636452039910} 2021-11-09 20:00:40 DEBUG (Thread-7) [tuya iot] mq receive-> {'data': {'bizCode': 'bindUser', 'bizData': {'devId': '2711304024a16036c4ff', 'uid': 'eu15452257318457LSkh', 'ownerId': '2761739', 'uuid': '2711304024a16036c4ff', 'token': '6WzwEO30'}, 'devId': '2711304024a16036c4ff', 'productKey': 'bupsijolpys178ut', 'ts': 1636452039910, 'uuid': '2711304024a16036c4ff'}, 'protocol': 20, 'pv': '2.0', 'sign': '4b285ca7cb9e0f7810994d4fa6447c70', 't': 1636452039910} 2021-11-09 20:00:40 DEBUG (Thread-7) [tuya iot] mq _on_device_other-> 2711304024a16036c4ff -- bindUser 2021-11-09 20:00:41 DEBUG (Thread-7) [tuya iot] Request: method = GET, url = https://openapi.tuyaeu.com/v1.0/devices/, params = {'device_ids': '2711304024a16036c4ff'}, body = None, t = 1636452041082 2021-11-09 20:00:42 DEBUG (Thread-7) [tuya iot] Response: { "result": { "devices": [ { "active_time": 1636452039, "biz_type": 18, "category": "pir", "create_time": 1636446703, "icon": "smart/icon/ay1536534747810ekKBj/9c0dbbf9979bfbe33add2bec8c4360b0.png", "id": "2711304024a16036c4ff", "ip": "1.128.105.191", "lat": "-27.5446", "local_key": "23f5acbd66871918", "lon": "153.0878", "model": "SWS05HA", "name": "Orion Wi-Fi Motion Sensor", "online": true, "owner_id": "2761739", "product_id": "bupsijolpys178ut", "product_name": "SWS05HA Wi-Fi Motion Sensor", "status": [ { "code": "temper_alarm", "value": true } ], "sub": false, "time_zone": "+10:00", "uid": "eu15452257318457LSkh", "update_time": 1636452042, "uuid": "2711304024a16036c4ff" } ], "last_id": "1636452042", "total": 1 }, "success": true, "t": 1636452042407 } 2021-11-09 20:00:42 DEBUG (Thread-7) [tuya iot] Request: method = GET, url = https://openapi.tuyaeu.com/v1.0/devices/, params = {'device_ids': '2711304024a16036c4ff'}, body = None, t = 1636452042597 2021-11-09 20:00:42 DEBUG (Thread-7) [tuya iot] Response: { "result": { "devices": [ { "active_time": 1636452039, "biz_type": 18, "category": "pir", "create_time": 1636446703, "icon": "smart/icon/ay1536534747810ekKBj/9c0dbbf9979bfbe33add2bec8c4360b0.png", "id": "2711304024a16036c4ff", "ip": "1.128.105.191", "lat": "-27.5446", "local_key": "23f5acbd66871918", "lon": "153.0878", "model": "SWS05HA", "name": "Orion Wi-Fi Motion Sensor", "online": true, "owner_id": "2761739", "product_id": "bupsijolpys178ut", "product_name": "SWS05HA Wi-Fi Motion Sensor", "status": [ { "code": "temper_alarm", "value": true } ], "sub": false, "time_zone": "+10:00", "uid": "eu15452257318457LSkh", "update_time": 1636452042, "uuid": "2711304024a16036c4ff" } ], "last_id": "1636452042", "total": 1 }, "success": true, "t": 1636452042811 } 2021-11-09 20:00:42 DEBUG (Thread-7) [tuya iot] Request: method = GET, url = https://openapi.tuyaeu.com/v1.0/devices/2711304024a16036c4ff/specifications, params = None, body = None, t = 1636452042980 2021-11-09 20:00:43 DEBUG (Thread-7) [tuya iot] Response: { "result": { "category": "pir", "functions": [], "status": [ { "code": "temper_alarm", "type": "Boolean", "values": "{}" } ] }, "success": true, "t": 1636452043156 } 2021-11-09 20:00:43 DEBUG (Thread-7) [custom_components.tuya_v2] Add device category->pir; domain-> binary_sensor 2021-11-09 20:00:43 DEBUG (MainThread) [custom_components.tuya_v2.binary_sensor] binary sensor add->['2711304024a16036c4ff'] 2021-11-09 20:00:43 DEBUG (Thread-7) [custom_components.tuya_v2] Add device category->pir; domain-> sensor 2021-11-09 20:00:43 DEBUG (Thread-7) [tuya iot] stop 2021-11-09 20:00:43 DEBUG (Thread-7) [tuya iot] _on_log: Sending DISCONNECT 2021-11-09 20:00:43 DEBUG (Thread-7) [tuya iot] start 2021-11-09 20:00:43 DEBUG (Thread-70) [tuya iot] Request: method = POST, url = https://openapi.tuyaeu.com/v1.0/iot-03/open-hub/access-config, params = None, body = {'uid': '', 'link_id': '', 'link_type': 'mqtt', 'topics': 'device', 'msg_encrypted_version': '1.0'}, t = 1636452043348 2021-11-09 20:00:43 DEBUG (Thread-7) [tuya iot] _on_log: Received PUBLISH (d0, q0, r0, m0), 'cloud/token/in/db176e44819e2dd1c012cca724b4f5d9', ... (265 bytes) 2021-11-09 20:00:43 DEBUG (Thread-7) [tuya iot] payload-> b'{"data":"534L08dv+WUsTz3H+UxBDZGtbDFgtM5XPGM9gP2jkc1INasllLya7KxjWSWwsIU677i556chisSLCMNMhG1ETy1jYsughtoR0AKH7bpUVQ7p9if0pGqR3TSEqVRjLv6P3Cg2+kJYNy91ZcwiT/ZHB6FArsmTGekokXRtHJrUnHQ=","protocol":20,"pv":"2.0","sign":"188e127614d870c192b5a68801a6f5f9","t":1636452042}' 2021-11-09 20:00:43 DEBUG (Thread-7) [tuya iot] on_message: {'data': {'bizCode': 'online', 'bizData': {'time': 1636452042}, 'devId': '2711304024a16036c4ff', 'productKey': 'bupsijolpys178ut', 'ts': 0}, 'protocol': 20, 'pv': '2.0', 'sign': '188e127614d870c192b5a68801a6f5f9', 't': 1636452042} 2021-11-09 20:00:43 DEBUG (Thread-7) [tuya iot] disconnect 2021-11-09 20:00:43 DEBUG (MainThread) [custom_components.tuya_v2.sensor] sensor add-> ['2711304024a16036c4ff'] 2021-11-09 20:00:43 DEBUG (Thread-70) [tuya iot] Response: { "result": { "client_id": "", "expire_time": 6916, "password": "", "sink_topic": { "device": "cloud/token/out/{device_id}" }, "source_topic": { "device": "cloud/token/in/db176e44819e2dd1c012cca724b4f5d9" }, "url": "ssl://m1.tuyaeu.com:8883", "username": "cloud_db176e44819e2dd1c012cca724b4f5d9" }, "success": true, "t": 1636452043577 } 2021-11-09 20:00:43 DEBUG (Thread-70) [tuya iot] connecting ssl://m1.tuyaeu.com:8883 2021-11-09 20:00:44 DEBUG (Thread-70) [tuya iot] _on_log: Sending CONNECT (u1, p1, wr0, wq0, wf0, c1, k60) client_id=b'cloud_ea4db4b22ff471ffad9f06b9ae89baa2' 2021-11-09 20:00:45 DEBUG (Thread-71) [tuya iot] _on_log: Received CONNACK (0, 0) 2021-11-09 20:00:45 DEBUG (Thread-71) [tuya iot] connect flags->{'session present': 0}, rc->0 2021-11-09 20:00:45 DEBUG (Thread-71) [tuya iot] _on_log: Sending SUBSCRIBE (d0, m1) [(b'cloud/token/in/db176e44819e2dd1c012cca724b4f5d9', 0)] 2021-11-09 20:00:45 DEBUG (Thread-71) [tuya iot] _on_log: Received SUBACK 2021-11-09 20:00:45 DEBUG (Thread-71) [tuya iot] _on_subscribe: 1 2021-11-09 20:01:45 DEBUG (Thread-71) [tuya iot] _on_log: Sending PINGREQ 2021-11-09 20:01:46 DEBUG (Thread-71) [tuya iot] _on_log: Received PINGRESP 2021-11-09 20:02:06 DEBUG (MainThread) [custom_components.tuya_v2] integration unload 2021-11-09 20:02:08 DEBUG (MainThread) [tuya iot] stop 2021-11-09 20:02:08 DEBUG (MainThread) [tuya iot] _on_log: Sending DISCONNECT 2021-11-09 20:02:08 DEBUG (MainThread) [custom_components.tuya_v2] tuya.init.async_setup_entry-->{'o0o0o0': '0f4243ac5c716ed9e49a678c0eec75c6fd58c2bcdbae8bfcdddd8b4bf41d2bd9dd875a6b96e93a614600c20c391fc33113d19279a5e46d658da52e9e7e70a1e03cebeb4f89981c3c40211435cb53f7d7b6ecbf7deb2a3e51df15aefd2b711ffa4647184c47f6eaccd7c407ab766eec39829a0dd686a5d9cc0a5902fe3fc9681ec07470aea42283f731a872d9cd3f033692d60e4e659cd5938a300b55f9a31c81c1d0c2375fdafafa2ba3102ce13383613baec7cb574898706d8e6f22c4809e106593ed32b8b9645eecd6dbd54701f236dd764f243452791f27156682d865f13a808d5f2899bc09a17cfe98b0e01b635fcfd31efc4de1894f4fc6da0f79ff98c3328f5d7e5070f1c7f78c24a52e6d21384eb10e61bd25d17602a9238ab9cb64c7', '00oo00': 'EVkDXgAXQVdATlJODFoHR0NYQh4IDV8JEUIQF1RWCUM=', 'oo00oo': 'e5f8861e89f7fb01100d8c2842336a0bd554e476ece8d7597e02086a34ded76b'} 2021-11-09 20:02:08 INFO (MainThread) [custom_components.tuya_v2] tuya.init.exist_xor_cache-->True 2021-11-09 20:02:08 DEBUG (SyncWorker_6) [tuya iot] Request: method = POST, url = https://openapi.tuyaeu.com/v1.0/iot-01/associated-users/actions/authorized-login, params = None, body = {'username': 'daniel.craig.williams@gmail.com', 'password': '', 'country_code': '+61', 'schema': 'smartlife'}, t = 1636452128092 2021-11-09 20:02:08 DEBUG (Thread-71) [tuya iot] disconnect 2021-11-09 20:02:09 DEBUG (SyncWorker_6) [tuya iot] Response: { "result": { "access_token": "", "expire_time": 7200, "platform_url": "https://openapi.tuyaeu.com", "refresh_token": "", "uid": "" }, "success": true, "t": 1636452129364 } 2021-11-09 20:02:09 DEBUG (MainThread) [tuya iot] start 2021-11-09 20:02:09 DEBUG (Thread-83) [tuya iot] Request: method = POST, url = https://openapi.tuyaeu.com/v1.0/iot-03/open-hub/access-config, params = None, body = {'uid': '', 'link_id': '', 'link_type': 'mqtt', 'topics': 'device', 'msg_encrypted_version': '1.0'}, t = 1636452129541 2021-11-09 20:02:09 DEBUG (SyncWorker_5) [tuya iot] Request: method = GET, url = https://openapi.tuyaeu.com/v1.0/users/eu15452257318457LSkh/devices, params = None, body = None, t = 1636452129545 2021-11-09 20:02:10 DEBUG (SyncWorker_5) [tuya iot] Response: { "result": [ { "active_time": 1636452039, "biz_type": 18, "category": "pir", "create_time": 1636446703, "icon": "smart/icon/ay1536534747810ekKBj/9c0dbbf9979bfbe33add2bec8c4360b0.png", "id": "2711304024a16036c4ff", "ip": "", "lat": "", "local_key": "", "lon": "", "model": "SWS05HA", "name": "Orion Wi-Fi Motion Sensor", "online": true, "owner_id": "2761739", "product_id": "bupsijolpys178ut", "product_name": "", "status": [ { "code": "temper_alarm", "value": true } ], "sub": false, "time_zone": "+10:00", "uid": "***", "update_time": 1636452042, "uuid": "2711304024a16036c4ff" },

Additional context Add any other context or logs about the problem here.

rognets commented 1 year ago

I have the same unit installer with Tuya. Linked into HA, tamper only sensor, no movement sensor