ZHA - Aqara Vibration Sensor - Set Sensitivity

Check out this blueprint, a script to set the sensitivity for the Aqara Vibration Sensor

All you have to do is, select the Aqara device and the desired sensitivity.
Be sure to press the small button on the Aqara sensor just before running the script.

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

or import directly from

Buy Me A Coffee


If you want to do it the hard way, or to validate that the script did it’s thing, read this:


This automation worked a charm for my ‘coffee machine sensor’. I use it as a notification if someone else in the house fired up the machine to play a soundbite requesting a coffee for myself… A bit silly of course, but fun as well.

Regarding the same subject; changing sensitivity of an Aqara sensor. I’ve tried several steps in updating sensitivity for the Aqara P1 motion sensor as well, but failed miserably. To be clear; I did not try to follow the instructions for the vibration sensor the motion sensor, but others that are specific to the motion sensor.

I would be greatly helped if something similar to this blueprint was available for the motion sensor. Could you (OP) or anyone else reading this, aid me in creating this?

1 Like

I tried to use this script and got the following error:

Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/commands.py:230
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 11:09:03 AM (2 occurrences)
Last logged: 11:14:28 AM

[140019939205440] Failed to set attribute: value: 11 attribute: 65293 cluster_id: 0 endpoint_id: 1
[140020030619200] Failed to set attribute: value: 1 attribute: 65293 cluster_id: 0 endpoint_id: 1
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/zha/core/device.py", line 761, in write_zigbee_attribute
    response = await cluster.write_attributes(
  File "/usr/local/lib/python3.11/site-packages/zigpy/zcl/__init__.py", line 620, in write_attributes
    return await self.write_attributes_raw(attrs, manufacturer)
  File "/usr/local/lib/python3.11/site-packages/zigpy/zcl/__init__.py", line 626, in write_attributes_raw
    result = await self._write_attributes(attrs, manufacturer=manufacturer)
  File "/usr/local/lib/python3.11/site-packages/zigpy/quirks/__init__.py", line 321, in _write_attributes
    return await super()._write_attributes(
  File "/usr/local/lib/python3.11/site-packages/zigpy/zcl/__init__.py", line 377, in request
    return await self._endpoint.request(
  File "/usr/local/lib/python3.11/site-packages/zigpy/endpoint.py", line 253, in request
    return await self.device.request(
  File "/usr/local/lib/python3.11/site-packages/zigpy/device.py", line 297, in request
    await self._application.request(
  File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 768, in request
    await self.send_packet(
  File "/usr/local/lib/python3.11/site-packages/bellows/zigbee/application.py", line 872, in send_packet
    raise zigpy.exceptions.DeliveryError(
zigpy.exceptions.DeliveryError: Failed to deliver message: <EmberStatus.DELIVERY_FAILED: 102>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 230, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 2035, in async_call
    response_data = await coro
  File "/usr/src/homeassistant/homeassistant/core.py", line 2072, in _execute_service
    return await target(service_call)
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 605, in _service_handler
    response = await self._async_start_run(
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 563, in _async_start_run
    script_result = await coro
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 594, in _async_run
    return await self.script.async_run(script_vars, context)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1578, in async_run
    return await asyncio.shield(run.async_run())
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 420, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 470, in _async_step
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 493, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 468, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 704, in _async_call_service_step
    response_data = await self._async_run_long_action(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 666, in _async_run_long_action
    return long_task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 2035, in async_call
    response_data = await coro
  File "/usr/src/homeassistant/homeassistant/core.py", line 2072, in _execute_service
    return await target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 986, in admin_handler
    await result
  File "/usr/src/homeassistant/homeassistant/components/zha/websocket_api.py", line 1305, in set_zigbee_cluster_attributes
    response = await zha_device.write_zigbee_attribute(
  File "/usr/src/homeassistant/homeassistant/components/zha/core/device.py", line 774, in write_zigbee_attribute
    raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Failed to set attribute: value: 11 attribute: 65293 cluster_id: 0 endpoint_id: 1

Same problem here. I am running 2024.01.2

I imported and ran the blueprint with the same errors. However, I was able to adjust the sensitivity using the “Josh###” link above.