Xiaomi Gateway ringtone not triggering?

I have an automation when my doorbell rings, it sends an MQTT message and triggers a notification on my phone. This bit works fine, I get the notification, so I know that works.

I wanted to add so that it would also play the Doorbell tone on my Aqara gateway, but no matter what I do it doesn’t work. I can turn the gateway light on & off using Home Assistant so it’s definitely connected. Software version of gateway is latest.

Is there anything known to be dodgy with this at the moment?

Automation below in case it’s obviously wrong.

- alias: Doorbell Notify
  trigger:
   platform: mqtt
   topic: doorbell
   payload: 'Ding'
  action:
    - service: notify.mobiles
      data:
       message: "The doorbell rang at {{ states('sensor.time') }} "
    - service: xiaomi_aqara.play_ringtone
      data:
       gw_mac: C012DY5J9Y80
       ringtone_id: 10

Anything in the log?

you have an indentation issue on the ‘message’ line, and also on the gw_mac and ringtone lines. add an extra space to each of them. EDIT: just noticed an extra space is required under the trigger before platform, topic and payload.

this is the action from my automation:

  - service: xiaomi_aqara.play_ringtone
    data:
      gw_mac: 34ce008xxxxx
      ringtone_id: 10
      ringtone_vol: 20

You also need to change

  action:
    - service: notify.mobiles
      data:
       message: "The doorbell rang at {{ states('sensor.time') }} "

to

  action:
    - service: notify.mobiles
      data_template:
       message: "The doorbell rang at {{ states('sensor.time') }} "

or the {{ states(‘sensor.time’) }} will not be displayed correctly

The time is displayed correctly at the moment. That part of the automation works perfectly.

Thanks, I think the indentation in my OP got corrupted when I pasted. The first part of the automation works fine and I don’t get any errors in Yamllint, or if I do the Check Configuration tool in Hassio

It’s like this at the moment:

try adding the volume (like my example)… maybe its set too low to hear it

Tried that too, tried various different volumes as well. I’ll test it again though.

Some ideas :

Have you checked the Firmware Version of your Xiaomi Gateway? It needs to be at least 1.4.1_145
Also, you could try to call the service via developer tools to see if the ringtone plays fine.

Thanks - good suggestion. It doesn’t even trigger when I use the Call Service function in HA (as per your picture).

I’m tearing my hair out…

Edit: And firmware version is 1.4.1_155.0143

You could check the log as I suggested before…

Sorry - I did. There’s nothing (relevant) in there - no error messages, etc.

Argh. I’ve got to the bottom of it now.

I had been retrieving the GW MAC from the ‘hidden’ menu in the app. I checked on my router and the MAC it reads for the gateway is completely different. I was probably reading the wrong value in the app, it’s a mess.

I changed the automation to use the MAC from my router and it works perfectly.

Doh…

Thanks all.