# Xiaomi Vibration sensor tilt settings

Hey guys, Got a vibration sensor stuck to the cat door, so that when the cat comes in or out it detects it. However, im trying to get it to also know the difference between going in or out. This is tricky. I’ve set it(using logic) to pick up on a certain range of movement, so that when the cat comes in the tilt changes 40 degrees. However , it also changes 40 degrees when the door closes again, hence i get another notification. kinda defeats the purpose.

So what i want to is to tell it not to register the second tilt(as the door closes vertically.
i know this is a rather specific question, if anyone know a better forum for it let me know.

thanks, tom

Isn’t the angle shown in negative and positive values?

it is,however for some reason it still reacts to both axle movements. hm, im gonna get some screen dumps i think of what i’ve done so far. after all this is a veeeery important flow

Well, if you know what the normal angle is in rest, then you can add up 40 for opening in 1 direction and substract 40 for the other direction…

If angle = restvalue + 40 then cat is coming in
If angle = restvalue - 40 then cat is going out

For better results it is maybe better to use >=30 and <=30 to be also noticed when the cat trying to sneak in drunk on early hours…

1 Like

I think what he means it goes to 40 to -40 (het deurtje klappert heen en weer) the door flap back and forth

Yeah, that is exactly what i mean. But i almost know for sure that the rest position is not 0 (i have 2 myself), so he has to add or extract 40 to the value it has in rest position.

Thus, if rest position = 44,88 (random chosen…) then:
If actual value = 88,88 (44,88+40) / if actual value = 4,88 (44,88-40)
or better build in some slack if door doesn’t open completely:
if actual value >= 79,88 (greater then 44,88+35) / if actual value <= 9,88 (44,88-35)

Hey sorry late reply. Rest anglenwhen flap is down is 79.88.Then if flap is open to let cat in its - 5.

When open to let cat out its 0.12.
Its always decreasing though with er way it turns.
Hm, not quite getting your formula Peter… Will try…

Should i use max tilt or tilt x or y? Not quite getting the difference.

Ok. Maybe indeed a screeny of your flow(s) to indicate how you do it now would come in handy.

And another question is, how is the device positioned? Flat (bottom down horizontally) or on it’s side (bottom vertically).
When playing around this afternoon i noticed that the values significantly changed when i vertically rotated it over it’s sides. Maybe you can play around a bit with that to get more usable values…

Btw, to elaborate:

If “aqara vibration sensor” [the tilt alarm turned on]
and “logic” [tilt angle] is greater then
then “speech” [say something]

Something like that. But looking at the possibilities i am not sure if this is going to work because i have a sense that the tilt angle will be reported instantaneously and will not have reached the maximum…

Hmmm, give me some time, i will try to find out what the reference pane or previous position triggers do.

I playwd around with the reference plane and previois position settongs earlier, gonna try it again…

Forget all my previous calculations, it doesn’t work that way alas (at least not without creating a bunch of variables and even the i’m not sure).

One question: Is the hatch moving in only 1 way (always opens in 1 direction) or 2 ways (opens both inwards and outwards?

Both directions so the cat can go in and out(theres an nfc rader there that opens the lock for the cat, if only i could use that). Manage to get it to work decenrly one way, but still with two notificarions, one for when it opens and then when it closes…

The problem is that the tilt angle is roughly the same in both ways because the device is on it’s side.
If you try the same when it is horizontal, the angles do show pos and neg values. So the “Tilt angles to previous” will not work sideways.
I’m a bit out of time now, but you can try to mess with the “Set tilt reference vector” and “Tilt angles in mobile interface” settings or indeed with the “Tilt angles to reference plane”

Manage to get it working. Did this:

1 Like

Not pretty, but the cat don’t care then this:

Tjats max tilt is less than or equal too. And just +40 for the out notificarions. Seems to work. Thanks for the help though!

1 Like

As long as it works, who cares

1 Like

If you can detect the pos or neg of the first movement you know if the flap is opened from the outside or inside. I would have to mount the sensor waaay up in one corner, as I have the XL flap but the cat still hits it or bumps it in the upper half (I have two big maine coon).
I wouldn’t be too concerned about the direction, but I am probably going to mount a detector so I can switch on the light in the washing room with the feeder, they are making a mess and we always step on crumbs when going in to do laundry…

I got it to detect which way the flap opened, the problem was that the sensor is too slow to update, so the flap closes again before it detected the change. Quick cat i guess. I put a tile bluetooth on him instead, and use the Beacon app to know hes inside or outside.

Did you really use exact 40? If that isn’t met, it will never trigger,
Maybe use a value of >=25 or 30, the it will also trigger if it doesn’t open fully.