Xiaomi Vibration Sensor in ZHA

Hi!

Im running latest hassio with ZHA component and trying to create a sensor for open/closed window and vibration sensor och window for security system. The Xiaomi vibration sensor is perfect because its cheap and have both tilt and vibration. Running ZHA and not via gateway mainly because I have 20+ hue lamps on the same ZHA and therefor get a Zigbee network covering my large house.

All good so far but the vibration sensor keeps sending me notifications several times a day(without anything happening on window), its configured to sensitivity 21 (which is the lowest) and placed on the inside of my three glas windows.

Any ideas on how to use this or is it just to damn sensitive even in lowest sens mode?

Thanks in advance!!

I think my first question is are you sure it’s set to 21 sensitivity?

I’m not sure how to “verify” it but I know when I was tuning that for use on washer/drier I found even setting to 1 didn’t seem to make it more sensitive, UNTIL I tried madly mashing the little wakeup button while clicking submit to send the sensitivity value (press the button like 10x as fast as I could while clicking submit 5x) and watching the little blue LED blink as I did it. After that, I found it seemed to “take” the new sensitivity (which was way too sensitive, but proved I changed it).

I’m wondering if you did what I initially did just sending the value without keeping the sensor awake so it never heard the updated value?

Also depending on the type of window and where you put the sensor, I know wind/noise outside can “shake” window panes maybe move it to the frame and closer to a point it anchors (lock/hinge/slider) so it isn’t as likely to be shaken by wind and noise when the glass flexes.

Thanks for the reply but I’m afraid I have tested all och your suggestions and verified the change in sensitivity. My windows are brand new three glass windows and as you describe wind etc can make vibrations but they are not noticeable even if I have my finger on the window. It is mounted in the bottom right corner of the window just as many millimeters needed to be able to change battery. In ZHA component you can check what the value currently is set to by pressing the button and the “get Zigbee attribute” and it says “21”. Se attached

Interesting.

I wish I had additional ideas…I have speculated maybe they’re more sensitive in one orientation than another, but I also haven’t got enough experience to prove that. I do see mine trigger randomly for exactly 1 minute, but I also can’t declare them false positives where I live (nearby military base often shakes the whole area testing things that go boom)

In my case, I simply made a filter for if ignoring all triggers under 2 minutes, but if you want it to be a security sensor you probably don’t want to do that.

I wonder if the Aqara/Xiaomi door/window sensor would do better for you since it uses a magnet and sensor to tell when things are open/shut so vibrations won’t affect them?

I maybe that I won’t be able to use the but that would be ashame :frowning:

Magnet sensor would be possible for just the open/shut cause but I would like to use both the tilt angle (to tell how much the window is open) and the vibration for alarm purposes. A magnet sensor can just give me open or closed and no vibration for telling if someone crash my window :slight_smile:

Would be interesting to se if the sensor is acting the same when used via Aqara gateway, anyone with experience on this?

The Xiaomi window/door contact sensors are small and worth considering. Also, you can replace the magnet part with these really tiny magnets from Amazon.

Hello, I would like to monitor the main door by adding a Xiaomi vibration sensor. The idea is to detect when the door is being forced by drilling, hammering or bumping. Do you know if the sensor is sensitive enough to detect such scenarios?

I would think hammering and bumping is definitely fine, drilling I’m not sure.
The washing machine motion does work though.
You can set the sensitivity of the sensor I have read here on the forum somewhere a little up in this thread

I am also having this issue, since going from zigbee2mqtt to ZHA, I keep getting random alerts from a basic off -> on automation (I used to use to:vibrate (or something like that) in zigbee2mqtt), nothing shows in zha_event, Whilst overall I really like ZHA and the work that has gone into it is fantastic, I do find it difficult to work with at times (possibly due to xiaomi not sticking to standards?), I finally managed to get the cube working, just this aquara tilt/vibration sensor left out of the several devices. If anyone has any further suggestions it would be appreciated, meanwhile I will continue to investigate, re-adding / playing with the clusters. I had to re-add the cube about 20 times for it to finally start giving proper zha_events that I can use in nodered / automations.

Hello to everyone!!! I like ZHA works very well, but i have the same problem with the vibration sensor…
Did someone hav found a solution?

UPDATE!!
I have fixed this issue by removing this string:
before

            elif attrid == RECENT_ACTIVITY_LEVEL_ATTR:
                # these seem to be sent every minute when vibration is active
                self.endpoint.device.motion_bus.listener_event(MOTION_EVENT)

In this file:
/usr/local/lib/python3.8/site-packages/zhaquirks/xiaomi/aqara/vibration_aq1.py

Remeber to access at this file via portainer using homeassistant docker console!!!

Hi @Wes93!

So You mean that after that your vibration sensor is acting better without random alerts? But I guess it work fine if there is a real vibration?

In my case I also had the issue that the tilt sensor didn’t send info as often as needed, som when opening and closing windows it only worked sometimes…

The vibration to sensitive and tilt the opposite :laughing:

Yes i can confirm that after this the sensor works really well!! :slight_smile:

I don’t have problem about tilt, for this try to check the connection trough the coordinator or if you use a router check the compatibility of the router

Regards
Stefano

Very nice!

But you are using the tilt sensor? For what and how is it behaving for you?

Powerful nuc with unraid and hass in docker. ZHA and conbee stick. Everything else works perfectly fine and have a fairly large zigbee network with 25+ hue lamps and ikea switches. The coverage is not a problem and it was doing the same near and far from the controller.

May have to test again all though I was testing it for 2-3 months before I gave up the idea of using it as I hoped :frowning:

Following this discussion…
I have a sensor hooked up through ZHA, just lying still on a bench in an unused bedroom. I want it stable and proven without false triggers before I deploy it it on a window to extend my alarm system. In the quest for our search for reliability, also scan for patterns… Attached my last 24 hours of false triggers. I think I am looking for either something which screws up the 2.4Ghz environment almost every hour, a fridge at the neigbours or my cat jumping on this table at a near perfect frequency of almost every hour. It is not perfect at the minute, but a clear hourly pattern. Will keep U posted…
Grtz
John

@Sparks ave you tried Wes93:s solution?

Managed to change the sensitivity to 11 and 21, but only by pushing the button like crazy repeatedly, whilts sendign the commands as described here earlier. At 11 the efalse triggers reduced by roughly 50%. I am now at 21, glued it to a window, and monitoring.
The tilt function by the way works like a charm, with no false triggers. I ordered a couple more, I am going to glue one on my motorcycle. Whilst it is standing in my garage, it is a perfect tilt sensor to detect anyone who tries to move my bike.

Grtz
John

Aah, I have no trouble changing the sensitivity but it just dosent do the trick anyway…

What I meant was if you tried wes93:s solution in an earlier post, removing the string mentioned solves the problem according to that info.

I gave away my test sensor when it didnt eork so cant test myself, did order a new one though to test again.

@bubbzy - Tnx for the trigger. I have HA running on Rpi4, this image install 64bit (is it called hassio ?) . I scanned my entire filesystem through the SSL access, no way I can locate the python script as mentioned by Wes93.
Where would I find /usr/local/lib/python3.8/site-packages, to even look into the zhaquirks ?

tnx
John

Any success stories with this? I’m thinking to put some on my windows to detect glass tampering and trigger my alarm.