Issues with Xiaomi Vibration Sensor

I’ve made this yesterday:

I don’t know if that’s working, I didn’t take the time to check the code but if that can help somebody, maybe use it as an idea…

# Lave-Linge
  - alias: lavelinge_activite
trigger:
  platform: event
  event_type: xiaomi_aqara.movement
  event_data:
    entity_id: binary_sensor.vibration_158d0002b3XXXX
    movement_type: vibrate 
action:
- service: input_boolean.turn_on
  entity_id: input_boolean.lavelinge_timer_automation
- service: timer.start
  entity_id: timer.lavelinge_3min
- service: counter.increment
  entity_id: counter.vibrations_lavelinge

# Timer Zero
  - alias: lavelinge_timer_0
trigger:
- platform: event
  event_type: timer.finished
  event_data:
    entity_id: timer.lavelinge_3min
action:
- service: input_boolean.turn_off
  entity_id: input_boolean.lavelinge_timer_automation
- service: counter.reset
  entity_id: counter.vibrations_lavelinge

# Counter
  - alias: lavelinge_counter
trigger:
  platform: numeric_state
  entity_id: counter.vibrations_lavelinge
  above: 2
action:
- service: input_boolean.turn_on
  entity_id: input_boolean.lavelinge

I’m at work right now, if I’ve some time I’m gonna try to check this tonight, but I will have to wait the next washing machine to test it in real condition :slight_smile:

To explain a little bit the code:

When a vibrate is detected, launch a countdown of 3 minutes and switch-on an input
When the countdown is down to zero, switch off the input

Eventually that will do the job to have a “vibrate” that isn’t forever and will switch back to “off” after 3 minutes

I’m adding a counter to know if that’s just a 1 tap on the vibration sensor or if it is continous, in my application to know if I just touched the door of my washing machine or if it is actually running.