feat: improve presence simulation with staggered lighting and realistic behavior
- Replace simultaneous light activation with sequential (staggered) control - Add per-light random delays for more natural behavior - Implement reverse-order light shutdown for realism - Introduce time-based variations (morning, midday, evening) - Add randomized music playback using Spotify playlist on Sonos - Refactor automation using repeat loops and variables for maintainability
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
alias: Presence Simulation - Tidsblokke (robust)
|
||||
alias: Presence Simulation - Tidsblokke (realistisk)
|
||||
mode: restart
|
||||
|
||||
trigger:
|
||||
@@ -16,40 +16,57 @@ condition:
|
||||
|
||||
action:
|
||||
- variables:
|
||||
rand_delay: "{{ range(300,1200) | random }}" # 5-20 min
|
||||
lights_morning:
|
||||
- light.livingroom
|
||||
- light.indkoersel_2
|
||||
- light.andreas_vaerelse
|
||||
- light.bedroom
|
||||
- light.daniels_vaerelse
|
||||
- light.forgang
|
||||
|
||||
lights_midday:
|
||||
- light.kokken
|
||||
- light.indkoersel
|
||||
|
||||
lights_evening:
|
||||
- light.livingroom
|
||||
- light.indkoersel_2
|
||||
- light.andreas_vaerelse
|
||||
- light.bedroom
|
||||
- light.daniels_vaerelse
|
||||
- light.forgang
|
||||
|
||||
rand_music: "{{ range(0,100) | random }}"
|
||||
|
||||
- choose:
|
||||
|
||||
# 🌅 Morgen
|
||||
# 🌅 MORGEN
|
||||
- conditions:
|
||||
- condition: time
|
||||
after: "06:59:00"
|
||||
before: "12:00:00"
|
||||
sequence:
|
||||
|
||||
- service: light.turn_on
|
||||
target:
|
||||
entity_id:
|
||||
- light.livingroom
|
||||
- light.indkoersel_2
|
||||
- light.andreas_vaerelse
|
||||
- light.bedroom
|
||||
- light.daniels_vaerelse
|
||||
- light.forgang
|
||||
- repeat:
|
||||
for_each: "{{ lights_morning }}"
|
||||
sequence:
|
||||
- service: light.turn_on
|
||||
target:
|
||||
entity_id: "{{ repeat.item }}"
|
||||
- delay:
|
||||
seconds: "{{ range(30,180) | random }}"
|
||||
|
||||
- delay:
|
||||
seconds: "{{ rand_delay }}"
|
||||
minutes: "{{ range(10,30) | random }}"
|
||||
|
||||
- service: light.turn_off
|
||||
target:
|
||||
entity_id:
|
||||
- light.livingroom
|
||||
- light.indkoersel_2
|
||||
- light.andreas_vaerelse
|
||||
- light.bedroom
|
||||
- light.daniels_vaerelse
|
||||
- light.forgang
|
||||
- repeat:
|
||||
for_each: "{{ lights_morning | reverse }}"
|
||||
sequence:
|
||||
- service: light.turn_off
|
||||
target:
|
||||
entity_id: "{{ repeat.item }}"
|
||||
- delay:
|
||||
seconds: "{{ range(20,120) | random }}"
|
||||
|
||||
- choose:
|
||||
- conditions:
|
||||
@@ -64,37 +81,40 @@ action:
|
||||
media_content_id: "spotify:playlist:37i9dQZF1EVHGWrwldPRtj"
|
||||
|
||||
- delay:
|
||||
seconds: "{{ range(300,900) | random }}"
|
||||
minutes: "{{ range(5,15) | random }}"
|
||||
|
||||
- service: media_player.media_stop
|
||||
target:
|
||||
entity_id: media_player.kokken
|
||||
|
||||
# 🌤️ Middag
|
||||
|
||||
# 🌤️ MIDDAG
|
||||
- conditions:
|
||||
- condition: time
|
||||
after: "11:59:00"
|
||||
before: "18:00:00"
|
||||
sequence:
|
||||
|
||||
- service: light.turn_on
|
||||
target:
|
||||
entity_id:
|
||||
- light.kokken
|
||||
- light.indkoersel
|
||||
- repeat:
|
||||
for_each: "{{ lights_midday }}"
|
||||
sequence:
|
||||
- service: light.turn_on
|
||||
target:
|
||||
entity_id: "{{ repeat.item }}"
|
||||
- delay:
|
||||
seconds: "{{ range(60,300) | random }}"
|
||||
|
||||
- delay:
|
||||
seconds: "{{ rand_delay }}"
|
||||
minutes: "{{ range(5,20) | random }}"
|
||||
|
||||
- service: light.turn_off
|
||||
target:
|
||||
entity_id:
|
||||
- light.livingroom
|
||||
- light.indkoersel_2
|
||||
- light.andreas_vaerelse
|
||||
- light.bedroom
|
||||
- light.daniels_vaerelse
|
||||
- light.forgang
|
||||
- repeat:
|
||||
for_each: "{{ lights_midday | reverse }}"
|
||||
sequence:
|
||||
- service: light.turn_off
|
||||
target:
|
||||
entity_id: "{{ repeat.item }}"
|
||||
- delay:
|
||||
seconds: "{{ range(30,180) | random }}"
|
||||
|
||||
- choose:
|
||||
- conditions:
|
||||
@@ -109,42 +129,40 @@ action:
|
||||
media_content_id: "spotify:playlist:37i9dQZF1EVHGWrwldPRtj"
|
||||
|
||||
- delay:
|
||||
seconds: "{{ range(300,900) | random }}"
|
||||
minutes: "{{ range(5,15) | random }}"
|
||||
|
||||
- service: media_player.media_stop
|
||||
target:
|
||||
entity_id: media_player.kokken
|
||||
|
||||
# 🌙 Aften
|
||||
|
||||
# 🌙 AFTEN
|
||||
- conditions:
|
||||
- condition: time
|
||||
after: "17:59:00"
|
||||
before: "22:30:00"
|
||||
sequence:
|
||||
|
||||
- service: light.turn_on
|
||||
target:
|
||||
entity_id:
|
||||
- light.livingroom
|
||||
- light.indkoersel_2
|
||||
- light.andreas_vaerelse
|
||||
- light.bedroom
|
||||
- light.daniels_vaerelse
|
||||
- light.forgang
|
||||
|
||||
- repeat:
|
||||
for_each: "{{ lights_evening }}"
|
||||
sequence:
|
||||
- service: light.turn_on
|
||||
target:
|
||||
entity_id: "{{ repeat.item }}"
|
||||
- delay:
|
||||
seconds: "{{ range(20,120) | random }}"
|
||||
|
||||
- delay:
|
||||
seconds: "{{ rand_delay }}"
|
||||
minutes: "{{ range(15,60) | random }}"
|
||||
|
||||
- service: light.turn_off
|
||||
target:
|
||||
entity_id:
|
||||
- light.livingroom
|
||||
- light.indkoersel_2
|
||||
- light.andreas_vaerelse
|
||||
- light.bedroom
|
||||
- light.daniels_vaerelse
|
||||
- light.forgang
|
||||
- repeat:
|
||||
for_each: "{{ lights_evening | reverse }}"
|
||||
sequence:
|
||||
- service: light.turn_off
|
||||
target:
|
||||
entity_id: "{{ repeat.item }}"
|
||||
- delay:
|
||||
seconds: "{{ range(20,120) | random }}"
|
||||
|
||||
- choose:
|
||||
- conditions:
|
||||
@@ -159,7 +177,7 @@ action:
|
||||
media_content_id: "spotify:playlist:37i9dQZF1EVHGWrwldPRtj"
|
||||
|
||||
- delay:
|
||||
seconds: "{{ range(300,1200) | random }}"
|
||||
minutes: "{{ range(10,20) | random }}"
|
||||
|
||||
- service: media_player.media_stop
|
||||
target:
|
||||
|
||||
Reference in New Issue
Block a user