Hello i have gateway aqara lumi-gateway-v3 mio 78819146
i can manage to ring the various sirens but the automation does not work
could someone help?
Thanks
Input select pour choisir le son a jouer
input_select:
sirenes_gateway:
name: Sirènes
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"
initial: "1 - Police car 2"
icon: mdi:alarm-bell
############################################################
INPUT_BOOLEAN
############################################################
Input boolean pour couper le son du gateway
input_boolean:
sourdine_sirenes_gateway:
name: Muet
icon: mdi:volume-off
############################################################
INPUT_NUMBER
############################################################
Input slider pour controler le volume du gateway
input_number:
gateway_volume:
name: Volume
initial: 1
min: 0
max: 100
step: 1
icon: mdi:volume-high
Input slider pour controler le delai de la boucle
delai_boucle:
name: “Délai boucle”
initial: 1
min: 0
max: 15
step: 1
icon: mdi:loop
############################################################
SCRIPTS
############################################################
Scripts pour jouer les sons du gateway
jouer_sirene:
alias: “[Alarme] Jouer sirène une fois”
sequence:
- service: xiaomi_aqara.play_ringtone
data_template:
gw_mac: xxxxxxxxxxxx
ringtone_id: “{{ states.input_select.sirenes_gateway.state.split(’-’)[0] }}”
ringtone_vol: “{{ states.input_number.gateway_volume.state|int }}”
jouer_sirene_boucle:
alias: “[Alarme] Jouer sirène en boucle”
sequence:
- condition: state
entity_id: input_boolean.sourdine_sirenes_gateway
state: ‘off’
- service: xiaomi_aqara.play_ringtone
data_template:
gw_mac: xxxxxxxxxxxx
ringtone_id: “{{ states.input_select.sirenes_gateway.state.split(’-’)[0] }}”
ringtone_vol: “{{ states.input_number.gateway_volume.state|int }}”
- delay: ‘00:00:{{ states.input_number.delai_boucle.state | int }}’
- service: script.boucle_sirene
boucle_sirene:
alias: “[Alarme] Boucle de sirène”
sequence:
- condition: state
entity_id: input_boolean.sourdine_sirenes_gateway
state: ‘off’
- delay: ‘00:00:{{ states.input_number.delai_boucle.state | int }}’
- service: script.jouer_sirene_boucle
Scripts pour les deux automatisations du input_boolean
sourdine_sirene:
alias: “[Alarme] Mettre le son de la sirène en sourdine”
sequence:
- service: xiaomi.play_ringtone
data_template:
gw_mac: xxxxxxxxxxxx
ringtone_id: “{{ states.input_select.sirenes_gateway.state.split(’-’)[0] }}”
ringtone_vol: “0”
activer_son_sirene:
alias: “[Alarme] Activer le son de la sirène”
sequence:
- service: xiaomi.play_ringtone
data_template:
gw_mac: xxxxxxxxxxxx
ringtone_id: “{{ states.input_select.sirenes_gateway.state.split(’-’)[0] }}”
ringtone_vol: “{{ states.input_slider.gateway_volume.state|int }}”
############################################################
AUTOMATIONS
############################################################
Automatisations pour le input_boolean
-
alias: ‘[Alarme] Boolean Sirène en sourdine’
initial_state: on
trigger:- platform: state
entity_id: input_boolean.sourdine_sirenes_gateway
to: ‘on’
action: - service: xiaomi_aqara.stop_ringtone
data:
gw_mac: xxxxxxxxxxxx - service: script.turn_on
entity_id: script.sourdine_sirene
- platform: state
-
alias: ‘[Alarme] Boolean Sirène son activé’
initial_state: on
trigger:- platform: state
entity_id: input_boolean.sourdine_sirenes_gateway
to: ‘off’
action: - service: script.turn_on
entity_id: script.activer_son_sirene
- platform: state