Binary Sensor Xiaomi Vibration Sensor Help

Hello to Everyone!!
Can someone help me to set a Template Binary Sensor for the Xiaomi Vibration sensor?
I know that the sensor: sensor.0x00158d0002b2395f_action can have two actions (Tilt, Vibration), and if some of this happen the binary turn on else off
Thanks a Lot
Stefano

See below.

At the bottom of the page there are some examples for the vibration sensor

Thanks a lot, i have seen this but i don’t have used the Aqara hub i have added the sensor directly with cc2531 and Mqtt… in the wiki you have linked they says that i need to have this : The requirement is that you have setup the xiaomi aqara integration.

I dont know how it works with the Zigbee, i got everything trough the gateway

OK, thanks a lot for your answer i home someone can help me.

Using the sensor is exactly the same regardless of what hub you use, Home Assistant interacts the same way. The examples provided on that page will work for you, I use the same sensor with the zigbee2mqtt hub and there are no differences.

Thanks a lot for your reply.
I have read the wiki but there is a way to set up a binary_sensor instead of the sensor.0x00158d0002af6ae9_action?
Because i have this in my automation to show which sensor has triggered the alarm but not work with the normale sensor:

 {% for state in states.binary_sensor -%}\n  {% if state.state == 'on' %}\n    {{ state.name }}\n  {%- endif -%}\n{%- endfor -%}\n"

I dont believe you can set it up as binary. I have my automations set to sense any change to the sensors action state which works for myself.

I Have solved thank’d to this: