-
Notifications
You must be signed in to change notification settings - Fork 740
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
Fix Linkind motion sensor detection #2874
Fix Linkind motion sensor detection #2874
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #2874 +/- ##
=======================================
Coverage 87.50% 87.50%
=======================================
Files 292 292
Lines 8952 8954 +2
=======================================
+ Hits 7833 7835 +2
Misses 1119 1119 ☔ View full report in Codecov by Sentry. |
I can confirm this resolved the issue I was having. The status of the motion sensor now remains 'Detected' as long as motion is ongoing. 60 seconds after motion ceases, the status reverts to 'Cleared'. Thank you!! |
Awesome, thanks for letting me know! |
I can also confirm that this quirk resolves the issue of no motion detection in dark. Log section below. Deactivation, activation, and deactivation in the darkLogbook: motion ZB-Motion Sensor-D0003 cleared (no motion detected) ZCL Log:
|
Fixes the issue where Linkind motion sensors get reset after 60 seconds (during continuous motion). Also fixes the issue where "brightness" triggers the motion entity.
There's a lot to read here, was there a problem with the Linkind semsor staying ON, as 24/7 detecting? I have that problem, and also with ZHA still showing it detecting with the battery removed. ?? |
Fixes the issue where Linkind motion sensors get reset after 60 seconds (during continuous motion). Also fixes the issue where "brightness" triggers the motion entity.
Proposed change
Fixes the issue where Linkind motion sensors get reset after 60 seconds (during continuous motion).
Also fixes the issue where brightness triggers the motion entity.
Explanation
According to the OP in #1291, the Linkind motion sensor uses three bits for the IasZone
zone_status
:Alarm_1
for detected motionAlarm_2
for detected brightnesstamper
for detected tamperZHA currently creates a binary sensor for motion, but turns it on if either
Alarm_1
orAlarm_2
is set to1
.As we want to ignore the brightness bit for the motion sensor entity, this PR modifies the quirk to always ignore the
Alarm_2
bit on this motion sensor, so onlyAlarm_1
(motion) is considered for the motion sensor entity.A test to verify the added code works was also added.
Previous quirk with timeout to reset
#2130 added a quirk which reset the motion sensor after a timeout (expecting continuous reports every 60 seconds).
This caused issues for some users at least (perhaps different firmware versions?).
Z2M does not use a timeout to reset the sensor, so we likely also shouldn't.
In #2225, @jasongabler removed the added quirk entirely and the motion sensors started working again. (Maybe old versions do not use the
Alarm_2
bit for brightness at all?)If you're around, can you try this version of the quirk to see if it (still) works for you?
@LAHA2 Please also confirm if this works.
@1jk, @jfrux, @dmackenzie123, @TheRealSimon42 were the ones that had issues with the motion sensor getting stuck.
If you can, please also try if this quirk version (still) works for you.
Install as a custom quirk:
To install this as a custom quirk, download the the
motion.py
file.Then, add this to your HA
configuration.yaml
. Copy the downloaded.py
file in the (newly) createdcustom_zha_quirks
directory and restart HA.Additional information
Fixes #2225, fixes #1291
Partly reverts #2130 / commit 7f5c506.
Checklist
pre-commit
checks pass / the code has been formatted using Black