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

PIR WIFI sensor does not changing statuses in HA (motion/no motion) #144

Open
alexreddy78 opened this issue Jul 14, 2021 · 31 comments
Open
Labels
enhancement Request new features
Milestone

Comments

@alexreddy78
Copy link

{
"result": {
"active_time": 1600712608,
"biz_type": 18,
"category": "pir",
"create_time": 1600712608,
"icon": "smart/icon/ay1524194438166Zg2hZ/c3db264e1bc8e6ab11cf88171e87dc39.jpg",
"id": "",
"ip": "",
"lat": "",
"local_key": "",
"lon": "",
"name": "Душ",
"online": true,
"owner_id": "16305239",
"product_id": "XFD2nSDKxFlGV5sV",
"product_name": "PIR Sensor",
"status": [
{
"code": "pir",
"value": "pir"
},
{
"code": "battery_value",
"value": 81
}
],
"sub": false,
"time_zone": "+03:00",
"uid": "eu1600250372644kZmGd",
"update_time": 1626249312,
"uuid": "20372743500291bb1b9e"
},
"success": true,
"t": 1626254980444
}
Device specifications (please complete the following information, which can be found in log):
{
"result": {
"category": "pir",
"functions": [],
"status": [
{
"code": "pir",
"type": "Enum",
"values": "{"range":["pir","none"]}"
},
{
"code": "battery_value",
"type": "Integer",
"values": "{"unit":"","min":0,"max":10000,"scale":0,"step":1}"
}
]
},
"success": true,
"t": 1626255049113
}

@alexreddy78 alexreddy78 added enhancement Request new features help wanted Extra attention is needed labels Jul 14, 2021
@alexreddy78 alexreddy78 changed the title PIR WIFI sensor PIR WIFI sensor does not changing statuses in HA (motion/no motion) Jul 14, 2021
@MickW69
Copy link

MickW69 commented Jul 14, 2021

Me too, Arlec movement sensor and door sensor, neither send updates.

@saharajesh880
Copy link

Same here, tuya and sonoff motion sensor and tuya door sensor are not updating the status on HA

@schmurrie
Copy link

Same here with the arlec units. Only updates when you restart HA

@alexreddy78
Copy link
Author

@tsutsuku after update to v 1.3.2 issue still exist. Status of PIR is not changing in HA. I am wondering: was the latest update related to PIR status or it was fix for something else?

Regards!

@tsutsuku
Copy link
Collaborator

#113

@alexreddy78
Copy link
Author

alexreddy78 commented Jul 17, 2021

@tsutsuku I have already subscription to Device status notification and my door sensor is OK, but PIR is not updating statuses... :(
Any advise? May be it is the same issue as ticket "motion sensor not changing states #57"

@alexreddy78
Copy link
Author

Even in API Explorer -> Get Device status sensor always show state: PIR, however in Tuya Smart Life app IOS works normal
{
"result": [
{
"code": "pir",
"value": "pir"
},
{
"code": "battery_value",
"value": 59
}
],
"success": true,
"t": 1626516376612
}

@alexreddy78
Copy link
Author

@tsutsuku Dear, Tsutsuku
Kindly advise on above mentioned problem.

Regards

@alexreddy78
Copy link
Author

@saharajesh880 @schmurrie How is yours? Still no updates for PIR sensors?

@schmurrie
Copy link

Still no updates, still not working unfortunately

@fredrikbuchanan
Copy link

I have the same issue with ,
Device normal info

Brand: Nedis
Model: WIFISM10CWT SmartLife Motion Sensor
Device info (please complete the following information, which can be found in log):
like this:
{
"active_time": 1620134241,
"biz_type": 18,
"category": "pir",
"create_time": 1620080030,
"icon": "smart/icon/1533129428eg81rzdqpg_0.png",
"id": "08325122dc4f225c3a75",
"ip": "85.229.11.195",
"lat": "59.2357956",
"local_key": "0402a6e0990a6952",
"lon": "18.1016498",
"model": " WIFISM10CWT ",
"name": "Motion Sensor",
"online": true,
"owner_id": "28575566",
"product_id": "saMa30bbTOq0nxUz",
"product_name": "Motion Sensor",
"status": [],
"sub": false,
"time_zone": "+01:00",
"uid": "eu16173965733970jJ4t",
"update_time": 1626771870,
"uuid": "08325122dc4f225c3a75"
}

2021-07-22 15:03:45 DEBUG (SyncWorker_7) [tuya iot] Request: method = GET, url = https://openapi.tuyaeu.com/v1.0/devices/08325122dc4f225c3a75/specifications, params = None, body = None, headers = {'client_id': '4c8ts7yyarsuyqlsz7e9', 'sign': '603E169B63663384CFB7409AD2F86EF4D960A217A48C6119D159F5056ADC2A68', 'sign_method': 'HMAC-SHA256', 'access_token': 'a617ab41e4a5d1022eca34c026fab79b', 't': '1626959025437', 'lang': 'en'}
2021-07-22 15:03:45 DEBUG (Thread-5) [tuya iot] _on_log: Received CONNACK (0, 0)
2021-07-22 15:03:45 DEBUG (Thread-5) [tuya iot] connect flags->{'session present': 0}, rc->0
2021-07-22 15:03:45 DEBUG (Thread-5) [tuya iot] _on_log: Sending SUBSCRIBE (d0, m1) [(b'cloud/token/in/5c946888fc26abbfbffa02c48eb6bc86', 0)]
2021-07-22 15:03:45 DEBUG (SyncWorker_7) [tuya iot] Response: {
"code": 2009,
"msg": "not support this device",
"success": false,
"t": 1626959025474
}
2021-07-22 15:03:45 DEBUG (Thread-5) [tuya iot] _on_log: Received SUBACK
2021-07-22 15:03:45 DEBUG (Thread-5) [tuya iot] _on_subscribe: 1

this is now added to the api and i can se it in ha but it does not update it's status

@alexreddy78
Copy link
Author

@tsutsuku Pls advise if any updates on that?

REGARDS

@tsutsuku
Copy link
Collaborator

@fredrikbuchanan You can create a ticket in the Tuya service console with your device specifications.
https://service.console.tuya.com/8/2/create?step=3&id=01030503&source=content_feedback.

@tsutsuku
Copy link
Collaborator

@alexreddy78 Can you provide more logs with [tuya-openmq]?

@fredrikbuchanan
Copy link

@fredrikbuchanan You can create a ticket in the Tuya service console with your device specifications.
https://service.console.tuya.com/8/2/create?step=3&id=01030503&source=content_feedback.

I have already done that, and it looks ok i think on that end. i can get updated status if i reload the integration.
i can se if i can give you more logs

@alexreddy78
Copy link
Author

@alexreddy78 Can you provide more logs with [tuya-openmq]?

Dear @tsutsuku
There is nothing in the HA LOGS except flw:

curl --request GET "https://openapi.tuyaeu.com/v1.0/devices/20372743500291d443e2/specifications" --header "sign_method: HMAC-SHA256" --header "client_id: mp9ctfjgaq07xr07ytc4" --header "t: 1627460652295" --header "mode: cors" --header "Content-Type: application/json" --header "sign: 5F9442D030934ACFE8BCEE51899EE757A6A2585C27D4ECCCF262C1F47677DD38" --header "access_token: "
ResponseCopy
{
"result": {
"category": "pir",
"functions": [],
"status": [
{
"code": "pir",
"type": "Enum",
"values": "{"range":["pir","none"]}"
},
{
"code": "battery_value",
"type": "Integer",
"values": "{"unit":"","min":0,"max":10000,"scale":0,"step":1}"
}
]
},
"success": true,
"t": 1627460652526
}

And what is tuya-openmq? How to get to this?

Pls advise.

REGARDS

@alexreddy78
Copy link
Author

@tsutsuku Dear Tsutsuku,

More LOGS for you, pls:

2021-07-30 11:53:48 DEBUG (Thread-5) [tuya iot] _on_log: Received PUBLISH (d0, q0, r0, m0), 'cloud/token/in/2cfcb55b3ee5999bd082303589366df0', ... (265 bytes)
2021-07-30 11:53:48 DEBUG (Thread-5) [tuya iot] payload-> b'{"data":"P1/7OMAihGrtv15wcMEV3GGuWEtvVo3grB8Z3EdTdRmwND5ZjUQI+1qtUTekdTzylIGjRxUWp3Zs0nzc7ro10TpGW002j4kX48LSje3cuQbBOpC+rG/fsz1lfw27Cv5hAYoULBmZNJRvNKzZeDWNwh0R41ILSZyEQbBNNbYsxVI=","protocol":20,"pv":"2.0","sign":"0ec7639add23a34c60ca5334b991e0e1","t":1627635228}'
2021-07-30 11:53:48 DEBUG (Thread-5) [tuya iot] on_message: {'data': {'bizCode': 'online', 'bizData': {'time': 1627635228}, 'devId': '20372743500291d443e2', 'productKey': 'XFD2nSDKxFlGV5sV', 'ts': 0}, 'protocol': 20, 'pv': '2.0', 'sign': '0ec7639add23a34c60ca5334b991e0e1', 't': 1627635228}
2021-07-30 11:53:48 DEBUG (Thread-5) [tuya iot] mq receive-> {'data': {'bizCode': 'online', 'bizData': {'time': 1627635228}, 'devId': '20372743500291d443e2', 'productKey': 'XFD2nSDKxFlGV5sV', 'ts': 0}, 'protocol': 20, 'pv': '2.0', 'sign': '0ec7639add23a34c60ca5334b991e0e1', 't': 1627635228}
2021-07-30 11:53:48 DEBUG (Thread-5) [tuya iot] mq _on_device_other-> 20372743500291d443e2 -- online
2021-07-30 11:53:48 DEBUG (Thread-5) [custom_components.tuya_v2] _update--><custom_components.tuya_v2._init_tuya_sdk..DeviceListener object at 0xacc31f10>;->>{'pir': 'pir', 'battery_value': 100}
2021-07-30 11:53:49 DEBUG (Thread-5) [tuya iot] _on_log: Received PUBLISH (d0, q0, r0, m0), 'cloud/token/in/2cfcb55b3ee5999bd082303589366df0', ... (348 bytes)
2021-07-30 11:53:49 DEBUG (Thread-5) [tuya iot] payload-> b'{"data":"2pKHDPR2TVv0C5mj2EGcxflxUp/PotTb5EYsXnXepBsq/ooloDLyzgxP3vOvlgzJgWunHA8l2tp3Vnaq59TWzvEP2uej/ymoNHdWVozfQT3mJNft/DhjdVN4Z1s4B9FT6citjzFsjQGl0d00TATlHIYdO/0MUwJrkhzUXCeaeTZuyBI62+s0h2SeOyfolUiMPHrgCFnHEtahvDoEum+npNPzREIn7321gBkMCo0VXuTktO1+E64jkHwh9/px37T4","protocol":4,"pv":"2.0","sign":"97e20595e70ea57619b9bca14f495683","t":1627635228}'
2021-07-30 11:53:49 DEBUG (Thread-5) [tuya iot] on_message: {'data': {'dataId': '28a28ebc-cd16-4c52-85aa-fea43ed5ccc0', 'devId': '20372743500291d443e2', 'productKey': 'XFD2nSDKxFlGV5sV', 'status': [{'101': 'pir', 'code': 'pir', 't': '1627635228', 'value': 'pir'}]}, 'protocol': 4, 'pv': '2.0', 'sign': '97e20595e70ea57619b9bca14f495683', 't': 1627635228}
2021-07-30 11:53:49 DEBUG (Thread-5) [tuya iot] mq receive-> {'data': {'dataId': '28a28ebc-cd16-4c52-85aa-fea43ed5ccc0', 'devId': '20372743500291d443e2', 'productKey': 'XFD2nSDKxFlGV5sV', 'status': [{'101': 'pir', 'code': 'pir', 't': '1627635228', 'value': 'pir'}]}, 'protocol': 4, 'pv': '2.0', 'sign': '97e20595e70ea57619b9bca14f495683', 't': 1627635228}
2021-07-30 11:53:49 DEBUG (Thread-5) [tuya iot] mq _on_device_report-> [{'101': 'pir', 'code': 'pir', 't': '1627635228', 'value': 'pir'}]
2021-07-30 11:53:49 DEBUG (Thread-5) [custom_components.tuya_v2] _update--><custom_components.tuya_v2._init_tuya_sdk..DeviceListener object at 0xacc31f10>;->>{'pir': 'pir', 'battery_value': 100}
2021-07-30 11:53:49 DEBUG (Thread-5) [tuya iot] _on_log: Received PUBLISH (d0, q0, r0, m0), 'cloud/token/in/2cfcb55b3ee5999bd082303589366df0', ... (348 bytes)
2021-07-30 11:53:49 DEBUG (Thread-5) [tuya iot] payload-> b'{"data":"jX7kT2p+sev35mnB41ijkWZtHucJxcjurX7E6Yu15CKePfVDmYWP8SXymo+c5akegWunHA8l2tp3Vnaq59TWzvEP2uej/ymoNHdWVozfQT3mJNft/DhjdVN4Z1s4B9FT6citjzFsjQGl0d00TATlHP/WK40WNd0ed65rAexMvASUKBPZeQuEedA8Y5ZSoGbWoh6P2BmjTbxt4zmV0oM+pX6HdLTEXtBdwko21gFIEHmMawo8wajp4z8U2JZEUQhk","protocol":4,"pv":"2.0","sign":"9f6d85d2caaa9cf0784cb000cec67279","t":1627635228}'
2021-07-30 11:53:49 DEBUG (Thread-5) [tuya iot] on_message: {'data': {'dataId': 'bbfc5511-8f4a-4c4c-84db-2149aebfffd9', 'devId': '20372743500291d443e2', 'productKey': 'XFD2nSDKxFlGV5sV', 'status': [{'code': 'battery_value', '103': 100, 't': '1627635228', 'value': 100}]}, 'protocol': 4, 'pv': '2.0', 'sign': '9f6d85d2caaa9cf0784cb000cec67279', 't': 1627635228}
2021-07-30 11:53:49 DEBUG (Thread-5) [tuya iot] mq receive-> {'data': {'dataId': 'bbfc5511-8f4a-4c4c-84db-2149aebfffd9', 'devId': '20372743500291d443e2', 'productKey': 'XFD2nSDKxFlGV5sV', 'status': [{'code': 'battery_value', '103': 100, 't': '1627635228', 'value': 100}]}, 'protocol': 4, 'pv': '2.0', 'sign': '9f6d85d2caaa9cf0784cb000cec67279', 't': 1627635228}
2021-07-30 11:53:49 DEBUG (Thread-5) [tuya iot] mq _on_device_report-> [{'code': 'battery_value', '103': 100, 't': '1627635228', 'value': 100}]
2021-07-30 11:53:49 DEBUG (Thread-5) [custom_components.tuya_v2] _update--><custom_components.tuya_v2._init_tuya_sdk..DeviceListener object at 0xacc31f10>;->>{'pir': 'pir', 'battery_value': 100}
2021-07-30 11:54:19 DEBUG (Thread-5) [tuya iot] _on_log: Received PUBLISH (d0, q0, r0, m0), 'cloud/token/in/2cfcb55b3ee5999bd082303589366df0', ... (520 bytes)

Kindly advise

Regards

@iotinkognito
Copy link

Same Issues as #140 #57 #119 #57 #144 #271 #262

@alexreddy78
Copy link
Author

@tsutsuku Dear Tsutsuku,

Did you have a little chance and time to see LOGs above and advise if there’s any updates on issue?

REGARDS and hope hear you soon

@balouken
Copy link

balouken commented Aug 2, 2021

@tsutsuku the PIR sensor is working! But the state is never reset to OFF.
If you change state in Developer Tools to OFF, and then activated the PIR, the sensor state goes to ON... en never goes back to OFF.
Maybe add auto return to off after x seconds would do the trick?

I did a test last night.
inkom

@tsutsuku tsutsuku removed enhancement Request new features help wanted Extra attention is needed labels Aug 3, 2021
@tsutsuku tsutsuku added the bug Something isn't working label Aug 3, 2021
@tsutsuku tsutsuku added this to the v1.5.0 milestone Aug 3, 2021
@alexreddy78
Copy link
Author

@tsutsuku Dear Tsutsuku,

Any news regarding PIRs? Still not working after 1.5.0 update... :(

BRGDS

@tsutsuku
Copy link
Collaborator

@alexreddy78 PIR has two statuses normally, "pir" and "none", but some Pir only has "pir" status which is decided by the manufacturer. To these PIR sensors, the "none" status will be set by the client (like SmartLife App) after some seconds with no "pir" status received. v1.5.0 adds the same thing.
But your PIR specification has an error as its pir range is ["pir", "none"], so v1.5.0 can't recognize it to the Pir only has "pir". We are handling these devices which will be fixed soon.

@tsutsuku tsutsuku added the standardize Device need to be standardized label Aug 12, 2021
@alexreddy78
Copy link
Author

@tsutsuku Dear Tsutsuku,

Thanks for quick reply! Awesome, will wait fix from your side

Best Regards

@alexreddy78
Copy link
Author

alexreddy78 commented Aug 19, 2021

@tsutsuku Dear Tsutsuku,

As from yesterday PIR sensors are changing statuses, but there is an issue with time of OFF event. As per PIR events in Home Assistant, sensor send OFF (no motion) after 10 sec and this is a problem as origin Tuya APP and firmware is sending OFF after 2 minutes. Senors stay active in Tuya APP but in HA is shown OFF. So it means that HA send OFF too earlier and can't send ON (motion detected) for another 1.50 sec. Pls advise.

Best Regards

@tsutsuku
Copy link
Collaborator

Normally the "send OFF" is decided by the manufacturer in Tuya APP Device Panel, so it's maybe 10s for A and 2 minutes for B. So I think it better to add a NumberEntity for the "send OFF time" setting in HA. We will add this in the future.

@tsutsuku tsutsuku added enhancement Request new features and removed bug Something isn't working standardize Device need to be standardized labels Aug 20, 2021
@wongjunjin
Copy link

Dear @tsutsuku

I'm having the same issue which my PIR cannot change status. It maintains as On or Off. I can manually set it in Developer Tools.

Can you explain your last message to Alex? I dont understand about the NumberEntity. How do I go about fixing this

@wongjunjin
Copy link

For everybody who has this issue, please go here: #113

I made a mistake of not reading EVERYTHING on the main readme. Please go through ALL. Even though you think you have, please re-read. Took me so many readings to find the solution. Thanks Tuya team for being patient, (although not responding to me). :D

@iotinkognito
Copy link

o has this issue, please go here: #113

I made a mistake of not reading EVERYTHING on the main readme. Please go through ALL. Even though you think you have, please re-read. Took me so many readings to find the solution. Thanks Tuya team for being patient, (although not responding to me). :D

This is different issue. This is Bluetooth/Wifi/Zigbee PIR sensors.

@PeterKawa
Copy link

PeterKawa commented Jul 12, 2022

@alexreddy78 PIR has two statuses normally, "pir" and "none", but some Pir only has "pir" status which is decided by the manufacturer. To these PIR sensors, the "none" status will be set by the client (like SmartLife App) after some seconds with no "pir" status received. v1.5.0 adds the same thing. But your PIR specification has an error as its pir range is ["pir", "none"], so v1.5.0 can't recognize it to the Pir only has "pir". We are handling these devices which will be fixed soon.

That's exactly my PIR issue. Odd thing: they worked fine in the earlier Tuya V2 integration. Also they work fine in Athom's Homey, which uses exactly the same Tuya iot cloud project API (https://github.com/jurgenheine/com.tuya.cloud).
I've tried several scripts, automations and stuff, to clear the status 'pir', but of no avail. Only in the developer changing the status to off, by adding 'value: ' to the state attributes works.Then the state is 'off'.
Thanks in advance,
All the best

@igorsantos07
Copy link

Checking my PIR sensor's diagnostics JSON, I see it only has the "pir" status, but nonetheless it never goes back from "detected". Checking the device debugger in the Tuya web platform, I do see it's sending detection events when expected, so it seems it's just missing the auto-off which HA should be sending? Or am I missing something?

@PeterKawa
Copy link

" so it seems it's just missing the auto-off which HA should be sending? "
Exactly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Request new features
Projects
None yet
Development

No branches or pull requests