Fix presence simulation activation flow

This commit is contained in:
2026-04-05 19:23:09 +02:00
parent bc706543b3
commit b68c4a3382
3 changed files with 190 additions and 198 deletions
+153 -159
View File
@@ -1,184 +1,178 @@
alias: Presence Simulation - Tidsblokke (realistisk)
mode: restart
- alias: Presence Simulation - Tidsblokke (realistisk)
mode: restart
trigger:
- platform: time
at: "07:00:00"
- platform: time
at: "12:00:00"
- platform: time
at: "18:00:00"
trigger:
- platform: time
at: "07:00:00"
- platform: time
at: "12:00:00"
- platform: time
at: "18:00:00"
condition:
- condition: state
entity_id: input_boolean.presence_simulation
state: "on"
condition:
- condition: state
entity_id: input_boolean.presence_simulation
state: "on"
action:
- variables:
lights_morning:
- light.livingroom
- light.indkoersel_2
- light.andreas_vaerelse
- light.bedroom
- light.daniels_vaerelse
- light.forgang
action:
- variables:
lights_morning:
- light.livingroom
- light.indkorsel_2
- light.andreas_vaerelse
- light.bedroom
- light.daniels_vaerelse
- light.forgang
lights_midday:
- light.kokken
- light.indkoersel
lights_midday:
- light.livingroom
lights_evening:
- light.livingroom
- light.indkoersel_2
- light.andreas_vaerelse
- light.bedroom
- light.daniels_vaerelse
- light.forgang
rand_music: "{{ range(0,100) | random }}"
lights_evening:
- light.livingroom
- light.indkorsel_2
- light.andreas_vaerelse
- light.bedroom
- light.daniels_vaerelse
- light.forgang
- choose:
rand_music: "{{ range(0,100) | random }}"
# 🌅 MORGEN
- conditions:
- condition: time
after: "06:59:00"
before: "12:00:00"
sequence:
- repeat:
for_each: "{{ lights_morning }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ repeat.item }}"
- delay:
seconds: "{{ range(30,180) | random }}"
- delay:
minutes: "{{ range(10,30) | random }}"
- repeat:
for_each: "{{ lights_morning | reverse }}"
sequence:
- service: light.turn_off
target:
entity_id: "{{ repeat.item }}"
- delay:
seconds: "{{ range(20,120) | random }}"
- choose:
- conditions:
- condition: template
value_template: "{{ rand_music < 20 }}"
- choose:
# 🌅 MORGEN
- conditions:
- condition: time
after: "06:59:00"
before: "12:00:00"
sequence:
- repeat:
for_each: "{{ lights_morning }}"
sequence:
- service: media_player.play_media
- service: light.turn_on
target:
entity_id: media_player.kokken
data:
media_content_type: music
media_content_id: "spotify:playlist:37i9dQZF1EVHGWrwldPRtj"
entity_id: "{{ repeat.item }}"
- delay:
minutes: "{{ range(5,15) | random }}"
seconds: "{{ range(30,180) | random }}"
- service: media_player.media_stop
target:
entity_id: media_player.kokken
- delay:
minutes: "{{ range(10,30) | random }}"
# 🌤️ MIDDAG
- conditions:
- condition: time
after: "11:59:00"
before: "18:00:00"
sequence:
- repeat:
for_each: "{{ lights_midday }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ repeat.item }}"
- delay:
seconds: "{{ range(60,300) | random }}"
- delay:
minutes: "{{ range(5,20) | random }}"
- repeat:
for_each: "{{ lights_midday | reverse }}"
sequence:
- service: light.turn_off
target:
entity_id: "{{ repeat.item }}"
- delay:
seconds: "{{ range(30,180) | random }}"
- choose:
- conditions:
- condition: template
value_template: "{{ rand_music < 30 }}"
- repeat:
for_each: "{{ lights_morning | reverse }}"
sequence:
- service: media_player.play_media
- service: light.turn_off
target:
entity_id: media_player.kokken
data:
media_content_type: music
media_content_id: "spotify:playlist:37i9dQZF1EVHGWrwldPRtj"
entity_id: "{{ repeat.item }}"
- delay:
minutes: "{{ range(5,15) | random }}"
seconds: "{{ range(20,120) | random }}"
- service: media_player.media_stop
target:
entity_id: media_player.kokken
- choose:
- conditions:
- condition: template
value_template: "{{ rand_music < 20 }}"
sequence:
- service: media_player.play_media
target:
entity_id: media_player.kokken
data:
media_content_type: music
media_content_id: "spotify:playlist:37i9dQZF1EVHGWrwldPRtj"
- delay:
minutes: "{{ range(5,15) | random }}"
# 🌙 AFTEN
- conditions:
- condition: time
after: "17:59:00"
before: "22:30:00"
sequence:
- service: media_player.media_stop
target:
entity_id: media_player.kokken
- repeat:
for_each: "{{ lights_evening }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ repeat.item }}"
- delay:
seconds: "{{ range(20,120) | random }}"
- delay:
minutes: "{{ range(15,60) | random }}"
- repeat:
for_each: "{{ lights_evening | reverse }}"
sequence:
- service: light.turn_off
target:
entity_id: "{{ repeat.item }}"
- delay:
seconds: "{{ range(20,120) | random }}"
- choose:
- conditions:
- condition: template
value_template: "{{ rand_music < 50 }}"
# 🌤️ MIDDAG
- conditions:
- condition: time
after: "11:59:00"
before: "18:00:00"
sequence:
- repeat:
for_each: "{{ lights_midday }}"
sequence:
- service: media_player.play_media
- service: light.turn_on
target:
entity_id: media_player.kokken
data:
media_content_type: music
media_content_id: "spotify:playlist:37i9dQZF1EVHGWrwldPRtj"
entity_id: "{{ repeat.item }}"
- delay:
minutes: "{{ range(10,20) | random }}"
seconds: "{{ range(60,300) | random }}"
- service: media_player.media_stop
- delay:
minutes: "{{ range(5,20) | random }}"
- repeat:
for_each: "{{ lights_midday | reverse }}"
sequence:
- service: light.turn_off
target:
entity_id: media_player.kokken
entity_id: "{{ repeat.item }}"
- delay:
seconds: "{{ range(30,180) | random }}"
- choose:
- conditions:
- condition: template
value_template: "{{ rand_music < 30 }}"
sequence:
- service: media_player.play_media
target:
entity_id: media_player.kokken
data:
media_content_type: music
media_content_id: "spotify:playlist:37i9dQZF1EVHGWrwldPRtj"
- delay:
minutes: "{{ range(5,15) | random }}"
- service: media_player.media_stop
target:
entity_id: media_player.kokken
# 🌙 AFTEN
- conditions:
- condition: time
after: "17:59:00"
before: "22:30:00"
sequence:
- repeat:
for_each: "{{ lights_evening }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ repeat.item }}"
- delay:
seconds: "{{ range(20,120) | random }}"
- delay:
minutes: "{{ range(15,60) | random }}"
- repeat:
for_each: "{{ lights_evening | reverse }}"
sequence:
- service: light.turn_off
target:
entity_id: "{{ repeat.item }}"
- delay:
seconds: "{{ range(20,120) | random }}"
- choose:
- conditions:
- condition: template
value_template: "{{ rand_music < 50 }}"
sequence:
- service: media_player.play_media
target:
entity_id: media_player.kokken
data:
media_content_type: music
media_content_id: "spotify:playlist:37i9dQZF1EVHGWrwldPRtj"
- delay:
minutes: "{{ range(10,20) | random }}"
- service: media_player.media_stop
target:
entity_id: media_player.kokken