Files
N22/include/automations/presence_simulation.yaml
T
2026-03-25 21:06:57 +01:00

167 lines
4.8 KiB
YAML

alias: Presence Simulation - Tidsblokke (robust)
mode: restart
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"
action:
- variables:
rand_delay: "{{ range(300,1200) | random }}" # 5-20 min
rand_music: "{{ range(0,100) | random }}"
- choose:
# 🌅 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
- delay:
seconds: "{{ rand_delay }}"
- service: light.turn_off
target:
entity_id:
- light.livingroom
- light.indkoersel_2
- light.andreas_vaerelse
- light.bedroom
- light.daniels_vaerelse
- light.forgang
- 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:
seconds: "{{ range(300,900) | random }}"
- service: media_player.media_stop
target:
entity_id: media_player.kokken
# 🌤️ Middag
- conditions:
- condition: time
after: "11:59:00"
before: "18:00:00"
sequence:
- service: light.turn_on
target:
entity_id:
- light.kokken
- light.indkoersel
- delay:
seconds: "{{ rand_delay }}"
- service: light.turn_off
target:
entity_id:
- light.livingroom
- light.indkoersel_2
- light.andreas_vaerelse
- light.bedroom
- light.daniels_vaerelse
- light.forgang
- 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:
seconds: "{{ range(300,900) | 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:
- service: light.turn_on
target:
entity_id:
- light.livingroom
- light.indkoersel_2
- light.andreas_vaerelse
- light.bedroom
- light.daniels_vaerelse
- light.forgang
- delay:
seconds: "{{ rand_delay }}"
- service: light.turn_off
target:
entity_id:
- light.livingroom
- light.indkoersel_2
- light.andreas_vaerelse
- light.bedroom
- light.daniels_vaerelse
- light.forgang
- 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:
seconds: "{{ range(300,1200) | random }}"
- service: media_player.media_stop
target:
entity_id: media_player.kokken