Files
N22/include/automations/presence_simulation.yaml
T
claus d0e3a6c3e5 Indkørsel: erstat Hue plug med Zigbee stik_indkorsel
- grupper.yaml: fjern light.indkorsel_plug fra Indkørsel og Udendørslamper grupper
- lysindkorsel.yaml: tilføj switch.stik_indkorsel turn_on/off ved alle 6 handlinger
- presence_simulation.yaml: tilføj switch.stik_indkorsel i morgen/aften sekvenser
- andreas_kommer_hjem: tilføj switch.stik_indkorsel turn_on/off
2026-05-17 11:14:38 +02:00

195 lines
5.9 KiB
YAML

- 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"
condition:
- condition: state
entity_id: input_boolean.presence_simulation
state: "on"
action:
- variables:
lights_morning:
- light.livingroom
- light.indkorsel_2
- light.andreas_vaerelse
- light.bedroom
- light.daniels_vaerelse
- light.forgang
lights_midday:
- light.livingroom
lights_evening:
- light.livingroom
- light.indkorsel_2
- light.andreas_vaerelse
- light.bedroom
- light.daniels_vaerelse
- light.forgang
rand_music: "{{ range(0,100) | random }}"
- choose:
# 🌅 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 }}"
- service: switch.turn_on
data:
entity_id: switch.stik_indkorsel
- 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 }}"
- service: switch.turn_off
data:
entity_id: switch.stik_indkorsel
- 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 }}"
- service: media_player.media_stop
target:
entity_id: media_player.kokken
# 🌤️ 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 }}"
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 }}"
- service: switch.turn_on
data:
entity_id: switch.stik_indkorsel
- 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 }}"
- service: switch.turn_off
data:
entity_id: switch.stik_indkorsel
- 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