Xaiomi Aqara alarm triggered by Sonoff door window sensors

I need some help, I have the Aqara hub V2 (With the alarm) and several Sonoff door/window sensors. The Rf bridge has been Tasmotised and I have set them up in Home assistant and homekit. I want the door window sensors to trigger the Aqara gateway alarm through an automation at night (11 pm to 6 am). I tried doing this in the home app but could not. I tried to add the aqara hub to home assistant, but that didn’t work either. Any ideas? Thanks is advance.
Maybe there is a way to create a ZigBee switch (sensor), link all sonoff sensors to trigger the ZigBee Switch and that in turn could trigger the alarm?
I’m lost an maybe even overthinking this one.


I can do everything except trigger the alarm.

The Xiaomi/aqara hub is ZigBee, not zwave. Why do you want to connect to it over zwave?

Sorry I meant ZigBee. I edited the original post.
I need to trigger the alarm at night (in case of burglary) Aqara hub V2 that works with ZigBee.
I am using Sonoff Door and window sensors. They have tasmota, but I cannot find a way to set them up as a trigger for the alarm. That’s my issue. Any ideas?

Just to add, the Sonoff sensors work with the Sonoff RF 433 bridge.

You cannot trigger the Aqara hub’s alarm from home assistant. It only works when set up via the app.

I think you can play a sound on the aqara gateway (i.e. sound the alarm) when one of the sonoff sensors detect motion. You’d need to do an automation, however:

You can get more information about the ringtones in the documentation

Here’s an untested example, you’d need to change the entity_ids of the sensors and the MAC address of the Gateway:

- alias: Night alarm
  trigger:
    - platform: state
      entity_id: binary_sensor.motion_sensor
      to: 'on'
    - platform: state
      entity_id: binary_sensor.door_window_sensor
      to: 'on'
  condition:
    - condition: time
      after: '23:00:00'
      before: '06:00:00'
  action:
    - service: xiaomi_aqara.play_ringtone
      data:
        gw_mac: '00:00:00:00:00'
        ringtone_id: 1
        ringtone_vol: 100

Adding to the post above (I don’t have a aquara hub, all my zigbee stuff works with zigbee2mqtt), but I do have 2 Sonoff Rf Bridges and 433 Mhz door sensors

Create a binary sensor :

  - platform: mqtt
    name: garagedoor
    state_topic: 'home/OpenMQTTGateway/SRFBtoMQTT'
    value_template: >- 
      {% if value_json.value == 564886 %}
        {{'ON'}}
      {% else %}
        {{states('binary_sensor.garagedoor') | upper}}
      {% endif %}
    off_delay: 30
    device_class: 'garage_door'

And an automation :

- id: '1564816850591'
  alias: garage_door_open
  trigger:
  - entity_id: binary_sensor.garagedoor
    platform: state
    to: 'on'
  condition:
    - condition: time
      after: '23:00:00'
      before: '06:00:00'
  action:
    - service: xiaomi_aqara.play_ringtone
      data:
        gw_mac: '00:00:00:00:00'
        ringtone_id: 1
        ringtone_vol: 100

How did you add the service?
service: xiaomi_aqara.play_ringtone

I thought the Aqara hub V2 integration did not work with HA.

Also can I work without zigbee2mqtt as all my binary sensors are already added.
Thank you all for the help so far, looks like I am almost there.

As I don’t have an Aqara hub, I just copied the action part from the post above. The Aqara hub can be added to HA, just search the forum.

Yes, i found this but no one said it works 100%. So didn’t give it a go.


I guess, I have to try and will find out.

How did you get this?
service: xiaomi_aqara.play_ringtone
I cannot figure it out. Please help.

It’s a service in an automation.

If you’re using the UI it should be in the “action” part in the dropdown.

Hi Krichkov, that state is not there at all. I’m using a lot of other automations however that Xiaomi state is not present.
Are you using gateway 1 or gateway v2?

Just found how to do this. Hope this is still usefull for you guys.
I created the Automation and added this action straight into the automations.yaml file. Mac address needs to be added without the colons.

  - data: {"gw_mac":"XXXXXXXXXXXX","ringtone_id":"1","ringtone_vol":"100"}
    service: xiaomi_aqara.play_ringtone

I tried but wasn’t able to do this in the GUI