Dørklokke: gendan volumen på lille bad efter afspilning

This commit is contained in:
2026-04-25 13:16:03 +02:00
parent 3d2cfe6437
commit a7580b851a
4 changed files with 81 additions and 376 deletions
+7 -47
View File
@@ -10,53 +10,13 @@ doorbell:
sequence:
- parallel:
- sequence:
- choose:
- conditions:
- condition: time
after: '20:00:00'
before: '06:00:00'
sequence:
- service: media_player.volume_set
data:
volume_level: "{{ volumennat }}"
target:
entity_id: media_player.lille_badevaerelse
- service: media_player.play_media
target:
entity_id: media_player.lille_badevaerelse
data:
media_content_id: media-source://media_source/local/doorbell-shortened-100308.mp3
media_content_type: audio/mpeg
metadata:
title: doorbell-shortened-100308.mp3
thumbnail:
media_class: music
children_media_class:
navigateIds:
- {}
- media_content_type: app
media_content_id: media-source://media_source
default:
- service: media_player.volume_set
data:
volume_level: "{{ volumendag }}"
target:
entity_id: media_player.lille_badevaerelse
- service: media_player.play_media
target:
entity_id: media_player.lille_badevaerelse
data:
media_content_id: media-source://media_source/local/doorbell.mp3
media_content_type: audio/mpeg
metadata:
title: doorbell.mp3
thumbnail:
media_class: music
children_media_class:
navigateIds:
- {}
- media_content_type: app
media_content_id: media-source://media_source
- variables:
lille_bad_volumen: "{{ volumennat if (now().hour >= 20 or now().hour < 6) else volumendag }}"
lille_bad_lydfil: "{{ 'doorbell-shortened-100308.mp3' if (now().hour >= 20 or now().hour < 6) else 'doorbell.mp3' }}"
- service: script.spil_paa_lille_bad
data:
lydfil: "{{ lille_bad_lydfil }}"
volumen: "{{ lille_bad_volumen }}"
- sequence:
- service: media_player.volume_set
data:
+31
View File
@@ -0,0 +1,31 @@
spil_paa_lille_bad:
alias: "Spil lyd på lille bad og gendan volumen bagefter"
fields:
lydfil:
description: Filnavn (fx doorbell.mp3)
example: doorbell.mp3
volumen:
description: Volumen der spilles ved (0.0-1.0)
example: 0.8
sequence:
- variables:
gammel_volumen: "{{ state_attr('media_player.lille_badevaerelse', 'volume_level') | default(0.3) }}"
- service: media_player.volume_set
data:
volume_level: "{{ volumen }}"
target:
entity_id: media_player.lille_badevaerelse
- service: media_player.play_media
target:
entity_id: media_player.lille_badevaerelse
data:
media_content_id: "media-source://media_source/local/{{ lydfil }}"
media_content_type: audio/mpeg
- delay: "00:00:02"
- wait_template: "{{ states('media_player.lille_badevaerelse') not in ['playing'] }}"
timeout: "00:01:30"
- service: media_player.volume_set
data:
volume_level: "{{ gammel_volumen }}"
target:
entity_id: media_player.lille_badevaerelse