128 lines
4.6 KiB
YAML
128 lines
4.6 KiB
YAML
alias: Presence Simulation - Tidsblokke med rum
|
|
description: Simulerer tilstedeværelse i forskellige rum med musik
|
|
trigger:
|
|
- platform: time
|
|
at: "07:00:00" # Morgen
|
|
- platform: time
|
|
at: "12:00:00" # Middag
|
|
- platform: time
|
|
at: "18:00:00" # Aften
|
|
condition:
|
|
- condition: state
|
|
entity_id: input_boolean.presence_simulation
|
|
state: "on"
|
|
- condition: time
|
|
after: "07:00:00"
|
|
before: "22:30:00"
|
|
action:
|
|
- choose:
|
|
- conditions:
|
|
- condition: time
|
|
after: "07:00:00"
|
|
before: "12:00:00"
|
|
sequence:
|
|
# Morgen: Bad + forgang
|
|
- service: homeassistant.turn_on
|
|
target:
|
|
entity_id:
|
|
- binary_sensor.bad_motion_sensor_motion
|
|
- binary_sensor.forgang_sensor_motion
|
|
- delay:
|
|
seconds: "{{ range(5,20)|random }}"
|
|
- service: homeassistant.turn_off
|
|
target:
|
|
entity_id:
|
|
- binary_sensor.bad_motion_sensor_motion
|
|
- binary_sensor.forgang_sensor_motion
|
|
# Musik chance
|
|
- choose:
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{ range(0,10)|random < 2 }}" # 20% chance
|
|
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
|
|
|
|
- conditions:
|
|
- condition: time
|
|
after: "12:00:00"
|
|
before: "18:00:00"
|
|
sequence:
|
|
# Middag: Køkken + indkørsel
|
|
- service: homeassistant.turn_on
|
|
target:
|
|
entity_id:
|
|
- binary_sensor.indkorsel_sensor_motion
|
|
- binary_sensor.hue_motion_sensor_2_motion
|
|
- delay:
|
|
seconds: "{{ range(5,20)|random }}"
|
|
- service: homeassistant.turn_off
|
|
target:
|
|
entity_id:
|
|
- binary_sensor.indkorsel_sensor_motion
|
|
- binary_sensor.hue_motion_sensor_2_motion
|
|
# Musik chance
|
|
- choose:
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{ range(0,10)|random < 3 }}" # 30% chance
|
|
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
|
|
|
|
- conditions:
|
|
- condition: time
|
|
after: "18:00:00"
|
|
before: "22:30:00"
|
|
sequence:
|
|
# Aften: Stue + hue sensors
|
|
- service: homeassistant.turn_on
|
|
target:
|
|
entity_id:
|
|
- binary_sensor.stue_motion_bevaegelse
|
|
- binary_sensor.hue_motion_sensor_2_motion_2
|
|
- binary_sensor.hue_motion_sensor_1_motion_2
|
|
- delay:
|
|
seconds: "{{ range(5,20)|random }}"
|
|
- service: homeassistant.turn_off
|
|
target:
|
|
entity_id:
|
|
- binary_sensor.stue_motion_bevaegelse
|
|
- binary_sensor.hue_motion_sensor_2_motion_2
|
|
- binary_sensor.hue_motion_sensor_1_motion_2
|
|
# Musik chance
|
|
- choose:
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{ range(0,10)|random < 5 }}" # 50% chance
|
|
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
|