My configuration doesn’t work. I need to play a bell signal through the local MPD every time the doorbell button sensor goes into the on state. However, in reality, the first press does nothing, the second plays the melody, and the third again does not work. I need the playback to stop and the melody to play again,like in a normal doorbell. I have been suffering with this for a long time, please help me.
alias: 'Door bell'
initial_state: 'on'
trigger:
- entity_id: binary_sensor.doorbell
platform: state
to: 'on'
condition: []
action:
- service: media_player.volume_set
data_template:
entity_id: media_player.mpd
volume_level: 0.8
- service: media_player.play_media
data:
entity_id: media_player.mpd
media_content_type: music
media_content_id: "http://127.0.0.1:8123/local/sound/dindong.mp3"