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
+18 -141
View File
@@ -55,53 +55,12 @@
sequence: sequence:
- parallel: - parallel:
- sequence: - sequence:
- choose: - variables:
- conditions: lille_bad_volumen: "{{ 0.5 if (now().hour >= 20 or now().hour < 6) else 0.8 }}"
- condition: time - service: script.spil_paa_lille_bad
after: '20:00:00' data:
before: '06:00:00' lydfil: german-shephard.mp3
sequence: volumen: "{{ lille_bad_volumen }}"
- service: media_player.volume_set
data:
volume_level: 0.5
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/german-shephard.mp3
media_content_type: audio/mpeg
metadata:
title: german-shephard.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: 0.8
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/german-shephard.mp3
media_content_type: audio/mpeg
metadata:
title: german-shephard.mp3
thumbnail:
media_class: music
children_media_class:
navigateIds:
- {}
- media_content_type: app
media_content_id: media-source://media_source
- sequence: - sequence:
- service: media_player.volume_set - service: media_player.volume_set
data: data:
@@ -165,53 +124,12 @@
sequence: sequence:
- parallel: - parallel:
- sequence: - sequence:
- choose: - variables:
- conditions: lille_bad_volumen: "{{ 0.5 if (now().hour >= 20 or now().hour < 6) else 0.8 }}"
- condition: time - service: script.spil_paa_lille_bad
after: '20:00:00' data:
before: '06:00:00' lydfil: dog-barking-2-bullmastiff.mp3
sequence: volumen: "{{ lille_bad_volumen }}"
- service: media_player.volume_set
data:
volume_level: 0.5
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/dog-barking-2-bullmastiff.mp3
media_content_type: audio/mpeg
metadata:
title: dog-barking-2-bullmastiff.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: 0.8
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/dog-barking-2-bullmastiff.mp3
media_content_type: audio/mpeg
metadata:
title: dog-barking-2-bullmastiff.mp3
thumbnail:
media_class: music
children_media_class:
navigateIds:
- {}
- media_content_type: app
media_content_id: media-source://media_source
- sequence: - sequence:
- service: tts.speak - service: tts.speak
target: target:
@@ -233,53 +151,12 @@
sequence: sequence:
- parallel: - parallel:
- sequence: - sequence:
- choose: - variables:
- conditions: lille_bad_volumen: "{{ 0.5 if (now().hour >= 20 or now().hour < 6) else 0.8 }}"
- condition: time - service: script.spil_paa_lille_bad
after: '20:00:00' data:
before: '06:00:00' lydfil: two-tone-chime.mp3
sequence: volumen: "{{ lille_bad_volumen }}"
- service: media_player.volume_set
data:
volume_level: 0.5
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/two-tone-chime.mp3
media_content_type: audio/mpeg
metadata:
title: two-tone-chime.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: 0.8
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/two-tone-chime.mp3
media_content_type: audio/mpeg
metadata:
title: two-tone-chime.mp3
thumbnail:
media_class: music
children_media_class:
navigateIds:
- {}
- media_content_type: app
media_content_id: media-source://media_source
- sequence: - sequence:
- service: tts.speak - service: tts.speak
target: target:
+25 -188
View File
@@ -44,53 +44,13 @@
sequence: sequence:
- parallel: - parallel:
- sequence: - sequence:
- choose: - variables:
- conditions: lille_bad_volumen: "{{ 0.5 if (now().hour >= 20 or now().hour < 6) else 0.8 }}"
- condition: time lille_bad_lydfil: "{{ 'Halloween-doorbell.mp3' if (now().hour >= 20 or now().hour < 6) else 'doorbell.mp3' }}"
after: '20:00:00' - service: script.spil_paa_lille_bad
before: '06:00:00' data:
sequence: lydfil: "{{ lille_bad_lydfil }}"
- service: media_player.volume_set volumen: "{{ lille_bad_volumen }}"
data:
volume_level: 0.5
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/Halloween-doorbell.mp3
media_content_type: audio/mpeg
metadata:
title: Halloween-doorbell.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: 0.8
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
- sequence: - sequence:
- service: tts.speak - service: tts.speak
target: target:
@@ -127,53 +87,12 @@
sequence: sequence:
- parallel: - parallel:
- sequence: - sequence:
- choose: - variables:
- conditions: lille_bad_volumen: "{{ 0.5 if (now().hour >= 20 or now().hour < 6) else 0.8 }}"
- condition: time - service: script.spil_paa_lille_bad
after: '20:00:00' data:
before: '06:00:00' lydfil: german-shephard.mp3
sequence: volumen: "{{ lille_bad_volumen }}"
- service: media_player.volume_set
data:
volume_level: 0.5
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/german-shephard.mp3
media_content_type: audio/mpeg
metadata:
title: german-shephard.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: 0.8
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/german-shephard.mp3
media_content_type: audio/mpeg
metadata:
title: german-shephard.mp3
thumbnail:
media_class: music
children_media_class:
navigateIds:
- {}
- media_content_type: app
media_content_id: media-source://media_source
- sequence: - sequence:
- service: tts.speak - service: tts.speak
target: target:
@@ -195,53 +114,12 @@
sequence: sequence:
- parallel: - parallel:
- sequence: - sequence:
- choose: - variables:
- conditions: lille_bad_volumen: "{{ 0.5 if (now().hour >= 20 or now().hour < 6) else 0.8 }}"
- condition: time - service: script.spil_paa_lille_bad
after: '20:00:00' data:
before: '06:00:00' lydfil: dog-barking-2-bullmastiff.mp3
sequence: volumen: "{{ lille_bad_volumen }}"
- service: media_player.volume_set
data:
volume_level: 0.5
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/dog-barking-2-bullmastiff.mp3
media_content_type: audio/mpeg
metadata:
title: dog-barking-2-bullmastiff.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: 0.8
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/dog-barking-2-bullmastiff.mp3
media_content_type: audio/mpeg
metadata:
title: dog-barking-2-bullmastiff.mp3
thumbnail:
media_class: music
children_media_class:
navigateIds:
- {}
- media_content_type: app
media_content_id: media-source://media_source
- sequence: - sequence:
- service: tts.speak - service: tts.speak
target: target:
@@ -263,53 +141,12 @@
sequence: sequence:
- parallel: - parallel:
- sequence: - sequence:
- choose: - variables:
- conditions: lille_bad_volumen: "{{ 0.5 if (now().hour >= 20 or now().hour < 6) else 0.8 }}"
- condition: time - service: script.spil_paa_lille_bad
after: '20:00:00' data:
before: '06:00:00' lydfil: two-tone-chime.mp3
sequence: volumen: "{{ lille_bad_volumen }}"
- service: media_player.volume_set
data:
volume_level: 0.5
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/two-tone-chime.mp3
media_content_type: audio/mpeg
metadata:
title: two-tone-chime.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: 0.8
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/two-tone-chime.mp3
media_content_type: audio/mpeg
metadata:
title: two-tone-chime.mp3
thumbnail:
media_class: music
children_media_class:
navigateIds:
- {}
- media_content_type: app
media_content_id: media-source://media_source
- sequence: - sequence:
- service: tts.speak - service: tts.speak
target: target:
+7 -47
View File
@@ -10,53 +10,13 @@ doorbell:
sequence: sequence:
- parallel: - parallel:
- sequence: - sequence:
- choose: - variables:
- conditions: lille_bad_volumen: "{{ volumennat if (now().hour >= 20 or now().hour < 6) else volumendag }}"
- condition: time lille_bad_lydfil: "{{ 'doorbell-shortened-100308.mp3' if (now().hour >= 20 or now().hour < 6) else 'doorbell.mp3' }}"
after: '20:00:00' - service: script.spil_paa_lille_bad
before: '06:00:00' data:
sequence: lydfil: "{{ lille_bad_lydfil }}"
- service: media_player.volume_set volumen: "{{ lille_bad_volumen }}"
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
- sequence: - sequence:
- service: media_player.volume_set - service: media_player.volume_set
data: 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