Aqara smart motion (vibration) sensor

Still I can’t figure it out how to make this vibration sensor available in HA.
Hassbian with 0.81.0 ver…

EDIT:
Somehow it’s visible now in HA. Few restarts HA & Vibration sensor and it is available.

I’m not in Hassbian but “pip install”. It’s working for me now!

What did you install?

Try using events like for the motion sensor. Does that work?

How do you mean? It will always be off so cant trigger on state. Last_action will change if the new action differs from previous. If it vibrates again it wont detect since that is the same as before.

However, I do get these in the log. Maybe that will reset last_action to none when supported? Ie maybe the sensor is sending none after vibrate?

Unsupported movement_type detected: None

00:05 components/binary_sensor/xiaomi_aqara.py (WARNING)

1 Like

Yes. I said try looking at events not state. It sounds like a momentary switch.

You’d have to look at the log (maybe more verbose), or use the Node Red events node if you use that, to find it.

 - platform: event
   event_type: click (vibration?)
   event_data:
     entity_id: vibrate_sensor_entity_here
     vibration_type(??): drop(??)

I will try tomorrow. It has an attribute called last_action. It can be vibrate, tilt or freefall. It seems it can also be none and that isnt supported as of now. I dont know if if sends none when previously mentioned actions has been considered done. If so none just needs to be added and it should be alot simpler.

Will look at events. Thanks.

Okay so looking in the py file it seems like you’ll want to try this:

trigger:
  - platform: event
    event_type: xiaomi_aqara.movement
    event_data:
      entity_id: binary_sensor.vibration_sensor
      movement_type: vibrate/tilt/free_fall [choose one]

So, where do I use this? In an automation? Add to configuration.yaml?

I am guessing automation and then I have to set a variable guess to keep track.

Why would you need a variable? What do you want to do?
If you just want to trigger something then you use the event.

Event happens, trigger is fired, condition is satisfied, action is completed.

I want to keep track of when vibration was last triggered. Since las_action wont update if last_action is vibrate I need to do it in another way. If event can trigger I
guess I can keep track via variable.

Just use the automation above man. When it’s vibrate, you create an action to log the time in some custom entity somewhere.

i have the same problem in the log, altought i’m in the 0.81.0 and i’m using the vibrate event.
Unsupported movement_type detected: None
sometimes it works as expected but it’s occasional…

my automation is like this:

  • alias: sensore vibrazione vibration
    trigger:
    platform: event
    event_type: xiaomi_aqara.movement
    event_data:
    entity_id: binary_sensor.vibration_158d0002a9226a

Thanks, seems to trigger fine. However it will have a cooldown of 60 some seconds i think before it will trigger again, ie the sensor itself.

I want to keep the last 3 timestamps. How do I add that to the below, ie I want to insert timestamp in history. (just coiped from another automation which keeps a callsign from opensky)

- id: '1531691917334'
  alias: Set mailstate
  trigger:
  - event_data:
      entity_id: binary_sensor.vibration_158d0002a925ee
      movement_type: vibrate
    event_type: xiaomi_aqara.movement
    platform: event
  condition: []
  action:
  - service: variable.set_variable
    data:
      variable: last_mail
      attributes_template: "{\n  \"history_1\": \"{{ variable.state }}\",\n  \"history_2\"\
        : \"{{ variable.attributes.history_1 }}\",\n  \"history_3\": \"{{ variable.attributes.history_2\
        \ }}\"\n}\n"
    data_template:
      value: '{{now().strftime("%c")}}'

For advanced automations I’m not sure, I use Node Red now. Sorry dude!

Hi,

I’m used to install/upgrade home-assistant with just this:

source ~/hass/bin/activate
pip3 install --upgrade homeassistant

This first one activate the python virtual environment which was created with “python3 -mvenv hass”.

there are also sensor.coordination and sensor.bedactivity. I think sensor.coordination can be used in some kind of motion detection, like a door opened, but don’t know how to use in an automation.
Don’t know what is sensor.bedactivity. Maybe a sensor to detect people in bed?

I’m thinking on how to use those sensors…

Bed activity should be able to detect occupancy in beds, sofas etc. However, I havent figured out the values. It seems it gets stuck sometimes before going lower when not moving.

How did you manage the integration?
I don’t get a binary sensor. I have only 5 lines in the zigbee database and use the elelabs-zigbee-stick.

“00:15:8d:00:02:a9:20:7e” “1” “257” “1288” “4999342915697”
“00:15:8d:00:02:a9:20:7e” “1” “257” “1283” “7”
“00:15:8d:00:02:a9:20:7e” “1” “257” “85” “3”
“00:15:8d:00:02:a9:20:7e” “1” “0” “5” “lumi.vibration.aq1”
“00:15:8d:00:02:a9:20:7e” “1” “0” “4” “LUMI”

Very interesting if it works.

Anyone found out about bed activity?