Open guidohaesen opened 2 years ago
tuya documentation tuya source (message by IssueLinks)
Hey there @tuya, @zlinoliver, @metisu, @frenck, mind taking a look at this issue as it has been labeled with an integration (tuya
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
You can help us with this issue by providing some information about your device.
To do that, please follow the next steps:
From this debugger, we can get some information that can be useful. From the "Basic Information" tab, please provide:
Next, click on the "Device Debugging" tag. Once on that tab, you will find a small link called "JSON Editing", click on that link. It will now show a text field called JSON_EDITOR
with some code in it. It looks something like this:
Copy and share that code from that text field into this issue.
Additional, the model of the device as shown in Home Assistant might be helpful too! Thanks already 👍
That will help a lot! Thanks already!
../Frenck
Device Information Product Name LSC SMART Connect Motion Sensor Product Category pir Device Status Online
JSON_EDITOR is Empty. aha. :-)
Let's see, i have another type of PIR sensor, also LSC :-)
Device Information Product Name LSC PIR SENSOR Product Category pir Device Status Online
JSON_EDITOR is also empty. But the device log isn't, see image
Thanks Guido
Meh ok, that is odd, the debugger not debugging is not going to help us I guess...
Could you enable debug logging for the Tuya integration?
https://www.home-assistant.io/integrations/logger
logger:
homeassistant.components.tuya: debug
And see if you get any debug logs when the device triggers motion.
Only i can see in the log is that the battery is sending data: 2021-10-28 22:29:27 DEBUG (Thread-4) [homeassistant.components.tuya] Received update for device 20401777500291cf8fd5: {'pir': 'pir', 'battery_state': 'high'} 2021-10-28 22:29:28 DEBUG (Thread-4) [homeassistant.components.tuya] Received update for device 20401777500291cf8fd5: {'pir': 'pir', 'battery_state': 'high'} 2021-10-28 22:29:28 DEBUG (Thread-4) [homeassistant.components.tuya] Received update for device 20401777500291cf8fd5: {'pir': 'pir', 'battery_state': 'high'} 2021-10-28 22:29:33 DEBUG (Thread-4) [homeassistant.components.tuya] Received update for device 038880662462ab13f717: {'pir': 'pir', 'battery_state': 'high'} 2021-10-28 22:29:33 DEBUG (Thread-4) [homeassistant.components.tuya] Received update for device 038880662462ab13f717: {'pir': 'pir', 'battery_state': 'high'} 2021-10-28 22:29:42 DEBUG (Thread-4) [homeassistant.components.tuya] Received update for device 038880662462ab13f717: {'pir': 'pir', 'battery_state': 'high'} 2021-10-28 22:29:42 DEBUG (Thread-4) [homeassistant.components.tuya] Received update for device 038880662462ab13f717: {'pir': 'pir', 'battery_state': 'high'} 2021-10-28 22:29:43 DEBUG (Thread-4) [homeassistant.components.tuya] Received update for device 038880662462ab13f717: {'pir': 'pir', 'battery_state': 'middle'}
noting about the movement status. or should i look elsewhere?
There is no state indeed, so it cannot reflect the state in Home Assistant either.
I'll try the Action tomorrow, see if I can get my hand on one / if they are in stock again.
Action doesn;t sell them anymore, On Bol.com you can find the same sensors with a diffrent name: Calex. Or i can send you one of mine sensors, so you can test.
OK. i'll unpair and pair again a pir sensor in tuya app, see if that is a solution. Strange thing is that the sensors work under Tuya V2, Have a great night. Guido
Strange thing is that the sensors work under Tuya V2,
That is interesting!
Aah I see, the implemented a "fake" PIR.
if self._code == DPCODE_PIR:
pir_range = json.loads(
self.tuya_device.status_range.get(DPCODE_PIR, {}).values
).get("range")
if len(pir_range) == 1 and self.tuya_device.status[DPCODE_PIR] == "pir":
timer = Timer(10, lambda: self.reset_pir())
timer.start()
Hmmm not sure yet how to handle that, ideally this becomes an event
Do you also get a debug log when there isn't movement anymore?
Morning, no nothing. The logs shows only the battery status. every x minutes. No motions on the pirs only movements on the cameras, thats new :-)
2021-10-28 23:15:01 DEBUG (Thread-4) [homeassistant.components.tuya] Received update for device 038880662462ab13f717: {'pir': 'pir', 'battery_state': 'middle'}
If i check logs in iot tuya, i see at the same time a movement instead of battery nfo, see image.
Got a PR opened for a suggested fix in #58673
Hey Frenck, i see the word FIX :-) Can i test someting for you or should i wait till next release? Groetjes Guido
Let's see if it gets approved, if so, it will probably be in one of the next beta's for you to test out. I've been able to test it.
The solution isn't accepted by the reviewers, therefore it won't be fixed.
I saw it. too bad. So i need to buy different sensors or go back to V2? Thanks for the work you did.
Same problem here, following device info requested
Device 1 Device Information Product Name 大屏-PIR 传感器 Product Category pir JSON_EDITOR empty
Device 2 Device Information Product Name WIFI人体红外探测器 Product Category pir JSON_EDITOR empty
But in my case i see device log
@antoweb As you can read above, the reason why was already clear. No additional logs or debugs are needed.
this problem still not fixed ? i have the same problem 👎
I have the same issue but not constant. The motion sensor works fine right after I reload the Tuya integration. At some point in time it seems to stop reporting motion to home assistant (or home assistant stops receiving), not clear yet what breaks the communication.
I don't tamper a lot but when I do I immediately get an home assistant notification (because of an automation i made) so it seems to be limited to reporting motion.
So I reload the Tuya integration from time to time. In the mean time I use a trick to get motion reported (in my case only if the sun is down); in the Smartlife app I have a simple automation that turns on a light if motion is detected. In home assistant I have an automation that detects this light being on and then turns on a boolean that stands for 'motion detected'. Another automation checks for a difference in time between motion sensor last_updated en boolean_motion last_updated and lets me know I have to reload. I don't do this automatically (yet) because it triggers an tampering critical notification which could get me worried without reason.
@JeeWee65 Same issue here. I notice it since version 2021.12.2. It was working well before. The status is always reported in SmartLife App. If I restart HA (or the integration) it will work correctly for approx. an hour or two. Then the PIR sensor statis is no longer received by Home Assistant.
Any news about this issues? My sensor always report "revelated"
I'm very glad! It seems fixed since 2021.12.7 (or .6 which downgraded from because of frontend issues), since that up-date I have not seen any problems with the motion sensors status getting through to home assistant. Thank you to whoever contributed to the solution!
Not mine. Mine sensore still not work good
Am having same issue as @antoweb Its most probably same product: Product Name WIFI人体红外探测器 Any ideas?
Thank you all!
I only see a "tamper" entity for both my motion sensors, no motion entity in HA at all. These are Orion-branded PIR sensors (SWS05HA Wi-Fi Motion Sensor) and I do see the motion reported in both Smart Life app and the Tuya iot platform. Also no idea how to reset the tamper flag :)
I have the same issue as reported above, but mine is a z-wave sensor through a SmartThings hub (integration through Nabu Casa). The SmartThings app reports the correct state, but in home assistant the state is never reset (i.e. it stays in a "motion detected" state). Not sure exactly when it started, but its been working fine for well over a year until I upgraded to one of the later 2021.12 versions (I'm currently on 2021.12.10)
but mine is a z-wave sensor through a SmartThings hub (integration through Nabu Casa).
That is not related to this issue, as this issue is about the Tuya integration.
I'm aware this is about the Tuya integration, just saying it could potentially be related.
@ksamuelsen It isn't related, sorry.
I have a similar issue, after a reboot the sensor works for a random amount of time ... But it just stops working and shows 'detected' state constantly. Therefore messing up any automations I have set.
I see that my sensor has slightly different instruction set compared to OP. Mine has range: ['pir','none'] whilst OP has range: ['pir'] only
So there seem to be slight differences in different devices
This is my device logs (after standardisation)
tuya-996260cbe19bdb970528dd3ca8175ff3-Sensore Presenza Portone-1632067c534e56e34c3798cf3f999378.json.txt. tuya-996260cbe19bdb970528dd3ca8175ff3-Sensore Presenza scala-73a7b7cd0c9b2a263a9da4a0f7cb2a66.json.txt
I have two pir sensor tuya different models. Both remain in reveleaded state in tuya app works good
Same with a Lenovo Smart Motion Sensor (LE-741m). It only fires a detect event.
My total guess is that perhaps this is by design and Tuya expect the API using apps to handle status handling within their app themselves..?
Same issue with the LSC PIR Sensors
Same issue with the LSC PIR Sensors
Yeah, I am using LSC PIR Sensors and state in HA stuck on "on". Very annoying. :(
Hi, I also had the issue where the state of an LSC PIR sensor integrated through the official Tuya integration would stay stuck in dtetected mode and worked around it. Not pretty, but the values in the dashboard and automations now work for me.
What I did was add an automation that every minute checks if the sensor is in the detected state and if so, resets the state using the script at https://github.com/xannor/hass_py_set_state .
As said, this is not a proper fix, but it seems to make the sensor usable for me until a proper fix arrives. Hope it is helpful.
- id: '1650740104498'
alias: Pir fix
description: ''
trigger:
- platform: time_pattern
minutes: '*'
condition:
- type: is_motion
condition: device
device_id: 4812adf287e0a645ba7beca17284zzz
entity_id: binary_sensor.smart_motion_sensor
domain: binary_sensor
action:
- service: python_script.set_state
data_template:
entity_id: binary_sensor.smart_motion_sensor
state: 'off'
mode: single
@remcostr thank you very much, I think it's a quite smart solution👍 Just my automation looks different. There should be no need to reset the state periodically.
I do reset the state to normal (off) on homeassistant start and when it gets changed via tuya to on and then lasts for 15s. Within this automation there should be no condition at all otherwise it may fail to reset the state!
Conditions like 'at night time only' have to be placed into the other automations which use this motion binary_sensor.
For my example the entity_id is binary_sensor.pir_sensor_carport
- id: '1650973385463'
alias: PIR Carport set state normal
description: ''
trigger:
- platform: state
entity_id: binary_sensor.pir_sensor_carport
to: 'on'
for:
hours: 0
minutes: 0
seconds: 15
from: 'off'
- platform: homeassistant
event: start
condition: []
action:
- service: python_script.set_state
data_template:
entity_id: binary_sensor.pir_sensor_carport
state: 'off'
mode: single
Hi, I also had the issue where the state of an LSC PIR sensor integrated through the official Tuya integration would stay stuck in dtetected mode and worked around it. Not pretty, but the values in the dashboard and automations now work for me.
What I did was add an automation that every minute checks if the sensor is in the detected state and if so, resets the state using the script at https://github.com/xannor/hass_py_set_state .
As said, this is not a proper fix, but it seems to make the sensor usable for me until a proper fix arrives. Hope it is helpful.
Hello, better solution for me is to create an automation that if sensor state goes from off to on set state to off after some seconds (after do something like create notification or something else)
@remcostr thank you very much, I think it's a quite smart solution👍 Just my automation looks different. There should be no need to reset the state periodically.
I do reset the state to normal (off) on homeassistant start and when it gets changed via tuya to on and then lasts for 15s. Within this automation there should be no condition at all otherwise it may fail to reset the state!
Conditions like 'at night time only' have to be placed into the other automations which use this motion binary_sensor.
Yes, that is a more elegant version of the workaround. The main idea was indeed to have an isolated rule that only fixes the sensors behavior , so that other automations can use the "fixed" sensor state and if the sensor ever get fixed, only the workaround needs to be removed.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
I have updated HA to the newest version and verified issue with LSC PIR Sensors. Issue is still not fixed. Showing "Detected" status all the time after first detection.
Status is not getting reset at all. The "Not detected" status is shown only after HA reboot and only until first detection. Then status getting stuck on "Detected" forever until next HA reboot.
Hello, I have exactly the same problem. Updated to the latest version and only reports "Detected" status. The same device as my colleague above.
So, what's the final conclusion on this? I see @frenck tried to get a workaround going with a PR to the Core, but it got refused (for code standards reasons?) and... no solution is possible? So all simple PIR sensors will never work correctly because of code standards?
A couple of days ago I found this: https://github.com/tuya/tuya-home-assistant/issues/144, which I guess got abandoned when the integration was moved here. I wonder if it's possible to revisit the issue and think again about the previous solution, or find a new one?
I understand it's indeed common for simpler PIR sensors to only report detection (to save battery, I guess?), leaving to the client software decide when it will consider the location stale again - after 10s or 2min, for instance. As mentioned earlier by Frenck, this is common behavior for many sensors in the market. Thus, it makes no sense telling the user to write a manual boolean and automation to take care of this - for every sensor of this type they have.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
I have updated HA to the newest version and verified issue with LSC PIR Sensors. Nothing changed. Issue is still not fixed. Showing "Detected" status all the time after first detection.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
Updated to the newest version, but issue is not fixed.
The problem
Hello hard working devs and testers,
I installed Home Assistant 2021.11.0b0 today, and specially for the Tuya integration. I deleted V2 and started over with the build in integration. And i must say, AWESOME.
But, there is always a but :-) the PIR sensors doesn’t update. It doesn’t release detected status. The door sensors works as it should.
Next test: Tuya Water Cooker 😀
What version of Home Assistant Core has the issue?
Home Assistant 2021.11.0b0
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Tuya
Link to integration documentation on our website
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response