Xiaomi Aquara Gateway - Ringtones help

Hi all

Im try to add this super handy panel to my frontend - Xiaomi Gateway Integration

I know the code is a bit old so have modified some of it like input_slider to input number and added the aquara to component name.

I cant get any sounds to play though :frowning:
The light is working great on the gateway and the lux sensor

Here is my code:

Config yaml

input_select
  gateway_sound:
    name: Ringtone
    options: 
      - "0 - Police car 1"
      - "1 - Police car 2"
      - "2 - Accident"
      - "3 - Countdown"
      - "4 - Ghost"
      - "5 - Sniper rifle"
      - "6 - Battle"
      - "7 - Air raid"
      - "8 - Bark"
#      - "9 - None"
      - "10 - Doorbell"
      - "11 - Knock at a door"
      - "12 - Amuse"
      - "13 - Alarm clock"
#      - "14 - None"
#      - "15 - None"
#      - "16 - None"
#      - "17 - None"
#      - "18 - None"
#      - "19 - None"
      - "20 - MiMix"
      - "21 - Enthusiastic"
      - "22 - GuitarClassic"
      - "23 - IceWorldPiano"
      - "24 - LeisureTime"
      - "25 - ChildHood"
      - "26 - MorningStreamLiet"
      - "27 - MusicBox"
      - "28 - Orange"
      - "29 - Thinker"
    icon: mdi:music-note

### Input boolean to mute gateway sound ###
input_boolean:
  mute_gateway_sounds:
    name: Mute
    icon: mdi:volume-off

### Input slider to control gateway volume ###
input_number:
  gateway_volume:
    name: Volume
    initial: 10
    min: 0
    max: 100
    step: 2
    icon: mdi:volume-high

### Input slider to control loop delay ###
  loop_delay:
    name: "Loop Delay"
    initial: 1
    min: 0
    max: 15
    step: 1
    icon: mdi:loop

Scripts.yaml

### Scripts to play gateway sounds ###

 play_sel_sound:
    alias: "Loop Play Sound"
    sequence:
      - condition: state
        entity_id: input_boolean.mute_gateway_sounds
        state: 'off'
      - service: xiaomi_aquara.play_ringtone
        data_template:
          gw_mac: 7811DCXXXXXX
          ringtone_id: "{{ states.input_select.gateway_sound.state.split('-')[0] }}"
          ringtone_vol: "{{ states.input_number.gateway_volume.state|int }}"
      - delay: '00:00:{{ states.input_number.loop_delay.state | int }}'
      - service: script.play_sel_sound_loop

 play_sel_sound_loop:
    alias: "Play selected sound in Loop"
    sequence:
      - condition: state
        entity_id: input_boolean.mute_gateway_sounds
        state: 'off'
      - delay: '00:00:{{ states.input_number.loop_delay.state | int }}'
      - service: script.play_sel_sound

 play_sel_sound_single:
    alias: "Single Play Sound"
    sequence:
      - condition: state
        entity_id: input_boolean.mute_gateway_sounds
        state: 'off'
      - service: xiaomi_aquara.play_ringtone
        data_template:
          gw_mac: 7811DCXXXXXX
          ringtone_id: "{{ states.input_select.gateway_sound.state.split('-')[0] }}"
          ringtone_vol: "{{ states.input_number.gateway_volume.state|int }}"

Groups.yaml

Gateway Sounds:
  name: Gateway Sounds
  entities:
  - input_boolean.mute_gateway_sounds
  - input_number.gateway_volume
  - input_select.gateway_sound
  - input_number.loop_delay
  - script.play_sel_sound
  - script.play_sel_sound_loop
  - script.play_sel_sound_single

gateweay-1

2 Likes

Assuming that your input_select has a : after it I can’t see anything else that jumps out at me :stuck_out_tongue:

Thanks, yeah it does I missed it in the copy and past just typed that part :stuck_out_tongue:

Dam was hoping there was obvious I was missing, thanks though appreciate you looking it over.

I played around with mac address formatting removed : between each also…

gw_mac: format is

gw_mac: ‘7811dcxxxxx’

2 Likes

another error is - service: xiaomi_aqara.play_ringtone

2 Likes

Thank you, no idea how I got that spelling so wrong, too funny.

I just made the changes and it works, thank you so much really appreciate the help.

This is great! Cheers :grinning:

1 Like

Hello! Help with the problem . Why when executing the play_sel_sound_loop script: the sound is played once?