Help with “Aqara Vibration Sensor” and rules

Tags: #<Tag:0x00007f616e07e028> #<Tag:0x00007f616e07de48>

I have a Xiaomi Aqara Vibration Sensor, which I want to use in combination with my mechanical doorbell

When the doorbell vibrates preform an action (e.g. send notification or blink light)

I’m using Openhab 2.5.0

My items:

/ X Orientation of the device
Number E1_deurbel_x "Deurbel vibaratie X" {channel="mihome:sensor_vibration: xxxxxxxxxxc:orientationX"}

// Y Orientation of the device
Number E1_deurbel_y "Deurbel vibaratie Y" {channel="mihome:sensor_vibration: xxxxxxxxxxc:orientationY"}

// Z Orientation of the device
Number E1_deurbel_z "Deurbel vibaratie Z" {channel="mihome:sensor_vibration: xxxxxxxxxxc:orientationZ"}

Events.log

[vent.ItemStateChangedEvent] - E1_duerbel_x changed from 21 to 20
[vent.ItemStateChangedEvent] - E1_duerbel_y changed from -36 to -39

My Rule:

rule "Doorbell Ring"

when
      Item E1_duerbel_x or E1_duerbel_y or E1_duerbel_x changed
then
      sendBroadcastNotification("Doorbell Rings")
end

I have a channel “Vibration Sensor Action“ but I don’t know what type this is and how to use it!?

mihome:sensor_vibration:xxxxxxxxxxc:action

any advice on what and how to use this device?

maybe it is better to use “Vibration Sensor Action“!!!???

That’s bad syntax, but easily fixed. Each when clause must be a single event.

when
      Item E1_duerbel_x changed or
      Item E1_duerbel_y changed

Thanks rossko57 that is working !

Any idea how to create a item for “mihome:sensor_vibration:xxxxxxxxxxc:action” with out knowing the type e.g. number, string , switch or date/time ?

What does PaperUI tell you about it?

Hi Ross ,

As you can see nothing, where other channels show a type the one for Vibration sensosr action is empty

strange!

Oh, it’s an event (trigger) channel.
You cannot link that to any kind of Item directly.
You can listen for the event in a rule trigger, examples of that are shown in the binding docs.

1 Like

You are the best rossko57!

I’m learning something new every time!

Could not find “aqara vibration sensor” item en rule definitions because it was listed as “Aqara Smart Motion Sensor”. That’s why I mist it the first time.
I have made a change request on github.

Hi Michiel,

I’d be interested to hear what your experience with the Aqara Vibration Sensor with your doorbell is.

I had the same idea a few weeks ago and found that while things worked fine when the doorbell was rung, the sensor also produced several false alarms, roughly once or twice every 24-48 hours. Also when I picked up the speakerphone or pressed the door buzzer the vibration was often registered and triggered my external OH driven doorbell/messaging.

After that experience I took an Aqara Door/Window contact sensor, took it apart and placed it with the reed switch inside close to the bell/buzzer coil. So far this produces a much better result for me.

I see you tried it with the x, y and y coordinate items, I also tried with picking up the VIBRATE action directly


rule "Aqara Vibration Sensor Rule"
when
    Channel 'mihome:sensor_vibration:XXXXXXXXXXXXX:XXXXXXXXXXXXXXXX:action' triggered
then
    var actionName = receivedEvent.getEvent()
    // logInfo("Aqara Vibration Sensor", "Aqara Vibration Sensor - " + actionName)
    switch(actionName) {
        case "VIBRATE": {
            // MY EXTERNAL SOUND AND MESSAGING STUFF
        }
        case "TILT": {
            // <ACTION>
        }
        case "FREE_FALL": {
            // <ACTION>
        }
    }

All the best.

2 Likes

Hi Hans,
Nice to hear someone has the same idea. I have both implemented (eg. xyz and vibration) and the coming days wil tell what de result is.

The idea of using a window / door sensor sounds interesting. it is not yet entirely clear to me, how you have implemented this. I also wonder if we use the same type of bell. maybe this will work with my bell too. I have to look into it to figure out how you are doing it and if I can replicated it.

Thanks for your response and inspiration.

1 Like

Hi Michiel,

As long as your mechanical doorbell is not one of the completely manual twist or string doorbells and there is electricity involved, it is very likely that it uses an electromagnet to hammer on a bell or sound bars.

The Aqara Door/Window Sensor has a reed switch which normally reacts to the proximity of the magnet in the second smaller part of the sensor duo. Bringing just the sensor close to the electromagnet in the doorbell, it triggers every time the electromagnet is being activated in the bell. Then the sensors send CLOSED, while it has an OPEN state the remaing time.

Maybe also a possibility for you if the vibration sensor gives you false activations as well. I found that even if I leave mine lying dormant hidden away, it still gives small constant changed readings over several days - and no, I’m not in an earthquake prone zone :wink:

1 Like

Hans, that is really slick. Somewhere I remember a thread about guys trying to make dumb door bell ‘smart’. :+1:

After using the vibrations sensor for 10 +/- days, I come to the conclusion that there are a lot of false positives and that the solution is not usable.

as soon as I have a window door sensor free, I will see if I can integrate it. like Hans idea

Same experience then with the occasional false positives of the vibration sensor then :wink:

I suppose it can be used for situations where the x, y and/or z axis change dramatically, and these large changes can be registered and compared in a rule, like with the position or a garage door or such, but small changes and especially the VIBRATE action do have the problem with the false positives.

So far I haven’t found any proper utilisation for the vibration sensor in my setup yet.

When you do get your Door/Window contact sensor you might not even have to take the PCB out of its enclosure, as I had to to be able to fit it nicely into my doorbell enclosure.

This setup has worked flawlessly for me so far, and I’m also using the Door/Window contact sensors for my letter box.

All the best.